# 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 # docker compose exec api api agent create --kind checker --region --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 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: