From c55110a826d2294dc46076f784cc9281fa526a8e Mon Sep 17 00:00:00 2001 From: Haedeok Date: Tue, 5 Nov 2024 16:30:32 +0900 Subject: [PATCH] dev server CI/CD Test --- .github/workflows/prod-CICD.yml | 12 ++++++------ .github/workflows/staging-CICD.yml | 12 ++++++------ docker-compose.yaml | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/prod-CICD.yml b/.github/workflows/prod-CICD.yml index 0ba2af7c..b45dd06c 100644 --- a/.github/workflows/prod-CICD.yml +++ b/.github/workflows/prod-CICD.yml @@ -77,7 +77,7 @@ jobs: - name: copy file via ssh key uses: appleboy/scp-action@v0.1.7 with: - host: ${{ secrets.PROD_PUBLIC_DNS }} + host: ${{ secrets.PROD_PUBLIC_IPV4_DNS }} username: ${{ secrets.EC2_USER }} key: ${{ secrets.SSH_PRIVATE_KEY }} port: ${{ secrets.EC2_SSH_PORT }} @@ -87,7 +87,7 @@ jobs: - name: Test SSH connection uses: appleboy/ssh-action@master with: - host: ${{ secrets.PROD_PUBLIC_DNS }} + host: ${{ secrets.PROD_PUBLIC_IPV4_DNS }} username: ${{ secrets.EC2_USER }} key: ${{ secrets.SSH_PRIVATE_KEY }} port: ${{ secrets.EC2_SSH_PORT }} @@ -98,7 +98,7 @@ jobs: - name: Deploy to EC2 Server uses: appleboy/ssh-action@master with: - host: ${{ secrets.PROD_PUBLIC_DNS }} + host: ${{ secrets.PROD_PUBLIC_IPV4_DNS }} username: ${{ secrets.EC2_USER }} key: ${{ secrets.SSH_PRIVATE_KEY }} port: ${{ secrets.EC2_SSH_PORT }} @@ -106,14 +106,14 @@ jobs: script: | echo ${{ secrets.DOCKERHUB_PASSWORD }} | sudo docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin - sudo docker kill ${{ secrets.SERVER_PROJECT_NAME }} - sudo docker rm -f ${{ secrets.SERVER_PROJECT_NAME }} + sudo docker kill ${{ secrets.API_SERVER_NAME }} + sudo docker rm -f ${{ secrets.API_SERVER_NAME }} sudo docker images -q ${{ secrets.DOCKERHUB_NAME }}/${{ secrets.PROD_DOCKERHUB_REPOSITORY }} | xargs -r docker rmi sudo docker pull ${{ secrets.DOCKERHUB_NAME }}/${{ secrets.PROD_DOCKERHUB_REPOSITORY }} cd ${{ secrets.SCP_TARGET_PATH }} - sudo docker compose up -d --no-deps ${{ secrets.SERVER_PROJECT_NAME }} + sudo docker compose up -d --no-deps ${{ secrets.API_SERVER_NAME }} sudo docker image prune -af --filter "until=24h" diff --git a/.github/workflows/staging-CICD.yml b/.github/workflows/staging-CICD.yml index 04d2e070..1111598c 100644 --- a/.github/workflows/staging-CICD.yml +++ b/.github/workflows/staging-CICD.yml @@ -77,7 +77,7 @@ jobs: - name: copy file via ssh key uses: appleboy/scp-action@v0.1.7 with: - host: ${{ secrets.DEV_PUBLIC_DNS }} + host: ${{ secrets.DEV_PUBLIC_IPV4_DNS }} username: ${{ secrets.EC2_USER }} key: ${{ secrets.SSH_PRIVATE_KEY }} port: ${{ secrets.EC2_SSH_PORT }} @@ -87,7 +87,7 @@ jobs: - name: Test SSH connection uses: appleboy/ssh-action@master with: - host: ${{ secrets.DEV_PUBLIC_DNS }} + host: ${{ secrets.DEV_PUBLIC_IPV4_DNS }} username: ${{ secrets.EC2_USER }} key: ${{ secrets.SSH_PRIVATE_KEY }} port: ${{ secrets.EC2_SSH_PORT }} @@ -98,7 +98,7 @@ jobs: - name: Deploy to EC2 Server uses: appleboy/ssh-action@master with: - host: ${{ secrets.DEV_PUBLIC_DNS }} + host: ${{ secrets.DEV_PUBLIC_IPV4_DNS }} username: ${{ secrets.EC2_USER }} key: ${{ secrets.SSH_PRIVATE_KEY }} port: ${{ secrets.EC2_SSH_PORT }} @@ -106,14 +106,14 @@ jobs: script: | echo ${{ secrets.DOCKERHUB_PASSWORD }} | sudo docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin - sudo docker kill ${{ secrets.SERVER_PROJECT_NAME }} - sudo docker rm -f ${{ secrets.SERVER_PROJECT_NAME }} + sudo docker kill ${{ secrets.API_SERVER_NAME }} + sudo docker rm -f ${{ secrets.API_SERVER_NAME }} sudo docker images -q ${{ secrets.DOCKERHUB_NAME }}/${{ secrets.DEV_DOCKERHUB_REPOSITORY }} | xargs -r docker rmi sudo docker pull ${{ secrets.DOCKERHUB_NAME }}/${{ secrets.DEV_DOCKERHUB_REPOSITORY }} cd ${{ secrets.SCP_TARGET_PATH }} - sudo docker compose up -d --no-deps ${{ secrets.SERVER_PROJECT_NAME }} + sudo docker compose up -d --no-deps ${{ secrets.API_SERVER_NAME }} sudo docker image prune -af --filter "until=24h" diff --git a/docker-compose.yaml b/docker-compose.yaml index ad7805a8..46efa21b 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -7,7 +7,7 @@ networks: services: omocha: image: kwlim1120ss/${DOCKERHUB_REPOSITORY} - container_name: ${DOCKERHUB_REPOSITORY} + container_name: ${API_SERVER_NAME} restart: always ports: - "8080:8080"