Skip to content

Commit

Permalink
dev server CI/CD Test
Browse files Browse the repository at this point in the history
  • Loading branch information
ss0ngcode committed Nov 5, 2024
1 parent 897307a commit c55110a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/prod-CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand All @@ -98,22 +98,22 @@ 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 }}
debug: true
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"
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/staging-CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand All @@ -98,22 +98,22 @@ 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 }}
debug: true
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"
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit c55110a

Please sign in to comment.