Skip to content

Commit

Permalink
Update server_cicd.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Imsyp authored Oct 11, 2024
1 parent 42bc201 commit 4d0c66c
Showing 1 changed file with 26 additions and 41 deletions.
67 changes: 26 additions & 41 deletions .github/workflows/server_cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,51 +32,36 @@ jobs:
cd server
./gradlew build -x test
- name: Deliver jar File to Internal Server through Bastion Host
if: success()
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.GCP_INTERNAL_SERVER_VM_HOST }}
username: ${{ secrets.GCP_SERVER_VM_USER }}
key: ${{ secrets.GCP_INTERNAL_SERVER_SSH_PRIVATE_KEY }}
proxy_host: ${{ secrets.GCP_SERVER_VM_HOST }}
proxy_username: ${{ secrets.GCP_SERVER_VM_USER }}
proxy_key: ${{ secrets.GCP_SERVER_SSH_PRIVATE_KEY }}
source: server/build/libs/swdc-0.0.1-SNAPSHOT.jar
target: /home/patturning2/deployment/

- name: Deploy to Internal Server through Bastion Host
if: success()
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.GCP_SERVER_VM_HOST }}
host: ${{ secrets.GCP_INTERNAL_SERVER_VM_HOST }}
username: ${{ secrets.GCP_SERVER_VM_USER }}
key: ${{ secrets.GCP_SERVER_SSH_PRIVATE_KEY }}
key: ${{ secrets.GCP_INTERNAL_SERVER_SSH_PRIVATE_KEY }}
port: 22
proxy_host: ${{ secrets.GCP_SERVER_VM_HOST }}
proxy_username: ${{ secrets.GCP_SERVER_VM_USER }}
proxy_key: ${{ secrets.GCP_SERVER_SSH_PRIVATE_KEY }}
proxy_port: 22
script: |
echo "${{ secrets.GCP_INTERNAL_SERVER_SSH_PRIVATE_KEY }}" > /tmp/internal_key
chmod 600 /tmp/internal_key
ssh -i /tmp/internal_key ${{ secrets.GCP_SERVER_VM_USER }}@${{ secrets.GCP_INTERNAL_SERVER_VM_HOST }} << 'EOF'
echo "SSH connection successful!"
rm -f /tmp/internal_key
# - name: Deliver jar File to Internal Server through Bastion Host
# if: success()
# uses: appleboy/scp-action@v0.1.7
# with:
# host: ${{ secrets.GCP_INTERNAL_SERVER_VM_HOST }}
# username: ${{ secrets.GCP_SERVER_VM_USER }}
# key: ${{ secrets.GCP_INTERNAL_SERVER_SSH_PRIVATE_KEY }}
# proxy_host: ${{ secrets.GCP_SERVER_VM_HOST }}
# proxy_username: ${{ secrets.GCP_SERVER_VM_USER }}
# proxy_key: ${{ secrets.GCP_SERVER_SSH_PRIVATE_KEY }}
# source: server/build/libs/swdc-0.0.1-SNAPSHOT.jar
# target: /home/patturning2/deployment/

# - name: Deploy to Internal Server through Bastion Host
# if: success()
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.GCP_INTERNAL_SERVER_VM_HOST }}
# username: ${{ secrets.GCP_SERVER_VM_USER }}
# key: ${{ secrets.GCP_INTERNAL_SERVER_SSH_PRIVATE_KEY }}
# port: 22
# proxy_host: ${{ secrets.GCP_SERVER_VM_HOST }}
# proxy_username: ${{ secrets.GCP_SERVER_VM_USER }}
# proxy_key: ${{ secrets.GCP_SERVER_SSH_PRIVATE_KEY }}
# proxy_port: 22
# script: |
# sudo docker image prune -f
# sudo docker stop swdc-container || true
# sudo docker rm swdc-container || true

# cd /home/patturning2/deployment
# sudo docker build -t swdc-app .
# sudo docker run -d -p 8080:8080 --name swdc-container -v /mnt:/mnt swdc-app
sudo docker image prune -f
sudo docker stop swdc-container || true
sudo docker rm swdc-container || true
cd /home/patturning2/deployment
sudo docker build -t swdc-app .
sudo docker run -d -p 8080:8080 --name swdc-container -v /mnt:/mnt swdc-app

0 comments on commit 4d0c66c

Please sign in to comment.