Repository navigation
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
92 lines (86 loc) · 2.67 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
92 lines (86 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Deployment stack: caddy (reverse proxy + auto TLS) is the only service
# reachable from the host. Everything else — app, web, postgres, minio —
# talks over the internal compose network only.
#
# cp .env.prod.example .env
# # fill in real values in .env
# docker compose -f docker-compose.prod.yml up -d --build
services:
caddy:
image: caddy:2-alpine
ports:
- "80:80"
- "443:443"
environment:
DOMAIN: ${DOMAIN:-localhost}
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy_data:/data
- caddy_config:/config
depends_on:
- web
- app
restart: unless-stopped
web:
build: ./web
restart: unless-stopped
app:
build: ./server
environment:
PORT: 4000
NODE_ENV: production
API_TOKEN: ${API_TOKEN:?set API_TOKEN in .env}
DATABASE_URL: postgres://cairn:${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}@postgres:5432/cairn
STORAGE_DRIVER: s3
S3_BUCKET: cairn-thumbnails
S3_REGION: us-east-1
S3_ENDPOINT: http://minio:9000
S3_ACCESS_KEY_ID: ${MINIO_ROOT_USER:-minioadmin}
S3_SECRET_ACCESS_KEY: ${MINIO_ROOT_PASSWORD:?set MINIO_ROOT_PASSWORD in .env}
S3_FORCE_PATH_STYLE: "true"
S3_PUBLIC_URL: ""
depends_on:
postgres:
condition: service_healthy
minio:
condition: service_healthy
restart: unless-stopped
postgres:
image: postgres:16-alpine
environment:
POSTGRES_DB: cairn
POSTGRES_USER: cairn
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U cairn -d cairn"]
interval: 5s
timeout: 5s
retries: 10
restart: unless-stopped
# No host port published on purpose. For a one-off psql/backup session:
# docker compose -f docker-compose.prod.yml exec postgres psql -U cairn
minio:
image: minio/minio:latest
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:?set MINIO_ROOT_PASSWORD in .env}
volumes:
- miniodata:/data
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 5s
timeout: 5s
retries: 10
restart: unless-stopped
# Neither the S3 API nor the admin console is published — `app` reaches
# MinIO over the internal network and proxies thumbnails itself (see
# server/README.md if you'd rather serve them directly from a public
# S3-compatible endpoint via S3_PUBLIC_URL).
volumes:
pgdata:
miniodata:
caddy_data:
caddy_config: