Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 11 additions & 20 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Docker Build & Push and Deploy to prod for eatery-blue-backend
name: Docker Build & Push and Deploy to prod for eatery-prod

on:
push:
Expand Down Expand Up @@ -34,27 +34,18 @@ jobs:
push: true
tags: cornellappdev/eatery-prod:${{ steps.vars.outputs.sha_short }}

- name: Deploy with Native SSH
- name: Remote SSH and Deploy
uses: appleboy/ssh-action@v1.0.3
env:
PRIVATE_KEY: ${{ secrets.PROD_SERVER_KEY }}
HOST: ${{ secrets.PROD_SERVER_HOST }}
REMOTE_USER: ${{ secrets.SERVER_USERNAME }}
IMAGE_TAG: ${{ steps.vars.outputs.sha_short }}
run: |
mkdir -p ~/.ssh
chmod 700 ~/.ssh

# Safely write the key and strip any invisible Windows carriage returns
echo "$PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa

ssh-keyscan -H "$HOST" >> ~/.ssh/known_hosts

ssh -v -o PubkeyAcceptedKeyTypes=+ssh-rsa -i ~/.ssh/id_rsa "$REMOTE_USER@$HOST" "
export IMAGE_TAG=$IMAGE_TAG
with:
host: ${{ secrets.PROD_SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.PROD_SERVER_KEY }}
script: |
export IMAGE_TAG=${{ steps.vars.outputs.sha_short }}
cd docker-compose
docker stack rm thestack
sleep 20
sleep 20s
docker stack deploy -c docker-compose.yml thestack
docker system prune -af
"
yes | docker system prune -a