-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
150 lines (143 loc) · 3.95 KB
/
docker-compose.prod.yml
File metadata and controls
150 lines (143 loc) · 3.95 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
version: '3.8'
services:
# PostgreSQL Database
postgres:
image: postgres:16-alpine
container_name: firelater-postgres
restart: always
environment:
POSTGRES_USER: ${POSTGRES_USER:-firelater}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}
POSTGRES_DB: ${POSTGRES_DB:-firelater}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-firelater}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- firelater-network
deploy:
resources:
limits:
memory: 1G
# Redis for caching and queues
redis:
image: redis:7-alpine
container_name: firelater-redis
restart: always
command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD:-}
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- firelater-network
deploy:
resources:
limits:
memory: 512M
# Backend API (from GitHub Container Registry)
backend:
image: ghcr.io/asklokesh/firelater-backend:${VERSION:-latest}
container_name: firelater-backend
restart: always
environment:
NODE_ENV: production
PORT: 3001
HOST: 0.0.0.0
DATABASE_URL: postgres://${POSTGRES_USER:-firelater}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-firelater}
REDIS_URL: redis://:${REDIS_PASSWORD:-}@redis:6379
JWT_SECRET: ${JWT_SECRET:?JWT_SECRET is required}
JWT_REFRESH_SECRET: ${JWT_REFRESH_SECRET:?JWT_REFRESH_SECRET is required}
JWT_ACCESS_EXPIRY: ${JWT_ACCESS_EXPIRY:-15m}
JWT_REFRESH_EXPIRY: ${JWT_REFRESH_EXPIRY:-7d}
SENDGRID_API_KEY: ${SENDGRID_API_KEY:-}
TWILIO_ACCOUNT_SID: ${TWILIO_ACCOUNT_SID:-}
TWILIO_AUTH_TOKEN: ${TWILIO_AUTH_TOKEN:-}
TWILIO_PHONE_NUMBER: ${TWILIO_PHONE_NUMBER:-}
SLACK_WEBHOOK_URL: ${SLACK_WEBHOOK_URL:-}
LOG_LEVEL: ${LOG_LEVEL:-info}
ENCRYPTION_KEY: ${ENCRYPTION_KEY:-}
ports:
- "${BACKEND_PORT:-3001}:3001"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3001/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- firelater-network
deploy:
resources:
limits:
memory: 1G
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
# Frontend (from GitHub Container Registry)
frontend:
image: ghcr.io/asklokesh/firelater-frontend:${VERSION:-latest}
container_name: firelater-frontend
restart: always
environment:
NODE_ENV: production
NEXT_PUBLIC_API_URL: ${API_URL:-http://localhost:3001}
ports:
- "${FRONTEND_PORT:-3000}:3000"
depends_on:
backend:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- firelater-network
deploy:
resources:
limits:
memory: 512M
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
# Nginx Reverse Proxy (optional, for SSL termination)
nginx:
image: nginx:alpine
container_name: firelater-nginx
restart: always
ports:
- "${HTTP_PORT:-80}:80"
- "${HTTPS_PORT:-443}:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/certs:/etc/nginx/certs:ro
depends_on:
- frontend
- backend
networks:
- firelater-network
profiles:
- with-nginx
volumes:
postgres_data:
driver: local
redis_data:
driver: local
networks:
firelater-network:
driver: bridge