soroban-abacus-flashcards/apps/web/litefs.yml

48 lines
1.2 KiB
YAML

# LiteFS configuration for distributed SQLite
# See: https://fly.io/docs/litefs/config/
# FUSE mount point - where the app accesses the database
fuse:
dir: "/litefs"
# Internal data directory - stores LiteFS transaction files
data:
dir: "/var/lib/litefs"
# Lease configuration for primary election
# Pod-0 in the StatefulSet is always the primary (candidate: true)
# Other pods are replicas (candidate: false)
# The LITEFS_CANDIDATE env var is set based on pod ordinal
lease:
type: "static"
hostname: "${HOSTNAME}"
advertise-url: "http://${HOSTNAME}.abaci-app-headless.abaci.svc.cluster.local:20202"
candidate: ${LITEFS_CANDIDATE}
# HTTP proxy to forward writes from replicas to primary
# LiteFS automatically forwards writes to primary via lease advertise-url
proxy:
addr: ":8080"
target: "localhost:3000"
db: "sqlite.db"
passthrough:
- "*.ico"
- "*.png"
- "*.jpg"
- "*.jpeg"
- "*.gif"
- "*.svg"
- "*.css"
- "*.js"
- "*.woff"
- "*.woff2"
# Run the application after LiteFS mounts
exec:
# Run migrations only on the primary (candidate)
- cmd: "node dist/db/migrate.js"
if-candidate: true
# Start the app (runs on all nodes)
- cmd: "node server.js"