133 lines
3.6 KiB
YAML
133 lines
3.6 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}
|
||
|
|
depends_on:
|
||
|
|
postgres:
|
||
|
|
condition: service_healthy
|
||
|
|
horoscope-api:
|
||
|
|
condition: service_healthy
|
||
|
|
read_only: true
|
||
|
|
logging: *logging
|
||
|
|
restart: unless-stopped
|
||
|
|
|
||
|
|
worker:
|
||
|
|
image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-worker:${TAG:-latest}
|
||
|
|
environment:
|
||
|
|
DATABASE_URL: postgres://sorsfonalak:${POSTGRES_PASSWORD}@postgres:5432/sorsfonalak
|
||
|
|
SMTP_URL: ${SMTP_URL:-}
|
||
|
|
MAIL_FROM: ${MAIL_FROM:-}
|
||
|
|
PUBLIC_BASE_URL: https://${DOMAIN}
|
||
|
|
env_file:
|
||
|
|
- path: .env.secrets
|
||
|
|
required: false
|
||
|
|
depends_on:
|
||
|
|
postgres:
|
||
|
|
condition: service_healthy
|
||
|
|
read_only: true
|
||
|
|
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
|
||
|
|
depends_on:
|
||
|
|
backend:
|
||
|
|
condition: service_healthy
|
||
|
|
read_only: true
|
||
|
|
tmpfs:
|
||
|
|
- /app/.next/cache
|
||
|
|
- /tmp
|
||
|
|
logging: *logging
|
||
|
|
restart: unless-stopped
|
||
|
|
|
||
|
|
volumes:
|
||
|
|
pgdata:
|
||
|
|
caddy-data:
|
||
|
|
caddy-config:
|