Files
uptimesebi/deploy/compose/compose.yaml
T
Sebastian UnterschützandClaude Opus 5.5 fc8c01b9a4
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 12m24s
ci / test (pull_request) Successful in 12m37s
ci / build (pull_request) Successful in 15m44s
ci / image (pull_request) Successful in 4m34s
feat(deploy): Docker Compose setup for one host
deploy/compose runs the console and API with a migration step before it
starts, and through COMPOSE_PROFILES optionally a bundled TimescaleDB and
Redis (leave them out to use your own by URL), a checker and a status
page server. Only the public URL and the secret keys are mandatory, so
every combination of profiles starts; containers run read-only without
capabilities. The API gains a health command for the image's
HEALTHCHECK, as checker and status page server have.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
2026-11-23 21:50:37 +01:00

143 lines
4.4 KiB
YAML

# UptimeSebi on one host with Docker Compose. Copy .env.example to .env,
# fill it in and run: docker compose up -d
#
# COMPOSE_PROFILES in .env picks the parts: db and redis bundle TimescaleDB
# and Redis (leave them out and set UPTIME_DATABASE_URL / UPTIME_REDIS_URL
# to use your own), checker and statuspage add a checker and a status page
# server on this host. To switch a part off again, take it out of
# COMPOSE_PROFILES and remove its container: docker compose rm -sf checker
x-image: &image ${UPTIME_IMAGE:-git.zb-server.de/zb-server/uptimesebi}:${UPTIME_TAG:-latest}
x-platform: &platform
UPTIME_PUBLIC_URL: ${UPTIME_PUBLIC_URL:?set UPTIME_PUBLIC_URL in .env}
UPTIME_SECRET_KEYS: ${UPTIME_SECRET_KEYS:?set UPTIME_SECRET_KEYS in .env}
UPTIME_DATABASE_URL: ${UPTIME_DATABASE_URL:-postgres://uptime:${POSTGRES_PASSWORD:-}@db:5432/uptime?sslmode=disable}
UPTIME_REDIS_URL: ${UPTIME_REDIS_URL:-redis://:${REDIS_PASSWORD:-}@redis:6379/0}
UPTIME_SIGNUP: ${UPTIME_SIGNUP:-first-user}
UPTIME_SMTP_URL: ${UPTIME_SMTP_URL:-}
UPTIME_STATUSPAGE_URL: ${UPTIME_STATUSPAGE_URL:-}
UPTIME_TRUSTED_PROXIES: ${UPTIME_TRUSTED_PROXIES:-}
UPTIME_AGENT_IMAGE: ${UPTIME_IMAGE:-git.zb-server.de/zb-server/uptimesebi}
UPTIME_LOG_LEVEL: ${UPTIME_LOG_LEVEL:-info}
x-logging: &logging
driver: json-file
options:
max-size: 10m
max-file: "3"
x-hardening: &hardening
read_only: true
cap_drop: [ALL]
security_opt: [no-new-privileges:true]
tmpfs: [/tmp]
services:
db:
profiles: [db]
image: timescale/timescaledb:2.30.1-pg16
restart: unless-stopped
environment:
POSTGRES_USER: uptime
POSTGRES_DB: uptime
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-}
volumes:
- db:/var/lib/postgresql/data
healthcheck:
test: [CMD, pg_isready, -U, uptime, -d, uptime]
interval: 5s
timeout: 5s
retries: 30
logging: *logging
redis:
profiles: [redis]
image: redis:8-alpine
restart: unless-stopped
command: [redis-server, --requirepass, "${REDIS_PASSWORD:-}", --appendonly, "yes", --save, ""]
environment:
REDISCLI_AUTH: ${REDIS_PASSWORD:-}
volumes:
- redis:/data
healthcheck:
test: [CMD, redis-cli, ping]
interval: 5s
timeout: 5s
retries: 30
logging: *logging
# Applies the schema before the API starts, on every docker compose up.
migrate:
image: *image
command: [migrate, up]
restart: "no"
environment: *platform
depends_on:
db:
condition: service_healthy
required: false
<<: *hardening
logging: *logging
api:
image: *image
restart: unless-stopped
environment: *platform
ports:
- "${UPTIME_PORT:-8080}:8080"
depends_on:
migrate:
condition: service_completed_successfully
redis:
condition: service_healthy
required: false
healthcheck:
test: [CMD, /usr/local/bin/api, health]
interval: 30s
timeout: 5s
start_period: 20s
<<: *hardening
logging: *logging
# Create its token first, then set UPTIME_CHECKER_TOKEN:
# docker compose exec api api region add <key> <name>
# docker compose exec api api agent create --kind checker --region <key> --name <name>
checker:
profiles: [checker]
image: ${UPTIME_IMAGE:-git.zb-server.de/zb-server/uptimesebi}-checker:${UPTIME_TAG:-latest}
restart: unless-stopped
environment:
UPTIME_API_URL: http://api:8080
UPTIME_AGENT_TOKEN: ${UPTIME_CHECKER_TOKEN:-}
UPTIME_LOG_LEVEL: ${UPTIME_LOG_LEVEL:-info}
depends_on:
api:
condition: service_healthy
<<: *hardening
logging: *logging
# Create its token first, then set UPTIME_STATUSPAGE_TOKEN:
# docker compose exec api api agent create --kind statuspage --name <name>
statuspage:
profiles: [statuspage]
image: ${UPTIME_IMAGE:-git.zb-server.de/zb-server/uptimesebi}-statuspage:${UPTIME_TAG:-latest}
restart: unless-stopped
environment:
UPTIME_API_URL: http://api:8080
UPTIME_AGENT_TOKEN: ${UPTIME_STATUSPAGE_TOKEN:-}
UPTIME_STATUSPAGE_HOSTS: ${UPTIME_STATUSPAGE_HOSTS:-localhost}
UPTIME_TRUSTED_PROXIES: ${UPTIME_TRUSTED_PROXIES:-}
UPTIME_LOG_LEVEL: ${UPTIME_LOG_LEVEL:-info}
ports:
- "${UPTIME_STATUSPAGE_PORT:-8082}:8082"
volumes:
- statuspage:/var/lib/uptimesebi
depends_on:
api:
condition: service_healthy
<<: *hardening
logging: *logging
volumes:
db:
redis:
statuspage: