-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
161 lines (157 loc) · 5 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
161 lines (157 loc) · 5 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
# Production Docker Compose override
# Usage: docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
#
# This file references pre-built images from GHCR instead of building locally.
# Required environment variables (set in deployment environment):
# DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_NAME
# REDIS_HOST, REDIS_PORT, REDIS_PASSWORD
# JWT_SECRET
# NACOS_USERNAME, NACOS_PASSWORD, NACOS_AUTH_TOKEN,
# NACOS_AUTH_IDENTITY_KEY, NACOS_AUTH_IDENTITY_VALUE
# GHCR_REGISTRY (optional, defaults to ghcr.io/davidhlp/ulticode-public-next)
#
# IMAGE_TAG usage:
# export IMAGE_TAG=sha-abc1234 (or 'latest')
# docker compose -f docker-compose.yml -f docker-compose.prod.yml pull
# docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
#
# The cd-deploy.yml workflow sets IMAGE_TAG via:
# env.IMAGE_TAG = github.event.inputs.image_tag || 'latest'
services:
nacos:
image: nacos/nacos-server:v2.3.2
container_name: ulticode-nacos
restart: unless-stopped
deploy:
resources:
limits:
memory: 768M
cpus: "1.0"
environment:
MODE: standalone
SPRING_DATASOURCE_PLATFORM: mysql
MYSQL_SERVICE_HOST: ${DB_HOST:-mysql}
MYSQL_SERVICE_PORT: ${DB_PORT:-3306}
MYSQL_SERVICE_DB_NAME: nacos_config
MYSQL_SERVICE_USER: root
MYSQL_SERVICE_PASSWORD: ${DB_ROOT_PASSWORD:?DB_ROOT_PASSWORD is required}
MYSQL_SERVICE_DB_PARAM: "characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=true&allowPublicKeyRetrieval=true"
JVM_XMS: 256m
JVM_XMX: 512m
NACOS_AUTH_ENABLE: "true"
NACOS_AUTH_TOKEN: ${NACOS_AUTH_TOKEN:?NACOS_AUTH_TOKEN is required}
NACOS_AUTH_IDENTITY_KEY: ${NACOS_AUTH_IDENTITY_KEY:?NACOS_AUTH_IDENTITY_KEY is required}
NACOS_AUTH_IDENTITY_VALUE: ${NACOS_AUTH_IDENTITY_VALUE:?NACOS_AUTH_IDENTITY_VALUE is required}
depends_on:
mysql:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8848/nacos/"]
interval: 10s
timeout: 5s
retries: 10
logging:
driver: json-file
options:
max-size: "50m"
max-file: "5"
backend:
image: ${GHCR_REGISTRY:-ghcr.io/davidhlp/ulticode-public-next}/backend:${IMAGE_TAG:-latest}
container_name: ulticode-backend
restart: unless-stopped
expose:
- "9001"
deploy:
resources:
limits:
memory: 1G
cpus: "2.0"
environment:
- DB_HOST=${DB_HOST:-mysql}
- DB_PORT=${DB_PORT:-3306}
- DB_USER=${DB_USER:-ulticode}
- DB_PASSWORD=${DB_PASSWORD:?DB_PASSWORD is required}
- DB_NAME=${DB_NAME:-ulticode}
- REDIS_HOST=${REDIS_HOST:-redis}
- REDIS_PORT=${REDIS_PORT:-6379}
- REDIS_PASSWORD=${REDIS_PASSWORD:?REDIS_PASSWORD is required}
- JWT_SECRET=${JWT_SECRET:?JWT_SECRET is required}
- NACOS_HOST=nacos
- NACOS_PORT=8848
- NACOS_USERNAME=${NACOS_USERNAME:?NACOS_USERNAME is required}
- NACOS_PASSWORD=${NACOS_PASSWORD:?NACOS_PASSWORD is required}
- SERVER_PORT=9001
- CORS_ALLOWED_ORIGINS=${CORS_ALLOWED_ORIGINS:-http://localhost:9002,http://localhost:9003}
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
nacos:
condition: service_healthy
networks:
- default
- infrastructure
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9001/contest?page=1&size=1"]
interval: 30s
timeout: 10s
start_period: 30s
retries: 3
logging:
driver: json-file
options:
max-size: "50m"
max-file: "5"
console:
image: ${GHCR_REGISTRY:-ghcr.io/davidhlp/ulticode-public-next}/console:${IMAGE_TAG:-latest}
container_name: ulticode-console
restart: unless-stopped
ports:
- "127.0.0.1:${CONSOLE_PORT:-9002}:8080"
environment:
- API_ORIGIN=
depends_on:
backend:
condition: service_healthy
deploy:
resources:
limits:
memory: 256M
cpus: "0.5"
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/"]
interval: 30s
timeout: 10s
retries: 3
logging:
driver: json-file
options:
max-size: "20m"
max-file: "3"
management:
image: ${GHCR_REGISTRY:-ghcr.io/davidhlp/ulticode-public-next}/management:${IMAGE_TAG:-latest}
container_name: ulticode-management
restart: unless-stopped
ports:
- "127.0.0.1:${MANAGEMENT_PORT:-9003}:8080"
environment:
- API_ORIGIN=
depends_on:
backend:
condition: service_healthy
deploy:
resources:
limits:
memory: 256M
cpus: "0.5"
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/"]
interval: 30s
timeout: 10s
retries: 3
logging:
driver: json-file
options:
max-size: "20m"
max-file: "3"