Skip to content

Commit 2205d61

Browse files
authored
fix: Update MySQL datasource configuration and add MySQL service to Docker Compose (#79)
2 parents 67fd27f + b4ef40b commit 2205d61

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

backend/main-service/src/main/resources/yaml/application-prod.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ spring:
1010
on-profile: prod
1111
datasource:
1212
driver-class-name: com.mysql.cj.jdbc.Driver
13-
url: jdbc:mysql://localhost:3306/devlog?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&serverTimezone=Asia/Seoul
13+
url: jdbc:mysql://mysql:3306/devlog?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&serverTimezone=Asia/Seoul
1414
# url: jdbc:mysql://database:3306/devlog?serverTimezone=Asia/Seoul
1515
# driver-class-name: oracle.jdbc.OracleDriver
1616
# url: jdbc:oracle:thin:@testdb_high?TNS_ADMIN=/home/app/backend/wallet
1717
username: ${ORACLE_USERNAME}
1818
password: ${ORACLE_PASSWORD}
1919
jpa:
2020
hibernate:
21-
ddl-auto: validate # DDL (create/update/create-drop/validate/none)
21+
ddl-auto: create # DDL (create/update/create-drop/validate/none)
2222
data:
2323
redis:
2424
host: redis

docker-compose.prod.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: "3.9"
2-
31
networks:
42
ms-network:
53
driver: bridge
@@ -49,6 +47,8 @@ services:
4947
depends_on:
5048
redis:
5149
condition: service_healthy
50+
mysql:
51+
condition: service_healthy
5252
discovery-service:
5353
condition: service_healthy
5454
gateway-service:
@@ -137,3 +137,23 @@ services:
137137
networks:
138138
- ms-network
139139
restart: on-failure
140+
141+
mysql:
142+
image: mysql:8.0
143+
environment:
144+
MYSQL_ROOT_PASSWORD: ${ORACLE_PASSWORD}
145+
MYSQL_DATABASE: devlog
146+
MYSQL_USERNAME: ${ORACLE_USERNAME}
147+
MYSQL_PASSWORD: ${ORACLE_PASSWORD}
148+
ports:
149+
- "3306:3306"
150+
volumes:
151+
- /home/app/mysql-data:/var/lib/mysql
152+
healthcheck:
153+
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
154+
interval: 10s
155+
timeout: 5s
156+
retries: 5
157+
restart: unless-stopped
158+
networks:
159+
- ms-network

0 commit comments

Comments
 (0)