# The usage ping and error reports are on by default (ADR 0003), and a development stack must not # send either to Peekaping. These point both at an address nothing listens on. To try them against # a test endpoint, set TELEMETRY_URL and ERROR_REPORTING_DSN in .env. x-no-reports: &no-reports TELEMETRY_URL: ${TELEMETRY_URL:-http://127.0.0.1:9/v1/ping} ERROR_REPORTING_DSN: ${ERROR_REPORTING_DSN:-http://public@127.0.0.1:9/1} networks: appnet: services: redis: image: redis:7 restart: always ports: - "${REDIS_PORT:-6379}:6379" networks: - appnet healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 30s timeout: 2s retries: 5 start_period: 30s start_interval: 1s # The Peekaping images run as user 65532. This one-shot service makes the # data folder theirs before the migration starts: Docker creates a missing # ./.data/sqlite as root, and a database from an earlier version belongs to root. data-permissions: image: alpine restart: "no" command: ["chown", "-R", "65532:65532", "/app/data"] volumes: - ./.data/sqlite:/app/data migrate: build: context: ./apps/server dockerfile: infra/Dockerfile.migrate restart: "no" env_file: - .env volumes: - ./.data/sqlite:/app/data depends_on: data-permissions: condition: service_completed_successfully api: build: context: ./apps/server dockerfile: infra/Dockerfile.api restart: unless-stopped ports: - "8034:8034" env_file: - .env environment: <<: *no-reports # The web container on localhost:8383 calls the API on localhost:8034, another origin. CORS_ORIGINS: "${CORS_ORIGINS-http://localhost:8383}" # The local probe's token: the api stores it, and the probe sends it. Without it no # monitor is checked. PROBE_BOOTSTRAP_TOKEN: "${PROBE_BOOTSTRAP_TOKEN:?PROBE_BOOTSTRAP_TOKEN is not set: add it to .env as a random string of at least 32 characters, such as the output of openssl rand -hex 32}" volumes: - ./.data/sqlite:/app/data depends_on: redis: condition: service_healthy migrate: condition: service_completed_successfully networks: - appnet healthcheck: test: ["CMD-SHELL", "wget -qO - http://localhost:8034/api/v1/health || exit 1"] interval: 30s timeout: 2s retries: 5 start_period: 30s start_interval: 1s # The local probe: its instances run the checks of the monitors that run on the local probe. # They connect to the api, so they need no database, no Redis and no volume. probe: build: context: ./apps/server dockerfile: infra/Dockerfile.probe restart: unless-stopped # the probe takes up to 25 seconds to shut down cleanly stop_grace_period: 30s environment: PEEKAPING_URL: http://api:8034 # The probe refuses a plain http:// address to another host unless told otherwise. # This one stays on the compose network. PROBE_ALLOW_INSECURE: "true" # The token the api stores on the local probe (PROBE_BOOTSTRAP_TOKEN) PROBE_TOKEN: "${PROBE_BOOTSTRAP_TOKEN:?PROBE_BOOTSTRAP_TOKEN is not set: add it to .env as a random string of at least 32 characters, such as the output of openssl rand -hex 32}" LOG_LEVEL: ${LOG_LEVEL:-info} depends_on: api: condition: service_healthy networks: - appnet web: build: context: . dockerfile: ./apps/web/Dockerfile restart: unless-stopped ports: - "8383:80" depends_on: api: condition: service_healthy environment: - API_URL=http://localhost:8034 healthcheck: test: ["CMD-SHELL", "curl -f http://localhost:80 || exit 1"] interval: 30s timeout: 2s retries: 5 start_period: 30s start_interval: 1s