-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
199 lines (192 loc) · 6.04 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
199 lines (192 loc) · 6.04 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
services:
# Traefik - Reverse Proxy with automatic HTTPS via Let's Encrypt
traefik:
image: traefik:v3.6.4
container_name: nebi-traefik
command:
# API and dashboard (disable in production)
- --api.insecure=false
# Docker provider
- --providers.docker=true
- --providers.docker.exposedbydefault=false
# Entrypoints
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
# HTTP to HTTPS redirect
- --entrypoints.web.http.redirections.entryPoint.to=websecure
- --entrypoints.web.http.redirections.entryPoint.scheme=https
- --entrypoints.web.http.redirections.entrypoint.permanent=true
# Let's Encrypt configuration
- --certificatesresolvers.letsencrypt.acme.tlschallenge=true
- --certificatesresolvers.letsencrypt.acme.email=${ACME_EMAIL}
- --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json
- --certificatesresolvers.letsencrypt.acme.caserver=https://acme-v02.api.letsencrypt.org/directory
# Logging
- --log.level=DEBUG
- --accesslog=true
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- letsencrypt-data:/letsencrypt
networks:
- nebi-network
restart: unless-stopped
# PostgreSQL 18 - Database
postgres:
image: postgres:18
container_name: nebi-postgres
environment:
POSTGRES_DB: ${POSTGRES_DB:-nebi}
POSTGRES_USER: ${POSTGRES_USER:-nebi}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- nebi-network
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-nebi}"]
interval: 10s
timeout: 5s
retries: 5
# Valkey 9.0 - Queue backend (Redis replacement)
valkey:
image: valkey/valkey:9.0.0
container_name: nebi-valkey
volumes:
- valkey_data:/data
networks:
- nebi-network
restart: unless-stopped
healthcheck:
test: ["CMD", "valkey-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# Nebi API + Worker (both mode)
# NOTE: Before first deployment, set permissions:
# mkdir -p ./data/environments
# chown -R 65532:65532 ./data/environments
nebi-api:
image: ${NEBI_IMAGE:-quay.io/nebari/nebi:latest}
container_name: nebi-api
command: ["/app/nebi", "--mode=both"]
env_file:
- .env.prod
environment:
# Database configuration
NEBI_DATABASE_DRIVER: postgres
NEBI_DATABASE_DSN: postgres://${POSTGRES_USER:-nebi}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-nebi}?sslmode=disable
NEBI_DATABASE_MAX_IDLE_CONNS: 10
NEBI_DATABASE_MAX_OPEN_CONNS: 100
NEBI_DATABASE_CONN_MAX_LIFETIME: 60
# Queue configuration
NEBI_QUEUE_TYPE: valkey
NEBI_QUEUE_VALKEY_ADDR: valkey:6379
# Server configuration
NEBI_SERVER_PORT: 8460
NEBI_SERVER_MODE: production
# Logging
NEBI_LOG_LEVEL: info
NEBI_LOG_FORMAT: json
labels:
- "traefik.enable=true"
- "traefik.http.routers.nebi.rule=Host(`${NEBI_DOMAIN}`)"
- "traefik.http.routers.nebi.entrypoints=websecure"
- "traefik.http.routers.nebi.tls=true"
- "traefik.http.routers.nebi.tls.certresolver=letsencrypt"
- "traefik.http.services.nebi.loadbalancer.server.port=8460"
expose:
- "8460"
volumes:
- ./data/environments:/app/data/environments
networks:
- nebi-network
depends_on:
postgres:
condition: service_healthy
valkey:
condition: service_healthy
traefik:
condition: service_started
restart: unless-stopped
# Health check removed - distroless image has no wget/curl
# Traefik monitors service health directly
# Nebi Worker 1 - Additional worker for job processing
nebi-worker-1:
image: ${NEBI_IMAGE:-quay.io/nebari/nebi:latest}
container_name: nebi-worker-1
command: ["/app/nebi", "--mode=worker"]
env_file:
- .env.prod
environment:
# Database configuration
NEBI_DATABASE_DRIVER: postgres
NEBI_DATABASE_DSN: postgres://${POSTGRES_USER:-nebi}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-nebi}?sslmode=disable
NEBI_DATABASE_MAX_IDLE_CONNS: 10
NEBI_DATABASE_MAX_OPEN_CONNS: 100
NEBI_DATABASE_CONN_MAX_LIFETIME: 60
# Queue configuration
NEBI_QUEUE_TYPE: valkey
NEBI_QUEUE_VALKEY_ADDR: valkey:6379
# Logging
NEBI_LOG_LEVEL: info
NEBI_LOG_FORMAT: json
volumes:
- ./data/environments:/app/data/environments
networks:
- nebi-network
depends_on:
postgres:
condition: service_healthy
valkey:
condition: service_healthy
nebi-api:
condition: service_started
restart: unless-stopped
# Nebi Worker 2 - Additional worker for job processing
nebi-worker-2:
image: ${NEBI_IMAGE:-quay.io/nebari/nebi:latest}
container_name: nebi-worker-2
command: ["/app/nebi", "--mode=worker"]
env_file:
- .env.prod
environment:
# Database configuration
NEBI_DATABASE_DRIVER: postgres
NEBI_DATABASE_DSN: postgres://${POSTGRES_USER:-nebi}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-nebi}?sslmode=disable
NEBI_DATABASE_MAX_IDLE_CONNS: 10
NEBI_DATABASE_MAX_OPEN_CONNS: 100
NEBI_DATABASE_CONN_MAX_LIFETIME: 60
# Queue configuration
NEBI_QUEUE_TYPE: valkey
NEBI_QUEUE_VALKEY_ADDR: valkey:6379
# Logging
NEBI_LOG_LEVEL: info
NEBI_LOG_FORMAT: json
volumes:
- ./data/environments:/app/data/environments
networks:
- nebi-network
depends_on:
postgres:
condition: service_healthy
valkey:
condition: service_healthy
nebi-api:
condition: service_started
restart: unless-stopped
volumes:
letsencrypt-data:
driver: local
postgres_data:
driver: local
valkey_data:
driver: local
networks:
nebi-network:
name: nebi-network
driver: bridge