Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Upgrading Sindri

An upgrade is replacing one binary or one image. There is no separate migrate step and no upgrade tool.

What happens on startup

sindri serve applies every outstanding database migration before it accepts a request. The migrations are embedded in the binary, so the schema a binary needs always ships with it. They run under a Postgres advisory lock: when several instances start at once, one migrates and the others wait, so a rolling restart is safe.

The blob store needs nothing. Blobs are content-addressed bytes whose layout does not change between releases.

Upgrading

  1. Back up Postgres. Migrations are written to be safe, but a backup is what makes any mistake recoverable.

  2. Replace the binary, or change the image tag:

    # Compose quickstart
    SINDRI_IMAGE=ghcr.io/spjdevops/sindri:<version> docker compose up -d
    
    # Binary
    tar -xzf sindri_<version>_linux_amd64.tar.gz sindri
    install -m 0755 sindri /usr/local/bin/sindri
    systemctl restart sindri
    
  3. Check the log for database schema is up to date. Its applied field counts the migrations this start ran.

Upgrade one release at a time. Each release’s migrations are only guaranteed to be compatible with the release before it.

Behaviour changes in 1.1

Read these before upgrading a server that other people depend on.

  • An upstream that refuses Sindri’s credential is a 502. A proxy whose upstream answers 401 or 403 now gives 502 on every protocol, and fails a virtual repository’s walk instead of being skipped. A copy already cached still serves. On OCI, only an anonymous proxy reads a bearer-carrying 401/403, or a refusal from an anonymous token endpoint, as “no such name”. A proxy with credentials always fails the walk. In a virtual repository such as [hosted, dockerhub-with-login, ghcr], an image that exists only on ghcr now gets a 502 unless the logged-in proxy is last, or runs anonymously. See ADR 14.
  • A deleted file’s name stays taken. Deleting an npm version or a PyPI filename from a hosted repository means it cannot be published again, even with identical bytes: the publish answers 409. Publish a new version. Hosted OCI-protocol files are unaffected, and files deleted before the upgrade are not remembered. See ADR 13 and ADR 24.
  • A file upstream drops answers 404 at once. Once a proxy sees that the upstream no longer lists a cached file, reads answer 404 straight away, directly and through a virtual repository, lockfile installs included. The file serves again if upstream lists it again. Its row is removed after worker.retention.proxyStaleAfter, 7 days by default. A placed file read past its cache TTL now waits for the upstream’s answer before it serves, so an upstream that accepts connections and never answers can hold each such read for the upstream timeout, 30 seconds by default. This covers npm and PyPI. On OCI, a digest manifest and its layer blobs keep serving from placement after upstream drops them, so an image pulled upstream as malicious keeps serving by digest until its tag is evicted and the collector reclaims it, unless an administrator evicts and blocks the digest (PUT /api/v1/repositories/{name}/blocked/{digest}, see ADR 14). A whole-package 404 moves a virtual repository’s walk on, so with [private-proxy, npm] a package removed from the private upstream can resolve from the public proxy; only a hosted claim protects a private name.
  • A malformed provenance header is a 400. A provenance header with invalid UTF-8 or a NUL byte is rejected.
  • npm is new. An npm repository needs publicUrl, and a configuration that declares one without it no longer loads. See the configuration reference.

Behaviour changes in 1.1.1

  • npm packuments carry real publish times. Migration 00011 adds versions.published_at, set to the insert time for every new version. Yarn 4 now installs on its default settings, so you can remove npmMinimalAgeGate: 0 from .yarnrc.yml. Read the next two items first.

  • Yarn 4 on defaults now holds back anything published in the last 24 hours, internal versions included. Its default npmMinimalAgeGate is one day, and it now has a real time to compare. A version your team publishes will not install for a day. To exempt an internal scope, add it to .yarnrc.yml:

    npmPreapprovedPackages: ["@acme/*"]
    

    The glob form is the one that matches on yarn 4.18.1; a bare "@acme" does not.

  • There is no backfill, and removing npmMinimalAgeGate: 0 breaks versions published before the upgrade. Such a version has no recorded time and is left out of time, because Sindri does not invent one. Yarn 4 treats a version it cannot date as quarantined, so once you remove the setting it will not install, now or later, unless its package is pre-approved as above. Pre-approve the affected scopes before you remove npmMinimalAgeGate: 0. The other way out is to set the time yourself in Postgres (UPDATE versions SET published_at = ... WHERE ..., on the versions table). That is an operator asserting a publish time Sindri never observed, so it is your choice to make, and Sindri does not suggest it.

  • A proxy downloads whole upstream documents. The proxy now asks npmjs for the full document instead of the abbreviated one, so upstream traffic, parsing, the response a client gets, and the cache all grow. A cached document gains time only when it refreshes, and a repository with ttl: 0 never refreshes (a cached hit is fresh forever), so a document cached before the upgrade never gains time there. To fix that, set a non-zero ttl on the proxy and reload (or run sindri apply). The ttl is read on every request and an entry’s age counts from when it was fetched, so an old entry is stale at once and the next read refreshes it. This is from reading the code, not a run of an upgraded instance. That remedy covers config-managed repositories only. The API cannot change the ttl of a repository it created (it can create and delete, not update), so the way out for an API-created proxy is to delete it and create it again with a non-zero ttl, which needs an admin and is refused for a repository that has promotion events. Raising ttl from 0 also makes the repository’s old entries, and the cached files they justified, evictable once they are older than ttl plus the stale allowance (worker.retention.proxyStaleAfter), where at ttl: 0 nothing was ever evicted. See ADR 24.

  • A proxy backs off for 30 seconds after its upstream stops answering. Since 1.1.0 a placed npm or PyPI file read past the ttl contacts upstream before it serves, so a blackholed upstream made each such read wait the full timeout. After one refresh fails because the connection failed or no response headers arrived within the timeout, that repository’s documents are not refreshed for 30 seconds: placed files serve from the cache and anything else answers 502 at once. A file upstream removes during that window keeps serving until a read after the window ends refreshes the document. A 5xx does not start the window: it is a fast answer, so it fails that one request with a 502, and a stale copy still serves, as before. Nor do 401, 403, 429, an oversize or unparsable document, or a body that stalls after the headers. The window is not configurable, and is held in memory per process. A placed file whose document is still fresh is also served without loading the document.

  • Two pushes are now refused. Publishing an npm tarball that has a partial block after its end-of-archive marker is refused (SIN-59). npm and pnpm install such a tarball, but yarn 1 cannot extract it. An OCI manifest whose org.opencontainers.image.source or org.opencontainers.image.revision annotation holds a NUL byte or invalid UTF-8 is a 400 (SIN-63), as a bad provenance header already was.

