storytellurx/deploy/compose.yaml

55 lines
1.7 KiB
YAML

# StoryTellurX on the HEAD VPS, deployed by doco-cd (head-vps) on every push to main.
# The database is the SQLite object in RustFS on this host (kysely-sqlite-blob), so the container holds no state.
x-app: &app
image: storytellurx:main
pull_policy: never
secrets:
- age_key
environment:
# Not secret. The production database is the timeline of the main branch; a test host sets
# STX_DATABASE (.doco-cd.yml) to use its own database object instead (preview context).
DENO_TIMELINE: git-branch/main
APP_DATABASE: ${STX_DATABASE:-}
S3_BUCKET_REGION: us-east-1
S3_DEFAULT_BUCKET: storytellurx-landing
S3_ENDPOINT_URL: https://s3.fuckingtech.ch
S3_PUBLIC_URL: https://assets.fuckingtech.ch/storytellurx-landing/
services:
# The migration the Deno Deploy and MF predeploy ran: once per deployment, before the server.
migrate:
<<: *app
command: ["./server", "db", "apply"]
restart: on-failure
web:
<<: *app
build:
context: ..
dockerfile: deploy/Dockerfile
secrets:
- age_key
restart: unless-stopped
depends_on:
migrate:
condition: service_completed_successfully
networks:
- caddy
labels:
caddy: ${STX_DOMAIN}
caddy.reverse_proxy: "{{upstreams 8000}}"
healthcheck:
test: ["CMD", "deno", "eval", "const r = await fetch('http://127.0.0.1:8000/'); if (r.status >= 500) Deno.exit(1)"]
interval: 30s
timeout: 10s
start_period: 30s
retries: 3
secrets:
age_key:
# Created by head-vps/bootstrap.sh; its public half is a recipient in ../fnox.toml.
file: /etc/head-vps/age.key
networks:
caddy:
external: true