From 4a7489861679cbfe1812619f93a3ed118d1a74e6 Mon Sep 17 00:00:00 2001 From: Fabian Emilius Date: Fri, 22 Nov 2024 01:52:46 +0100 Subject: [PATCH] Revert deployment changes --- .github/workflows/deploy_docker.yml | 32 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/.github/workflows/deploy_docker.yml b/.github/workflows/deploy_docker.yml index f8029cb..3ee95da 100644 --- a/.github/workflows/deploy_docker.yml +++ b/.github/workflows/deploy_docker.yml @@ -16,10 +16,23 @@ on: jobs: deploy: runs-on: ubuntu-latest - environment: + environment: name: ${{ inputs.environment }} url: '${{ vars.CLIENT_HOST }}' steps: + - name: SSH to VM and Execute Docker-Compose Down + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ vars.VM_HOST }} + username: ${{ vars.VM_USERNAME }} + key: ${{ secrets.VM_SSH_PRIVATE_KEY }} + proxy_host: ${{ vars.DEPLOYMENT_GATEWAY_HOST }} + proxy_username: ${{ vars.DEPLOYMENT_GATEWAY_USER }} + proxy_key: ${{ secrets.DEPLOYMENT_GATEWAY_SSH_KEY }} + proxy_port: ${{ vars.DEPLOYMENT_GATEWAY_PORT }} + script: | + docker compose -f docker-compose.prod.yml --env-file=.env.prod down --remove-orphans --rmi all + - name: checkout uses: actions/checkout@v4 @@ -67,19 +80,6 @@ jobs: source: "master.cf" target: /home/${{ vars.VM_USERNAME }}/postfix-config/ - - name: Copy thesis-track-backup.sh to VM Host - uses: appleboy/scp-action@v0.1.7 - with: - host: ${{ vars.VM_HOST }} - username: ${{ vars.VM_USERNAME }} - key: ${{ secrets.VM_SSH_PRIVATE_KEY }} - proxy_host: ${{ vars.DEPLOYMENT_GATEWAY_HOST }} - proxy_username: ${{ vars.DEPLOYMENT_GATEWAY_USER }} - proxy_key: ${{ secrets.DEPLOYMENT_GATEWAY_SSH_KEY }} - proxy_port: ${{ vars.DEPLOYMENT_GATEWAY_PORT }} - source: "thesis-track-backup.sh" - target: /home/${{ vars.VM_USERNAME }} - - name: SSH to VM and create .env.prod uses: appleboy/ssh-action@v1.0.3 with: @@ -150,6 +150,4 @@ jobs: proxy_key: ${{ secrets.DEPLOYMENT_GATEWAY_SSH_KEY }} proxy_port: ${{ vars.DEPLOYMENT_GATEWAY_PORT }} script: | - docker compose -f docker-compose.prod.yml --env-file=.env.prod pull client server - docker compose -f docker-compose.prod.yml --env-file=.env.prod restart postfix - docker compose -f docker-compose.prod.yml --env-file=.env.prod up -d + docker compose -f docker-compose.prod.yml --env-file=.env.prod up --pull=always -d