forked from yamoyo/yamoyo_BE
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
172 lines (153 loc) · 4.51 KB
/
docker-compose.prod.yml
File metadata and controls
172 lines (153 loc) · 4.51 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
# ========================================
# Yamoyo - 운영 환경 Docker Compose (Final Version 2)
# ========================================
# - Nginx: 프록시 + 프론트 정적 파일 (80/443)
# - Backend: Spring Boot API (expose 8080)
# - Redis: 캐시/세션 (expose 6379, AOF + volume)
# - DB: MySQL (로컬 Docker 컨테이너)
# ========================================
services:
# ========================================
# Nginx (프록시 + 프론트 정적 파일)
# ========================================
nginx:
image: ${DOCKER_USERNAME}/yamoyo-nginx:${IMAGE_TAG:-latest}
container_name: yamoyo-nginx
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- /etc/letsencrypt:/etc/letsencrypt:ro
depends_on:
- backend
networks:
- yamoyo-network
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# ========================================
# Backend (Spring Boot API)
# ========================================
backend:
image: ${DOCKER_USERNAME}/yamoyo-api:${IMAGE_TAG:-latest}
container_name: yamoyo-api
restart: unless-stopped
expose:
- "8080"
environment:
SPRING_PROFILES_ACTIVE: prod
TZ: Asia/Seoul
# Database (Local MySQL)
DB_URL: jdbc:mysql://${DB_HOST}:${DB_PORT}/${DB_NAME}?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Seoul&characterEncoding=UTF-8
DB_USERNAME: ${DB_USERNAME}
DB_PASSWORD: ${DB_PASSWORD}
# Redis (컨테이너)
REDIS_HOST: redis
REDIS_PORT: 6379
# JWT
JWT_SECRET: ${JWT_SECRET}
JWT_ACCESS_EXPIRATION: ${JWT_ACCESS_EXPIRATION:-3600000}
JWT_REFRESH_EXPIRATION: ${JWT_REFRESH_EXPIRATION:-604800000}
# OAuth2 - Kakao
KAKAO_CLIENT_ID: ${KAKAO_CLIENT_ID}
KAKAO_CLIENT_SECRET: ${KAKAO_CLIENT_SECRET}
KAKAO_REDIRECT_URI: ${KAKAO_REDIRECT_URI}
# OAuth2 - Google
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
GOOGLE_REDIRECT_URI: ${GOOGLE_REDIRECT_URI}
# OAuth2 Frontend Redirect
OAUTH2_REDIRECT_URI: ${OAUTH2_REDIRECT_URI}
# Frontend
FRONT_BASE_URL: ${FRONT_BASE_URL}
# LeaderGame
VOLUNTEER_DURATION_SECONDS: ${VOLUNTEER_DURATION_SECONDS:-10}
# OOM 힙덤프 저장
JAVA_TOOL_OPTIONS: >-
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=/app/dumps
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
networks:
- yamoyo-network
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
volumes:
- /opt/yamoyo/secret/firebase-adminsdk.json:/app/config/firebase-adminsdk.json:ro
- /opt/yamoyo/heapdumps:/app/dumps
# ========================================
# Redis (캐시 & 세션)
# ========================================
redis:
image: redis:7-alpine
container_name: yamoyo-redis
restart: unless-stopped
expose:
- "6379"
# AOF 활성화(재시작에도 데이터 유지)
command: ["redis-server", "--appendonly", "yes"]
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
networks:
- yamoyo-network
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# ========================================
# MySQL (운영 로컬 서버)
# ========================================
mysql:
image: mysql:8.0
container_name: yamoyo-mysql
restart: unless-stopped
expose:
- "3306"
environment:
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
MYSQL_DATABASE: ${DB_NAME}
MYSQL_USER: ${DB_USERNAME}
MYSQL_PASSWORD: ${DB_PASSWORD}
TZ: Asia/Seoul
volumes:
- mysql-data:/var/lib/mysql
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --skip-character-set-client-handshake
healthcheck:
test: [ "CMD-SHELL", "MYSQL_PWD=$$MYSQL_ROOT_PASSWORD mysqladmin ping -h localhost" ]
interval: 10s
timeout: 5s
retries: 5
networks:
- yamoyo-network
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
volumes:
mysql-data:
name: yamoyo-mysql-data
redis-data:
name: yamoyo-redis-data
networks:
yamoyo-network:
name: yamoyo-network
driver: bridge