# Release and upgrade

# Release and upgrade

How to move a running Drillmark deployment forward safely.

## Current release shape

Drillmark ships as:

- A backend container image `drillmark-api` built from `dmarc-reporter-backend/`.
- A frontend container image `drillmark-web` built from `dmarc-reporter-frontend/`.
- A `compose.yml` reference at the repo root.

The api image carries the SeaORM migrations compiled in. The web image is a static Caddy-served bundle.

## Upgrading

```
cd drillmark
git pull
docker compose pull
docker compose up --detach
docker compose logs --follow api
```

The api runs migrations at startup. Watch the logs for:

- `Applied migration <name>` lines for any new migrations.
- `AuthProviderChain` entries listing active providers.
- `Scheduler started` with the next-fire times for every scheduled job.

If the api restarts in a loop, see [Troubleshooting](/docs/drillmark/troubleshooting).

## Migration immutability

A migration committed on `main` is immutable. The repository treats editing, renaming, or deleting an already-applied migration as a defect, because SeaORM reverifies migration identity at startup and will refuse to boot if a committed migration has drifted. To change schema or data, add a new migration file; never edit an existing one.

Operators who have run a release never need to think about this unless they are pinning to a fork. The guard failure ("migration N was previously applied but has been modified") is covered in [Troubleshooting](/docs/drillmark/troubleshooting).

## Rolling back

Rolling back a release that has already applied migrations is a destructive operation. SeaORM supports `migrate down` but Drillmark does not test the down path for every migration, so the down may leave the schema in a state the previous binary refuses to accept.

Safer path for the common cases:

- Fixing a regression without schema change: pin the previous image tag in `compose.yml` and `docker compose up --detach`.
- Fixing a regression with schema change: fix forward with a new release.

Take a database backup before any upgrade that touches migrations; see [Operations: Backups](/docs/drillmark/operations/backups).

## Release cadence

Drillmark is iterative; expect releases to move at the cadence of merges to `main`. The internal change log lives in git history; there is no bundled release notes page today.

## Zero-downtime concerns

Drillmark's api is a single-process service. `docker compose up --detach` restarts it, dropping in-flight HTTP connections. For deployments where that matters, front the api with a reverse proxy that holds requests during the restart (Traefik and Caddy both do this out of the box with a modest timeout).

Jobs mid-run during a restart are recovered by the `job_locks` reaper: a lock with no heartbeat for 15 minutes is cleaned up on the next scheduled fire.
