# Production deployment of the WebFrost server (API + web UI + scheduler). # Also served as https://webfrost.dev/compose.yml: # # curl -fsSLO https://webfrost.dev/compose.yml # [ -f .env ] || echo "SESSION_SECRET=$(openssl rand -hex 32)" > .env # docker compose up -d # # (From a clone of the repository: docker compose -f docker-compose.prod.yml up -d) # # Compose reads .env from this directory for the ${...} substitutions below. # Then open http://localhost:3000 and create the admin user. # # Continuous SQLite backups to S3-compatible storage (Litestream), optional: # docker compose -f docker-compose.prod.yml --profile backup up -d # See apps/docs/content/docs/guides/backups.mdx for the variables and for restoring. services: webfrost: image: ghcr.io/gtkatakura/webfrost/server:${IMAGE_TAG:-latest} # Or build locally: uncomment the build block and comment out image above # build: # context: . # dockerfile: packages/server/Dockerfile restart: unless-stopped # Room for the server to finish running archives on shutdown (WEBFROST_SHUTDOWN_TIMEOUT_MS, 20 s). stop_grace_period: 30s # Reaps the Chromium and yt-dlp child processes the extractors spawn. init: true ports: - "${PORT:-3000}:3000" environment: PORT: "3000" WEBFROST_DIR: /data # Required: signs session cookies. The server refuses to start without it. SESSION_SECRET: ${SESSION_SECRET:?Set SESSION_SECRET — generate one with "openssl rand -hex 32"} # Optional: the first-run setup asks for this token, so nobody else can claim a fresh instance. WEBFROST_SETUP_TOKEN: ${WEBFROST_SETUP_TOKEN:-} # Set to "true" only behind a reverse proxy that sets X-Forwarded-For. WEBFROST_TRUST_PROXY: ${WEBFROST_TRUST_PROXY:-false} # Pipelines run in parallel (each launches a headless Chromium). WEBFROST_CONCURRENCY: ${WEBFROST_CONCURRENCY:-3} # Time zone used to evaluate cron expressions. TZ: ${TZ:-UTC} # Let anonymous visitors browse (never change) the archive. WEBFROST_PUBLIC_READ: ${WEBFROST_PUBLIC_READ:-false} # Session cookies are Secure, so signing in over plain HTTP on a non-localhost # address fails. Set to "true" only for an HTTP-only deployment (e.g. a LAN IP). WEBFROST_INSECURE_COOKIES: ${WEBFROST_INSECURE_COOKIES:-false} # Allow archiving private/loopback addresses (intranet archiving). WEBFROST_ALLOW_PRIVATE_URLS: ${WEBFROST_ALLOW_PRIVATE_URLS:-false} # Minimum gap in ms between two archives of the same host. WEBFROST_DOMAIN_DELAY_MS: ${WEBFROST_DOMAIN_DELAY_MS:-1000} # Set to "false" if a separate `webfrost schedule worker` runs the schedules. WEBFROST_SCHEDULER: ${WEBFROST_SCHEDULER:-true} WEBFROST_LOG_LEVEL: ${WEBFROST_LOG_LEVEL:-info} # Metadata database. Empty: SQLite at /data/archive.db. Or postgres://… / mysql://… # (see apps/docs/content/docs/guides/deploy.mdx, "Choosing a database"). DATABASE_URL: ${DATABASE_URL:-} # Storage backend: filesystem (default) or s3. See apps/docs/content/docs/guides/storage.mdx. WEBFROST_STORAGE_BACKEND: ${WEBFROST_STORAGE_BACKEND:-filesystem} S3_ENDPOINT: ${S3_ENDPOINT:-} S3_BUCKET: ${S3_BUCKET:-} S3_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID:-} S3_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY:-} S3_REGION: ${S3_REGION:-us-east-1} S3_PATH_PREFIX: ${S3_PATH_PREFIX:-snapshots} # Optional OpenTelemetry export to your own collector (off unless an endpoint is set). # Uncomment what you use. See apps/docs/content/docs/guides/observability.mdx. # OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-} # OTEL_EXPORTER_OTLP_HEADERS: ${OTEL_EXPORTER_OTLP_HEADERS:-} # OTEL_SERVICE_NAME: ${OTEL_SERVICE_NAME:-webfrost} # OTEL_RESOURCE_ATTRIBUTES: ${OTEL_RESOURCE_ATTRIBUTES:-} # OTEL_TRACES_SAMPLER: ${OTEL_TRACES_SAMPLER:-parentbased_always_on} # OTEL_TRACES_SAMPLER_ARG: ${OTEL_TRACES_SAMPLER_ARG:-1} # OTEL_LOGS_EXPORTER: ${OTEL_LOGS_EXPORTER:-} # The container runs as UID 1000. A named volume gets that ownership on first use; a bind # mount (./data:/data) must be owned by UID 1000: sudo chown -R 1000:1000 ./data # The image has its own HEALTHCHECK against /health. volumes: - webfrost_data:/data # Streams every change of /data/archive.db to a bucket (SQLite only; with DATABASE_URL # pointing at PostgreSQL or MySQL back that server up instead). Archive files are not # included: back up the rest of /data, or use the S3 storage backend. litestream: image: litestream/litestream:0.5.18@sha256:513bff62a88fc0c86c73d27333c41c54c89fe890a7c32a551600adff9309b11b profiles: [backup] restart: unless-stopped # Same UID as the server, so the WAL files it touches keep their owner. user: "1000:1000" command: replicate -config /etc/litestream.yml depends_on: webfrost: condition: service_healthy environment: LITESTREAM_ACCESS_KEY_ID: ${LITESTREAM_ACCESS_KEY_ID:-} LITESTREAM_SECRET_ACCESS_KEY: ${LITESTREAM_SECRET_ACCESS_KEY:-} configs: - source: litestream target: /etc/litestream.yml volumes: - webfrost_data:/data configs: litestream: content: | dbs: - path: /data/archive.db replica: type: s3 bucket: ${LITESTREAM_S3_BUCKET:-} path: ${LITESTREAM_S3_PATH:-webfrost/archive.db} endpoint: ${LITESTREAM_S3_ENDPOINT:-} region: ${LITESTREAM_S3_REGION:-us-east-1} force-path-style: ${LITESTREAM_S3_FORCE_PATH_STYLE:-false} volumes: webfrost_data: driver: local