-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdocker-compose.production.yml
More file actions
112 lines (105 loc) · 2.8 KB
/
docker-compose.production.yml
File metadata and controls
112 lines (105 loc) · 2.8 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
# NaaP Platform - Production Docker Compose
#
# For off-Vercel backend services. The Next.js shell runs on Vercel.
# Backend services, databases, and plugin backends run here.
#
# Usage:
# docker compose -f docker-compose.production.yml up -d
#
# Prerequisites:
# - Set environment variables in .env.production
# - Build service images first: docker compose -f docker-compose.production.yml build
version: '3.8'
services:
# ─── Core Database ───
database:
image: postgres:16-alpine
container_name: naap-db-prod
restart: unless-stopped
environment:
POSTGRES_USER: ${DB_USER:-naap}
POSTGRES_PASSWORD: ${DB_PASSWORD:?Set DB_PASSWORD in .env.production}
POSTGRES_DB: ${DB_NAME:-naap}
volumes:
- db-data:/var/lib/postgresql/data
- ./docker/init-schemas.sql:/docker-entrypoint-initdb.d/01-init-schemas.sql
ports:
- "${DB_PORT:-5432}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-naap}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- naap-prod
# ─── Redis ───
redis:
image: redis:7-alpine
container_name: naap-redis-prod
restart: unless-stopped
command: redis-server --requirepass ${REDIS_PASSWORD:?Set REDIS_PASSWORD}
volumes:
- redis-data:/data
ports:
- "${REDIS_PORT:-6379}:6379"
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- naap-prod
# ─── Core Services ───
base-svc:
build:
context: .
dockerfile: services/base-svc/Dockerfile
container_name: naap-base-svc
restart: unless-stopped
depends_on:
database:
condition: service_healthy
redis:
condition: service_healthy
environment:
PORT: 4000
DATABASE_URL: postgresql://${DB_USER:-naap}:${DB_PASSWORD}@database:5432/${DB_NAME:-naap}
REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379
NODE_ENV: production
LOG_LEVEL: ${LOG_LEVEL:-info}
ports:
- "4000:4000"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:4000/healthz"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
networks:
- naap-prod
plugin-server:
build:
context: .
dockerfile: services/plugin-server/Dockerfile
container_name: naap-plugin-server
restart: unless-stopped
environment:
PORT: 3100
NODE_ENV: production
ports:
- "3100:3100"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3100/healthz"]
interval: 30s
timeout: 10s
retries: 3
networks:
- naap-prod
volumes:
db-data:
driver: local
redis-data:
driver: local
networks:
naap-prod:
driver: bridge