Skip to content

Admin Container

The admin container provides tools for running database migrations, key rotation, and other administrative tasks in production environments.

Building

Terminal window
docker build --target admin -f docker/Dockerfile.unified -t everruns-admin .

Commands

CommandDescription
migrateRun pending database migrations
migrate-infoShow migration status
reencryptRe-encrypt secrets with new key
shellInteractive shell for debugging
helpShow usage information

Usage

Run Migrations

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

Check Migration Status

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

Re-encrypt Secrets (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 --dry-run

Re-encrypt Secrets (Execute)

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

Environment Variables

VariableRequiredDescription
DATABASE_URLYesPostgreSQL connection string
SECRETS_ENCRYPTION_KEYFor reencryptPrimary encryption key
SECRETS_ENCRYPTION_KEY_PREVIOUSFor rotationPrevious encryption key
RUST_LOGNoLog level (default: info)

TLS/SSL Connections

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"

Production Deployment

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

See Production Migrations Runbook for detailed procedures.