Skip to content

Correct SSH script

Correct SSH script #2

name: Deploy to staging EC2
on:
pull_request:
branches:
- staging
types: [closed]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.STAGING_EC2_SSH_PRIVATE_KEY }}
- name: SSH and Deploy to EC2
run: ssh -o StrictHostKeyChecking=no [email protected] << 'EOF'
docker ps -q | xargs -r docker kill
docker system prune -af
cd /home/ec2-user/danswer
git fetch origin staging
git reset --hard FETCH_HEAD
docker-compose -f /home/ec2-user/danswer/deployment/docker_compose/docker-compose.prod.yml up -d --force-recreate
EOF