Skip to content
Docs
GitHub

Admin Container

Admin container tools for checking database migration status, rotating encryption keys, and running diagnostics.

2 min readEdit on GitHub

The admin container provides tools for key rotation, migration status checks, and other administrative tasks in production environments.

Note: Migrations are auto-applied on server startup. Use migrate-info to inspect migration status. The migrate command applies pending migrations and changes the database.

Terminal window
docker build --target admin -f docker/Dockerfile.unified -t everruns-admin .
Command Description
migrate Run pending database migrations, the same way server startup does
migrate-info Show migration status
reencrypt Re-encrypt secrets with new key
shell Interactive shell for debugging
help Show usage information

Use this before deployments to verify migration state:

Terminal window
docker run --rm \
-e DATABASE_URL="postgres://user:pass@host:5432/db" \
everruns-admin migrate-info

Migrations auto-apply on server startup. Use this only for:

  • Running migrations without starting the server
  • Debugging migration issues (with --no-migrations on server)
Terminal window
docker run --rm \
-e DATABASE_URL="postgres://user:pass@host:5432/db" \
everruns-admin migrate
Terminal window
docker run --rm \
-e DATABASE_URL="postgres://user:pass@host:5432/db" \
-e SECRETS_ENCRYPTION_KEY="kek-v2:..." \
-e SECRETS_ENCRYPTION_KEY_PREVIOUS="kek-v1:..." \
everruns-admin reencrypt --dry-run
Terminal window
docker run --rm \
-e DATABASE_URL="postgres://user:pass@host:5432/db" \
-e SECRETS_ENCRYPTION_KEY="kek-v2:..." \
-e SECRETS_ENCRYPTION_KEY_PREVIOUS="kek-v1:..." \
everruns-admin reencrypt --batch-size 50
Variable Required Description
DATABASE_URL Yes PostgreSQL connection string
SECRETS_ENCRYPTION_KEY For reencrypt Primary encryption key
SECRETS_ENCRYPTION_KEY_PREVIOUS For rotation Previous encryption key
RUST_LOG No Log level (default: info)

The admin container supports TLS connections to PostgreSQL. Use the sslmode parameter in your connection string:

Terminal window
DATABASE_URL="postgres://user:pass@host:5432/db?sslmode=require"

If the server won’t start due to a migration error:

  1. Check server logs for the specific SQL error
  2. Fix the migration file
  3. Rebuild and redeploy

If a migration succeeded but caused issues, use forward-fix:

Terminal window
# Create a new migration that fixes the problem
just new-migration fix_bad_migration
# Edit the migration, then redeploy

For emergencies where you need to manually fix the database:

Terminal window
# Start server without auto-migrations
everruns-server --no-migrations
# Connect and fix manually
psql -h host -U everruns -d everruns
> -- Fix schema issues
> DELETE FROM _sqlx_migrations WHERE version = 006; -- If needed
# Restart server normally
everruns-server

The admin container can be run as a one-off task in any container orchestration platform:

  • Kubernetes: Use a Job or run via kubectl run
  • ECS: Use aws ecs run-task with command override
  • Docker Compose: Use docker compose run
  • Nomad: Use a batch job