forked from onyx-dot-app/onyx
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (47 loc) · 1.49 KB
/
redeploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Deploy on Production Update
on:
push:
branches:
- prod
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: production
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$PROD_SSH_KEY" > ~/.ssh/hubgpt_prod.key
chmod 600 ~/.ssh/hubgpt_prod.key
cat >>~/.ssh/config <<END
Host prod
HostName $PROD_EC2_HOST_IP
User $PROD_EC2_USER
IdentityFile ~/.ssh/hubgpt_prod.key
StrictHostKeyChecking no
END
env:
PROD_EC2_USER: ${{ secrets.STAGING_SSH_USER }}
PROD_SSH_KEY: ${{ secrets.STAGING_SSH_KEY }}
PROD_EC2_HOST_IP: ${{ secrets.STAGING_SSH_HOST }}
- name: Deploy to Production
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets.PROD_EC2_USER }}@${{ secrets.PROD_EC2_HOST_IP }} << 'EOF'
cd danswer
make re-deploy
echo "Deployment complete"
EOF
- name: Wait before pinging
run: sleep 60
- name: Ping the website
run: |
response=$(curl -o /dev/null -s -w "%{http_code}\n" https://hubgpt-prod.idinsight.io)
if [ "$response" -eq 200 ]; then
echo "Site is up and returned HTTP status 200"
else
echo "Site might be down or is not returning HTTP status 200, returned HTTP status $response"
exit 1
fi