Skip to content

Commit

Permalink
feat: DEV, PROD 서버를 하나로 합친다.
Browse files Browse the repository at this point in the history
  • Loading branch information
rlarltj committed Jul 22, 2024
1 parent bc8f512 commit 1b5d3f0
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 5 deletions.
43 changes: 43 additions & 0 deletions .docker/docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: '3'
services:
db:
container_name: moneymong-db-dev
image: mysql
environment:
MYSQL_DATABASE: moneymong
MYSQL_USERNAME: root
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD_DEV}
TZ: Asia/Seoul
ports:
- "3308:3308"
volumes:
- ./mysqldata:/var/lib/mysql-dev
restart: always

server:
container_name: server-dev
image: ${DOCKER_IMAGE_NAME}
ports:
- "8082:8082"
environment:
JWT_SECRET_KEY: ${JWT_SECRET_KEY}
NCP_ACCESS_KEY: ${NCP_ACCESS_KEY}
NCP_SECRET_KEY: ${NCP_SECRET_KEY}
ACTIVE_PROFILE: ${ACTIVE_PROFILE}
DB_ROOT_PASSWORD: ${DB_ROOT_PASSWORD_DEV}
REDIS_HOST: ${REDIS_HOST_DEV}
REDIS_PORT: 6381
APPLE_PRIVATE_KEY: ${APPLE_PRIVATE_KEY}
APPLE_TEAM_ID: ${APPLE_TEAM_ID}
APPLE_KEY_ID: ${APPLE_KEY_ID}
APPLE_CLIENT_ID: ${APPLE_CLIENT_ID}
KAKAO_ADMIN_KEY: ${KAKAO_ADMIN_KEY}
INVITATION_CODE_KEY: ${INVITATION_CODE_KEY}

redis:
container_name: moneymong-redis-dev
image: redis
ports:
- "6381:6381"
volumes:
- ./data/redis:/data
8 changes: 4 additions & 4 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

# 환경 변수 설정
- name: Set up Environment
run: echo "${{ secrets.ENV_PROPERTIES_DEV }}" > ./.env
run: echo "${{ secrets.ENV_PROPERTIES_PROD }}" > ./.env

# 환경 변수 파일 서버로 전달
- name: Send env file
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
host: ${{ secrets.NCP_DEV_IP }}
password: ${{ secrets.NCP_PASSWORD }}
port: 22
source: "./.docker/docker-compose.yml"
source: "./.docker/docker-compose-dev.yml"
target: "/home/ubuntu/"

# 도커 컴포즈 실행
Expand All @@ -66,8 +66,8 @@ jobs:
host: ${{ secrets.NCP_DEV_IP }}
password: ${{ secrets.NCP_PASSWORD }}
script: |
sudo cp /home/ubuntu/.docker/docker-compose.yml /home/ubuntu
sudo cp /home/ubuntu/.docker/docker-compose-dev.yml /home/ubuntu
cd /home/ubuntu
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}
docker-compose up -d
docker-compose -f docker-compose-dev.yml up -d
docker image prune -f
6 changes: 5 additions & 1 deletion src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

spring:
jpa:
database-platform: org.hibernate.dialect.MySQLDialect
Expand Down Expand Up @@ -29,7 +30,7 @@ spring:
datasource:
db:
pool-name: moneymong
jdbc-url: jdbc:mysql://moneymong-db:3306/moneymong?useSSL=false&&allowPublicKeyRetrieval=true
jdbc-url: jdbc:mysql://moneymong-db-dev:3308/moneymong?useSSL=false&&allowPublicKeyRetrieval=true
username: root
password: ${DB_ROOT_PASSWORD}
driver-class-name: com.mysql.cj.jdbc.Driver
Expand Down Expand Up @@ -64,3 +65,6 @@ jwt:
expiry-seconds:
access-token: 1800
refresh-token: 1209600

server:
port: 8082

0 comments on commit 1b5d3f0

Please sign in to comment.