update
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
# Production, on one server:
|
||||
# cp .env.example .env # then fill it in
|
||||
# docker compose up -d --build
|
||||
# Development uses docker-compose.local.yml instead. See README.md.
|
||||
name: electro4ort
|
||||
|
||||
x-api: &api
|
||||
build:
|
||||
context: .
|
||||
target: api
|
||||
image: electro4ort-api
|
||||
restart: unless-stopped
|
||||
environment: &api-environment
|
||||
DATABASE_URL: postgres://electro4ort:${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}@postgres:5432/electro4ort
|
||||
REDIS_URL: redis://redis:6379
|
||||
BETTER_AUTH_SECRET: ${BETTER_AUTH_SECRET:?set BETTER_AUTH_SECRET in .env}
|
||||
BETTER_AUTH_URL: https://api.${DOMAIN:?set DOMAIN in .env}
|
||||
TRUSTED_ORIGINS: https://${DOMAIN}
|
||||
# Caddy is the one proxy in front.
|
||||
TRUST_PROXY: 1
|
||||
STORAGE_DRIVER: ${STORAGE_DRIVER:-local}
|
||||
S3_BUCKET: ${S3_BUCKET:-}
|
||||
S3_REGION: ${S3_REGION:-}
|
||||
S3_ENDPOINT: ${S3_ENDPOINT:-}
|
||||
S3_FORCE_PATH_STYLE: ${S3_FORCE_PATH_STYLE:-}
|
||||
S3_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID:-}
|
||||
S3_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY:-}
|
||||
# Browsers come in through Caddy; the API asks over the private network.
|
||||
LIVEKIT_URL: wss://livekit.${DOMAIN}
|
||||
LIVEKIT_INTERNAL_URL: http://livekit:7880
|
||||
LIVEKIT_API_KEY: ${LIVEKIT_API_KEY:?set LIVEKIT_API_KEY in .env}
|
||||
LIVEKIT_API_SECRET: ${LIVEKIT_API_SECRET:?set LIVEKIT_API_SECRET in .env}
|
||||
|
||||
services:
|
||||
caddy:
|
||||
image: caddy:2-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
DOMAIN: ${DOMAIN}
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
- "443:443/udp"
|
||||
volumes:
|
||||
- ./deploy/Caddyfile:/etc/caddy/Caddyfile:ro
|
||||
# The certificates. Losing them means asking for new ones, which is
|
||||
# limited to a few a week.
|
||||
- caddy-data:/data
|
||||
- caddy-config:/config
|
||||
depends_on:
|
||||
- web
|
||||
- api
|
||||
|
||||
web:
|
||||
build:
|
||||
context: .
|
||||
target: web
|
||||
args:
|
||||
VITE_API_URL: https://api.${DOMAIN}
|
||||
image: electro4ort-web
|
||||
restart: unless-stopped
|
||||
|
||||
# Brings the database up to this version, then exits. The API waits for it.
|
||||
migrate:
|
||||
<<: *api
|
||||
restart: "no"
|
||||
command: ["node", "dist/db/migrate.js"]
|
||||
healthcheck:
|
||||
disable: true
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
|
||||
api:
|
||||
<<: *api
|
||||
volumes:
|
||||
# Uploaded files, while STORAGE_DRIVER is "local".
|
||||
- files:/data/files
|
||||
depends_on:
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
redis:
|
||||
condition: service_healthy
|
||||
|
||||
postgres:
|
||||
image: postgres:19-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: electro4ort
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
POSTGRES_DB: electro4ort
|
||||
volumes:
|
||||
- postgres-data:/var/lib/postgresql
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", 'pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"']
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
|
||||
# Socket events between API instances, who is in which call, rate limits.
|
||||
redis:
|
||||
image: redis:8-alpine
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
|
||||
# Voice and video. Signalling comes through Caddy; the media goes straight
|
||||
# between browsers and these two ports, which the firewall must let in.
|
||||
livekit:
|
||||
image: livekit/livekit-server:v1.13
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
LIVEKIT_CONFIG: |
|
||||
port: 7880
|
||||
rtc:
|
||||
tcp_port: 7881
|
||||
udp_port: 7882
|
||||
use_external_ip: true
|
||||
keys:
|
||||
${LIVEKIT_API_KEY}: ${LIVEKIT_API_SECRET}
|
||||
webhook:
|
||||
api_key: ${LIVEKIT_API_KEY}
|
||||
urls:
|
||||
- http://api:3000/livekit/webhook
|
||||
ports:
|
||||
- "7881:7881"
|
||||
- "7882:7882/udp"
|
||||
|
||||
volumes:
|
||||
caddy-data:
|
||||
caddy-config:
|
||||
postgres-data:
|
||||
redis-data:
|
||||
files:
|
||||
Reference in New Issue
Block a user