forked from Nova-reward/Nova-Rewards
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
148 lines (141 loc) · 3.82 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
148 lines (141 loc) · 3.82 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
# docker-compose.prod.yml — Production environment
# Usage: docker compose -f docker-compose.prod.yml up -d
# Requires: novaRewards/.env.prod
services:
postgres:
image: postgres:16-alpine
restart: unless-stopped
env_file: .env.prod
environment:
POSTGRES_DB: ${POSTGRES_DB:-nova_rewards}
POSTGRES_USER: ${POSTGRES_USER:-nova}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}
volumes:
- postgres_data:/var/lib/postgresql/data
# No ports: internal only — not exposed on host
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-nova} -d ${POSTGRES_DB:-nova_rewards}"]
interval: 10s
timeout: 5s
retries: 10
deploy:
resources:
limits:
cpus: "2.0"
memory: 4G
migrate:
image: node:20-alpine
working_dir: /app
command: node database/migrate.js
env_file: .env.prod
environment:
DATABASE_URL: ${DATABASE_URL:?DATABASE_URL is required}
NODE_ENV: production
volumes:
- .:/app:ro
depends_on:
postgres:
condition: service_healthy
restart: on-failure
redis:
image: redis:7-alpine
restart: unless-stopped
command: >
redis-server
--appendonly yes
--appendfsync everysec
--maxmemory 512mb
--maxmemory-policy allkeys-lru
--requirepass ${REDIS_PASSWORD:?REDIS_PASSWORD is required}
volumes:
- redis_data:/data
# No ports: internal only — not exposed on host
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
interval: 10s
timeout: 3s
retries: 5
deploy:
resources:
limits:
cpus: "0.5"
memory: 640M
backend:
image: ghcr.io/${REGISTRY_OWNER}/nova-rewards-backend:${IMAGE_TAG:-latest}
restart: unless-stopped
env_file: .env.prod
environment:
PORT: 3001
NODE_ENV: production
DATABASE_URL: ${DATABASE_URL:?DATABASE_URL is required}
REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379
ALLOWED_ORIGIN: ${ALLOWED_ORIGIN:?ALLOWED_ORIGIN is required}
# No ports: traffic enters via gateway only
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
migrate:
condition: service_completed_successfully
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:3001/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 20s
deploy:
replicas: 2
resources:
limits:
cpus: "1.0"
memory: 1G
frontend:
image: ghcr.io/${REGISTRY_OWNER}/nova-rewards-frontend:${IMAGE_TAG:-latest}
restart: unless-stopped
env_file: .env.prod
environment:
NODE_ENV: production
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:?NEXT_PUBLIC_API_URL is required}
# No ports: traffic enters via gateway only
depends_on:
backend:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:3000/api/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
deploy:
replicas: 2
resources:
limits:
cpus: "1.0"
memory: 1G
gateway:
image: nginx:1.25-alpine
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ../deployment/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
backend:
condition: service_healthy
frontend:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost/health || exit 1"]
interval: 10s
timeout: 5s
retries: 3
deploy:
resources:
limits:
cpus: "0.5"
memory: 128M
volumes:
postgres_data:
redis_data: