Update Metric
Metric container versions follow the MAJOR.MINOR.PATCH format, for example 0.1.10.
Before updating
- Read the 0.1.10 release notes.
- Check the schema requirement for your selected backend.
- Back up the database, file storage and secrets together.
- Keep a copy of
.env,metric.tomland the previous image version. - Note
METRIC_PROFILEfrom.env.
If you previously enabled retention.replay_archive, set it to false before starting this version. Replay archiving is not implemented, so true now causes a configuration error. Existing archive-held replay data remains held and is not automatically deleted. See the retention upgrade details.
The current Metric binary requires MongoDB schema generation 22 exactly before starting application workers. It automatically migrates complete generation-19, generation-20 and generation-21 databases to generation 22 before ordinary startup.
PostgreSQL requires schema generation 22. It applies missing SQL migrations in order and records them in metric._sqlx_migrations. Each SQL migration and its successful journal entry are one transaction. On failure, successful earlier steps remain; the failed step rolls back and is retried after the cause is corrected. Changed checksums and newer/unknown schemas stop startup. Never edit the journal or generation number to bypass a compatibility error.
When upgrading from 0.1.8, migration 0022_native_source_bundles.sql widens the debug-file type constraint to accept native source bundles and preserves existing debug files. A 0.1.8 binary cannot open the resulting PostgreSQL schema. Downgrade requires restoring a matching pre-upgrade backup of the database, BlobStore and secrets together.
Updating to 0.1.10 preserves each existing project's grouping revision. New projects use revision 2. Before downgrading to 0.1.9, follow the grouping rollback instructions.
Artifact retention is disabled by default. An upgrade does not enable automatic removal of old source-map bundles. Start with report before choosing enforce; see artifact retention.
Installer reruns preserve existing files and permanent secrets. An ordinary update does not change the backend or move data. Keep .env, connection.env, certificate copies and the selected Compose alongside TOML; do not replace them wholesale with new templates. The new wizard is for first installation, not a database migration.
Protect existing data
You must never drop or recreate a data-bearing MongoDB database to make another Metric version start. Never edit the schema_meta generation manually. Changing that number does not migrate the stored data.
Install the new image
If the release notes do not require new profile files, open .env and change only METRIC_IMAGE:
METRIC_IMAGE=ghcr.io/biosshot/metric:<new version>Then run:
docker compose pull metric
docker compose up -d --wait --wait-timeout 120
docker compose ps
curl http://localhost:4001/readyIf Metric does not become ready, read its logs:
docker compose logs --tail=200 metricWhen release notes publish changed Compose or profile settings, compare them with your saved files before restarting. Do not replace .env wholesale: it contains the installation secrets. Do not silently switch Min, Low, Medium or High as part of an ordinary version update.
Schema compatibility
| Database state | What Metric does | What you should do |
|---|---|---|
| Empty | Creates schema generation 22 | Wait for /ready |
| Complete generation 22 | Starts normally | No schema action |
| Complete generation 19, 20 or 21 | Migrates automatically to generation 22, then starts | Keep the browser or logs open and wait for /ready |
| Older generation with a complete transition chain in the new image | Migrates automatically, then starts | Keep the browser or logs open and wait for /ready |
| Older generation without a complete transition chain | Exits with a stable error | Stop and keep the data unchanged |
| Newer or different generation | Refuses to start | Use the matching Metric version |
| Non-empty database without Metric metadata | Refuses to start | Check the database name; do not erase it |
While a published migration runs, /live remains HTTP 200 and /ready remains HTTP 503. Browser navigation shows a maintenance page with completed and remaining steps; API and SDK requests receive HTTP 503 with Retry-After. Metric starts no ordinary application workers until the target schema has been verified.
There is no separate migration command or interactive confirmation. Starting the new image authorizes every required transition shipped in that image. Transient database failures are retried inside the process. A missing transition, newer schema, ambiguous transformation or failed required invariant stops startup with a nonzero exit instead of guessing or deleting data.
Generation 19 to 20 adds the default Telegram Bot API configuration in bounded, resumable batches. Generation 20 to 21 creates the dsn_maps collection and index for existing Sentry DSNs, without rewriting existing project, key or event documents. Generation 21 to 22 repairs the Metrics archive validators and adds the archive hot-copy expiry index. It preserves existing metric payloads and the ordinary metric TTL index; the transition contains schema changes only. Archive defaults remain disabled. A generation older than 19 still fails closed because the required earlier link is absent. An empty-database setup is not a migration.
Migrations are forward-only. Changing back to an older image is safe only when that image supports the resulting schema generation. Do not assume that changing the image tag is always a valid rollback.
Backup rule
Treat MongoDB and the configured BlobStore as one operational unit. A MongoDB copy and a file-storage copy made at different times may not match each other. Keep and restore both together.
The manual backup procedure includes a database-only dump, local/S3 storage copies and an empty-target restore drill. Its no-global-lock variant has an explicit TTL consistency caveat; it is not an atomic snapshot.
Until a tested migration is published for the exact old and new schema generations, keep the old version and do not modify the existing data.