Skip to content

Commit

Permalink
[Deploy]: dev 서버 배포
Browse files Browse the repository at this point in the history
  • Loading branch information
bayy1216 committed Sep 24, 2024
1 parent 5333f92 commit 7af5965
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,15 @@ jobs:
key: ${{ secrets.KEY }}
port: 22
script: |
docker rm -f $(docker ps -qa --filter "name=zzansuni-spring") # 기존 zzansuni-spring 서버만 잡아서 중지합니다.
docker rm -f $(docker ps -qa --filter "name=zzansuni-spring-prod")
docker rm -f $(docker ps -qa --filter "name=zzansuni-spring-dev")
# 기존에 사용되던 spring 이미지만 제거합니다.
docker rmi $(docker images -q --filter "reference=${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}")
docker image prune -f # 사용하지 않는 도커 이미지들을 제거합니다.
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:${{ github.sha }}
docker run -d -p 8080:8080 -e SPRING_PROFILES_ACTIVE=prod \
--name zzansuni-spring \
--name zzansuni-spring-prod \
-e KAKAO_CLIENT_SECRET=${{ secrets.KAKAO_CLIENT_SECRET }} \
-e NAVER_CLIENT_SECRET=${{ secrets.NAVER_CLIENT_SECRET }} \
-e KAKAO_REDIRECT_URI=${{ secrets.KAKAO_REDIRECT_URI }} \
Expand All @@ -76,4 +77,19 @@ jobs:
-e S3_BUCKET=${{ secrets.S3_BUCKET }} \
-e S3_ACCESS_KEY=${{ secrets.S3_ACCESS_KEY }} \
-e S3_SECRET_KEY=${{ secrets.S3_SECRET_KEY }} \
-e SERVER_URL=https://api.reditus.site \
${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:${{ github.sha }}
docker run -d -p 8081:8080 -e SPRING_PROFILES_ACTIVE=dev \
--name zzansuni-spring-dev \
-e KAKAO_CLIENT_SECRET=${{ secrets.KAKAO_CLIENT_SECRET }} \
-e NAVER_CLIENT_SECRET=${{ secrets.NAVER_CLIENT_SECRET }} \
-e KAKAO_REDIRECT_URI=${{ secrets.KAKAO_DEV_REDIRECT_URI }} \
-e MYSQL_URL=${{ secrets.MYSQL_DEV_URL }} \
-e MYSQL_USERNAME=${{ secrets.MYSQL_USERNAME }} \
-e MYSQL_PASSWORD=${{ secrets.MYSQL_PASSWORD }} \
-e S3_BUCKET=${{ secrets.S3_BUCKET }} \
-e S3_ACCESS_KEY=${{ secrets.S3_ACCESS_KEY }} \
-e S3_SECRET_KEY=${{ secrets.S3_SECRET_KEY }} \
-e SERVER_URL=http://api.reditus.site:8081 \
${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:${{ github.sha }}
12 changes: 6 additions & 6 deletions zzansuni-api-server/app/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ server:
spring:
config:
activate:
on-profile: dev, prod # dev, prod 공통 설정
on-profile: local, dev, prod # dev, prod 공통 설정
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
jpa:
Expand All @@ -77,10 +77,10 @@ kakao:
naver:
client-id: ${NAVER_CLIENT_ID:Ob2i2TZtIsaNqH8j_q9X}
---
spring: # dev profile
spring: # local profile
config:
activate:
on-profile: dev
on-profile: local
datasource:
url: jdbc:mysql://localhost:3306/zzansuni?createDatabaseIfNotExist=true
username: "root"
Expand All @@ -94,10 +94,10 @@ kakao:
naver:
client-secret: ${NAVER_CLIENT_SECRET:placeholder}
---
spring: # prod profile
spring: # dev,prod profile
config:
activate:
on-profile: prod
on-profile: dev, prod
datasource:
url: ${MYSQL_URL}
username: ${MYSQL_USERNAME}
Expand All @@ -121,4 +121,4 @@ kakao:
redirect-uri: ${KAKAO_REDIRECT_URI}
naver:
client-secret: ${NAVER_CLIENT_SECRET}
server-url: 'https://api.reditus.site'
server-url: ${SERVER_URL}

0 comments on commit 7af5965

Please sign in to comment.