Behaviour changes in 1.2

1.2 adds no migration and changes no setting, so upgrading from 1.1.1 means replacing the image or binary and nothing else. It adds the Helm chart (ADR 28), the sindri_queue_jobs metric, and a token: form for upstream credentials (ADR 27). Four things behave differently:

  • A large n on an OCI tags list is capped, not refused. Above 200 it was a 400. It is now treated as 200, and the response carries a Link header for the next page, as Distribution does. A zero or negative n is still refused, and the management API’s page limit is unchanged (SIN-79).
  • OCI manifest reads honour every Accept line. Only the first line was read, so a Docker daemon, which sends one line per media type, could get a 404 through a proxy of a Distribution registry (SIN-78).
  • A PyPI proxy resolves relative file links against the project page, as PEP 503 says, not against the upstream’s base. This is what makes a devpi upstream work. The cached copy of an index page now stores its links absolute (SIN-77).
  • An OCI proxy refuses a token: credential. Configuration validation rejects one, and none is sent on an OCI request. token: is new in 1.2, so no existing configuration is affected (SIN-53).

Behaviour changes in 1.3

  • Remove scan gates before rolling back to 1.2.x. A stored scan gate rule stops a 1.2.x binary from starting under serve --config, because that parser does not know the scan key and refuses it. Delete the scan: gates from the configuration, apply it, and only then start the older binary.

Behaviour changes in 1.4

  • The first worker tick re-scans every approved artifact at once. With scanning on, scanning.rescanInterval defaults to 24h and the schedule fires on the first tick after the upgrade, enqueuing one scan per approved artifact. Expect a burst in the queue; it can trip the queue-backlog alert. If that matters, set scanning.rescanInterval: 0s before upgrading and set it to the interval you want once the upgrade is done, so the burst starts when you choose. See Re-scanning.
  • 1.4.1 changes the image base to Debian 13. The image is still distroless and static, running as the same non-root user with the same data directory, so nothing in a deployment changes. 1.4.1 is built with Go 1.27.4 and go-jose 4.1.9 and has no known vulnerabilities at release. A Sindri scan of the 1.4.0 image reports Go standard library, go-jose, tzdata, and ca-certificates findings, and 1.4.1 fixes them.

Behaviour changes in 1.5

  • The OCI referrers API is served. A client that attached signatures or SBOMs to an older Sindri fell back to tags named sha256-<digest>. cosign and oras now ask the API instead and stop reading those tags. Manifests pushed before the upgrade are not listed, so attach older signatures and SBOMs again. The old tags stay and can be deleted once that is done. See Signatures and SBOMs.
  • referrers is a reserved repository name segment. A new repository cannot have a name segment referrers, and a first push no longer creates one. A repository created through the API keeps working. One declared in the configuration file must be renamed before the upgrade: sindri config check refuses the name, and serve --config does not start on a file that fails the check.
  • The garbage collector keeps a referrer for as long as its subject. An untagged signature used to be collected after the grace period. It is now kept while a repository holds both it and the image it signs, and collected once it is deleted from that repository or the image goes.
  • A signature or SBOM attached as a referrer is not scanned on publish. That is a manifest that names a subject and has neither an image config nor an image layer. Anything else is scanned as before, whether or not it names a subject.

Behaviour changes in 1.5.1

  • A proxy repository’s upstream URL may not carry credentials. https://user:token@host is refused when a repository is created through the API (400) and by sindri config check, serve --config and sindri apply. The error names the field and does not repeat the value. Put the secret in the server’s credentials: section and name it with upstream.credentials (credentials_ref in the API):

    credentials:
      mirror:
        username: sindri
        password: ${MIRROR_TOKEN}
    repos:
      pypi-mirror:
        protocol: pypi
        upstream: { url: https://pypi.mirror.example/simple, credentials: mirror }
    
  • Existing repositories keep working. A repository created through the API with credentials in its URL keeps authenticating, and startup logs one warning per such repository, naming only the repository. The UI, diff and apply now show the URL with the credentials replaced by <redacted>. To remove the warning, create a replacement repository with credentials_ref and delete the old one. A repository declared in the configuration file with credentials in its URL must be fixed before the upgrade: config check refuses it, and serve --config does not start on a file that fails the check.

  • Migration 00014 is additive. It adds the table that holds blocked OCI digests. A rollback to 1.5.0 needs no database restore; the older binary ignores the table, and a blocked digest is served again until you upgrade.

  • Two scanning settings are new. scanning.jobTimeout bounds one whole scan job and defaults to 1h (0s means the default, and it must be at least timeout). A job that hits it attaches nothing and is retried with backoff. scanning.offlineScan defaults to false, or to true when skipDBUpdate is set. Neither needs a change unless you want them. See the configuration reference.

  • Trivy no longer phones home. Every scan now passes --skip-version-check and --disable-telemetry, so no server checks check.trivy.dev for a newer Trivy or sends usage telemetry to Aqua. With offlineScan on, Trivy also gets --offline-scan and makes no package lookups; an existing server with skipDBUpdate set gets it on upgrade.

  • Some scan outcomes that were skipped or retried are now failed jobs. Too many platforms, a duplicate platform, an unsupported child and an index with no platforms were counted as skipped before 1.5.1; an archive over the cap and an unsafe path were retried until attempts ran out. All six now fail once, without retries, and count as failed in sindri_scans_total. Alerts on failed may fire for artifacts that were counted as skipped before.

  • A hosted PyPI filename belongs to one version. Publishing through the API a filename that already exists under another version answers 409 FILE_EXISTS. Deleting a filename removes it under every version of the package that holds it, and a version it empties goes too. Data written before 1.5.1 that already holds a filename twice is left as it is.

  • An admin can evict and block one digest in an OCI proxy with PUT /api/v1/repositories/{name}/blocked/{digest}; DELETE unblocks it, and GET .../blocked lists them.

Behaviour changes in 1.6

  • Webhook notifications are new. A notifications: section configures webhooks for finding.new and lifecycle.promoted. Nothing is sent until you add one; see Notifications.
  • Migration 00015 is additive. It adds the webhook_deliveries table. A rollback to 1.5.1 needs no database restore; the older binary ignores the table.
  • Administrators get a System page in the UI, linked from the header, with the webhooks and their delivery log. Other users do not see the link, and the page answers 404 for them.

Rolling back

Every migration stays backward compatible for one release, so the previous binary runs against the newer schema. To roll back one release, start the previous binary or image. It finds no migrations to apply, leaves the newer schema in place, and serves. A rollback does not need a database restore.

Rolling back from 1.1 to 1.0.x needs the configuration file changed first. The 1.0.x binary does not know publicUrl or protocol: npm, so it refuses to start on a file that has either. Remove publicUrl and the npm repositories before starting it. While rolled back, files an upstream dropped serve again and deleted names are no longer enforced as taken.

Rolling back from 1.1.1 to 1.1.0 needs no configuration change. A 1.1.0 server serves no time for a hosted package, and a proxy goes back to the abbreviated document as its cache entries refresh, so yarn 4 refuses every version again unless npmMinimalAgeGate: 0 is back in .yarnrc.yml. Restore it before you roll back. The published_at column stays, unused.

Rolling back from 1.5 to 1.4.x needs no configuration change. A 1.4.x server answers 404 on the referrers route, so clients go back to the sha256-<digest> tags, which were not written while 1.5 ran: attach signatures again if you stay rolled back. Its garbage collector also collects untagged referrers after the grace period again. The manifest_subjects table stays, unused.

Rolling back from 1.6 to 1.5.1 needs the configuration file changed first. The 1.5.1 binary does not know notifications:, so it refuses to start on a file that has it. Remove the section before starting it. Deliveries still queued are left in the queue table under a job kind 1.5.1 does not run, and are sent if you upgrade again.

Rolling back further than one release is not supported without restoring the backup taken before the upgrade.

Pinning

The quickstart uses ghcr.io/spjdevops/sindri:latest so that it works first time. For anything you depend on, pin a version tag, or a digest, and upgrade on purpose.

Each release also publishes an image that includes Trivy, for vulnerability scanning: the same tag with a -trivy suffix (<version>-trivy, latest-trivy). The default image stays free of it.