Open Gauge Documentation
Self-hosting

Docker Compose deployment

Running the full Open Gauge stack with Docker Compose — services, ports, environment variables, backups, and migrations.

Docker Compose is Open Gauge's primary, first-class deployment target. Every feature is expected to work on it — from a Raspberry Pi or Intel N100 mini PC in a lab, to an internal company server. Kubernetes support is optional and not required to run Open Gauge.

Prerequisites

  • Docker and Docker Compose installed on the host.
  • Ports 3000, 3002, 8000, 8080, 9000, 9001, and 5432 free (or remapped — see below).

Bring the stack up

cd infrastructure/docker
docker compose up -d

This builds and starts every service defined in infrastructure/docker/docker-compose.yml.

Services

ServiceImage / buildPort(s)Purpose
dbpostgres:15-alpine5432The single source of truth for all structured data.
apiapps/api/Dockerfile8000FastAPI backend (/api/v1/...), OpenAPI schema at /openapi.json.
webapps/web/Dockerfile3000The Open Gauge user interface.
docsapps/docs/Dockerfile3002This documentation site (Knowledge Center + API Reference).
admineradminer:48080Lightweight web UI for inspecting the Postgres database directly.
miniominio/minio9000 (S3 API), 9001 (console)S3-compatible object storage for certificates, datasheets, and images.

api, web, and docs wait for db (and, for web/docs, api) to report healthy before starting, via Docker Compose depends_on: condition: service_healthy — so a fresh docker compose up -d comes up in the right order automatically.

Key environment variables

Set these in infrastructure/docker/docker-compose.yml (or an .env file it references) before deploying anywhere beyond local evaluation:

VariableServicePurpose
DATABASE_URLapiPostgres connection string.
SECRET_KEYapiSigns session/auth tokens — change this in production.
CORS_ORIGINSapiJSON array of origins allowed to call the API (must include your web URL).
MINIO_ENDPOINT / MINIO_ACCESS_KEY / MINIO_SECRET_KEY / MINIO_BUCKETapiObject storage credentials.
MINIO_PUBLIC_URLapiThe externally-reachable MinIO URL used for presigned certificate/file links.
NEXT_PUBLIC_API_URLweb (build arg)The browser-reachable API URL, baked in at build time.
API_INTERNAL_URLweb, docsThe container-to-container API URL (e.g. http://api:8000), used for server-side requests.
NEXT_PUBLIC_DOCS_URLweb (build arg)The browser-reachable docs URL — used by in-app tooltips to deep-link into this documentation.

Backups

Two things need backing up:

  1. PostgreSQL (postgres_data volume) — everything structured: assets, calibrations, users, audit logs. Use pg_dump/pg_restore against the db service, or snapshot the named volume.
  2. MinIO (minio_data volume) — certificates, datasheets, and images. Snapshot the named volume, or use mc mirror against the MinIO S3 API.

Losing MinIO data doesn't corrupt calibration records (regenerate certificates on demand via GET /calibrations/{id}/certificate), but losing PostgreSQL data loses everything — back it up on a real schedule, not just the volume snapshot that happens to exist.

Running database migrations

Migrations use Alembic and live in apps/api/migrations/versions/:

docker compose -f infrastructure/docker/docker-compose.yml exec api alembic upgrade head

Run this after pulling a new Open Gauge version that includes schema changes, before restarting the api service on the new image.

Updating Open Gauge

git pull
docker compose -f infrastructure/docker/docker-compose.yml up -d --build
docker compose -f infrastructure/docker/docker-compose.yml exec api alembic upgrade head

Rebuilding is safe to run even when nothing changed — Docker will reuse cached layers.

On this page