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 a9af07e
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 13 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: dev
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
8 changes: 6 additions & 2 deletions 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,9 +30,9 @@ 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}
password: ${DB_ROOT_PASSWORD_DEV}
driver-class-name: com.mysql.cj.jdbc.Driver
maximum-pool-size: 5
connection-timeout: 3000
Expand Down Expand Up @@ -64,3 +65,6 @@ jwt:
expiry-seconds:
access-token: 1800
refresh-token: 1209600

server:
port: 8082
16 changes: 9 additions & 7 deletions src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
<include resource="appender/moneymong-console-appender.xml"/>
<include resource="appender/moneymong-file-appender.xml"/>
<include resource="appender/moneymong-error-file-appender.xml"/>

<logger name="org.springframework" level="INFO" additivity="false">
<appender-ref ref="FILE_APPENDER"/>
</logger>

<root level="WARN">
<appender-ref ref="ERROR_FILE_APPENDER"/>
<root level="INFO">
<appender-ref ref="CONSOLE_APPENDER"/>
</root>
<!-- <logger name="org.springframework" level="INFO" additivity="false">-->
<!-- <appender-ref ref="FILE_APPENDER"/>-->
<!-- </logger>-->

<!-- <root level="WARN">-->
<!-- <appender-ref ref="ERROR_FILE_APPENDER"/>-->
<!-- </root>-->
</springProfile>
</configuration>

0 comments on commit a9af07e

Please sign in to comment.