From 6f2513d8a9586d164547830e5d9f6e622547317b Mon Sep 17 00:00:00 2001 From: rlarltj123 Date: Tue, 23 Jul 2024 02:03:09 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20DEV,=20PROD=20=EC=84=9C=EB=B2=84?= =?UTF-8?q?=EB=A5=BC=20=ED=95=98=EB=82=98=EB=A1=9C=20=ED=95=A9=EC=B9=9C?= =?UTF-8?q?=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .docker/docker-compose-dev.yml | 43 ++++++++++++++++++++++++++ .github/workflows/deploy-dev.yml | 8 ++--- src/main/resources/application-dev.yml | 6 +++- 3 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 .docker/docker-compose-dev.yml diff --git a/.docker/docker-compose-dev.yml b/.docker/docker-compose-dev.yml new file mode 100644 index 0000000..b636d58 --- /dev/null +++ b/.docker/docker-compose-dev.yml @@ -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 + 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 diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 3b03cc6..a076539 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -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 @@ -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/" # 도커 컴포즈 실행 @@ -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 diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 7f72306..fdcbb1e 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -1,3 +1,4 @@ + spring: jpa: database-platform: org.hibernate.dialect.MySQLDialect @@ -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 @@ -64,3 +65,6 @@ jwt: expiry-seconds: access-token: 1800 refresh-token: 1209600 + +server: + port: 8082