Files
sorsfonalak/deploy/docker-compose.yml
T
fecoandClaude Opus 5.5 ffb6060cfa
CI / test (push) Successful in 1m38s
CI / build (push) Successful in 5m46s
CI / deploy (push) Skipped
Persistent logs, no health checks in them, and softer copy
Backend and the workers also write their log as JSON into the logs
volume, one file a day kept 30 days (LOG_DIR, LOG_NAME, LOG_KEEP_DAYS),
so errors can be looked up after a container is replaced. The Docker
health check (/healthz every 30 s) no longer goes into the request log
of the backend and the horoscope API.

The home, login and packages pages no longer compare the analyses to
an experienced astrologer's depth; they say what the user gets:
detailed, personal text in minutes, for a fraction of a personal
consultation's price.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-20 17:34:24 +00:00

196 lines
6.3 KiB
YAML

# Production stack on the server (copied there by the CI deploy job).
#
# Needs next to it: .env (see .env.example) and .env.secrets
# (OPENROUTER_API_KEY). TAG in .env is set by every deployment.
x-logging: &logging
driver: json-file
options:
max-size: "10m"
max-file: "3"
services:
caddy:
image: caddy:2.11.9-alpine
ports:
- "80:80"
- "443:443"
- "443:443/udp"
environment:
DOMAIN: ${DOMAIN:?set DOMAIN in .env}
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy-data:/data
- caddy-config:/config
depends_on:
- frontend
logging: *logging
restart: unless-stopped
horoscope-api:
image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-horoscope-api:${TAG:-latest}
read_only: true
logging: *logging
restart: unless-stopped
postgres:
image: postgres:18-alpine
environment:
POSTGRES_USER: sorsfonalak
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}
POSTGRES_DB: sorsfonalak
volumes:
- pgdata:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U sorsfonalak -d sorsfonalak"]
interval: 5s
timeout: 3s
retries: 10
logging: *logging
restart: unless-stopped
# Daily compressed dump into ./backups, kept for 14 days.
backup:
image: postgres:18-alpine
environment:
PGHOST: postgres
PGUSER: sorsfonalak
PGPASSWORD: ${POSTGRES_PASSWORD}
PGDATABASE: sorsfonalak
volumes:
- ./backups:/backups
entrypoint: ["/bin/sh", "-c"]
command:
- |
while true; do
f=/backups/sorsfonalak-$$(date +%F).sql.gz
pg_dump --no-owner | gzip > "$$f.tmp" && mv "$$f.tmp" "$$f"
find /backups -name 'sorsfonalak-*.sql.gz' -mtime +14 -delete
sleep 86400
done
depends_on:
postgres:
condition: service_healthy
logging: *logging
restart: unless-stopped
backend:
image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-backend:${TAG:-latest}
environment:
DATABASE_URL: postgres://sorsfonalak:${POSTGRES_PASSWORD}@postgres:5432/sorsfonalak
HOROSCOPE_API_URL: http://horoscope-api:8080
PUBLIC_BASE_URL: https://${DOMAIN}
GOOGLE_CLIENT_IDS: ${GOOGLE_CLIENT_IDS:-}
BOOTSTRAP_ADMIN_EMAILS: ${BOOTSTRAP_ADMIN_EMAILS:-}
ANALYSIS_MODEL: ${ANALYSIS_MODEL:-}
SUMMARY_MODEL: ${SUMMARY_MODEL:-}
PASSWORD_LOGIN: ${PASSWORD_LOGIN:-false}
# Without the Stripe keys purchases are off; packages come from promo
# codes and admins (MOCK_PAYMENTS=true: pretend purchases).
MOCK_PAYMENTS: ${MOCK_PAYMENTS:-false}
# Stripe purchases for everyone (false: admins only, until the opening;
# with a test key always admins only).
PURCHASES_OPEN: ${PURCHASES_OPEN:-false}
# Buyers accept the ÁSZF on Stripe's page (needs the terms URL in
# Stripe's Public details): off until the opening.
TERMS_CONSENT: ${TERMS_CONSENT:-false}
# VAT on the invoices: AAM (alanyi adómentes) or a rate like 27%.
INVOICE_VAT: ${INVOICE_VAT:-AAM}
# Users inviting others ("Meghívom"): shown but off until the launch.
USER_INVITES: ${USER_INVITES:-false}
# A new user from a shared link earns the sharer an analysis: off until sign-up opens.
REFERRAL_REWARDS: ${REFERRAL_REWARDS:-false}
FREE_PERSON_SLOTS: ${FREE_PERSON_SLOTS:-0}
# invite: new accounts need an invitation (admin page "Meghívók"); open: anyone.
SIGNUP_MODE: ${SIGNUP_MODE:-invite}
# The log also goes to the logs volume, one file a day, kept 30 days
# (deploy/README.md: Logs).
LOG_DIR: /logs
# STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET (docs/fizetes.md): with them
# packages can be bought (a test key: by admins only).
env_file:
- path: .env.secrets
required: false
depends_on:
postgres:
condition: service_healthy
horoscope-api:
condition: service_healthy
read_only: true
volumes:
- logs:/logs
logging: *logging
restart: unless-stopped
# E-mail delivery, cleanup and the other background jobs.
worker:
image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-worker:${TAG:-latest}
environment:
DATABASE_URL: postgres://sorsfonalak:${POSTGRES_PASSWORD}@postgres:5432/sorsfonalak
WORKER_TASKS: email,cleanup,invoices
# SMTP_URL or the SES credentials come from .env.secrets (docs/levelkuldes.md);
# listing them here with an empty default would override that file.
SES_REGION: ${SES_REGION:-eu-central-1}
MAIL_FROM: ${MAIL_FROM:-Sorsfonalak <hello@sorsfonalak.hu>}
PUBLIC_BASE_URL: https://${DOMAIN}
LOG_DIR: /logs
env_file:
- path: .env.secrets
required: false
depends_on:
postgres:
condition: service_healthy
read_only: true
volumes:
- logs:/logs
logging: *logging
restart: unless-stopped
# The same image writing the analyses and answers (quick and slow lane);
# OPENROUTER_API_KEY comes from .env.secrets.
worker-ai:
image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-worker:${TAG:-latest}
environment:
DATABASE_URL: postgres://sorsfonalak:${POSTGRES_PASSWORD}@postgres:5432/sorsfonalak
WORKER_TASKS: analyses
QUICK_CONCURRENCY: ${QUICK_CONCURRENCY:-2}
ANALYSIS_CONCURRENCY: ${ANALYSIS_CONCURRENCY:-4}
PUBLIC_BASE_URL: https://${DOMAIN}
LOG_DIR: /logs
LOG_NAME: worker-ai
env_file:
- path: .env.secrets
required: false
depends_on:
postgres:
condition: service_healthy
read_only: true
volumes:
- logs:/logs
logging: *logging
restart: unless-stopped
frontend:
image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-frontend:${TAG:-latest}
environment:
BACKEND_URL: http://backend:8081
HOROSCOPE_API_URL: http://horoscope-api:8080
# Absolute links of the share previews (og:image).
PUBLIC_BASE_URL: https://${DOMAIN}
depends_on:
backend:
condition: service_healthy
read_only: true
tmpfs:
- /app/.next/cache
- /tmp
logging: *logging
restart: unless-stopped
volumes:
pgdata:
# Backend and worker logs (backend.YYYY-MM-DD.log, worker…, worker-ai…).
logs:
caddy-data:
caddy-config: