> ## Documentation Index
> Fetch the complete documentation index at: https://docs.backtale.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Upgrade Backtale by image digest

> Back up, verify the new digest, and change only the pinned image. Release 1.0.0 needs the access-guard two-push note before any upgrade.

Upgrade Backtale by changing the pinned digest, not by moving a tag. There is no `latest` tag. Downgrades are not supported: to go back, restore the database backup and run the previous digest.

## Change the digest

**1. Read the release notes**

Confirm whether a backup is required, whether a minimum version is named, and whether the access-guard two-push note below applies. Do not start the new image until you know which of those is true.

**2. Back up the database**

On Compose:

```bash theme={null}
docker compose exec -T db sh -c 'pg_dump -U "$POSTGRES_USER" -Fc --no-owner --no-acl "$POSTGRES_DB"' > backtale-$(date +%F).dump
```

On a cloud database, take the provider backup (Flexible Server, an RDS snapshot, or a Cloud SQL backup) as well. Keep `TOKEN_ENCRYPTION_KEY` with the backup, in a different place from the dump.

**3. Verify the new digest**

Use the commands on [Verify](https://docs.backtale.app/install/verify.md) with the new digest and the same `cosign.pub`, after the fingerprint still matches `8c6b0c4269c1aace534479a90f72b3d45f3b3be44a099d1eda60fec094578e82` (or the new fingerprint the release notes publish, checked on a second channel).

**4. Point the running install at that digest**

Compose:

```bash theme={null}
BACKTALE_IMAGE=ghcr.io/rahilp/backtale@sha256:<new-digest> docker compose up -d --no-build
```

Terraform: set `image_digest` and apply. On AWS, mirror the new digest into ECR first. See [AWS](https://docs.backtale.app/install/aws.md).

With one replica, migrate-on-boot applies schema changes. Do this outside working hours. Jobs that were running are marked interrupted and can be tried again.

## Access-guard migration: two pushes

The migration `20261201000000_p2_guard_triggers` installs database guards on `Membership` and on `User.instanceRole`. Those guards refuse any write of who has access that does not go through the grant service.

Staging received that migration in one step together with the grant-service code. A customer install must not take that combination as a single jump onto a database that is already serving.

Backtale cuts it as two releases when an existing install does not already run the grant service:

1. **Push 1** ships the grant-service code and does not include the folder `prisma/migrations/20261201000000_p2_guard_triggers`. Install this digest and leave it running.
2. **Push 2** adds only that migration, after the install is already on push 1. The process that is serving while the migration runs already writes access through the grant service, and rolling back to push 1 still works.

Release `1.0.0` (`sha256:a4b6216589d14bd4be4deb7db4ed2f81ad28f65b76475135d741bab4c0d8721a`) is the first published customer image that contains both the grant-service code and that migration folder.

* **New empty database:** you can install `1.0.0`. Migrate-on-boot applies every migration, including the guard, and then the server starts. Nothing older is writing access beside it.
* **Any database that already ran an earlier Backtale image:** do not move it to this digest in one step. Wait for release notes that name the push 1 digest and, after you are on that digest, the push 2 digest. If you are not sure the image you run today already includes the grant service, ask Backtale support before you change `BACKTALE_IMAGE` or `image_digest`.

Do not delete migration folders on a running database to imitate push 1. The two pushes are separate images Backtale publishes.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.