-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ensure gunicorn restart when backend updates pushed
- Loading branch information
1 parent
ee105f0
commit b8bbb19
Showing
2 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Deploy to EC2 | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- app/** | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Deploy to EC2 | ||
uses: appleboy/ssh-action@v0.1.7 | ||
with: | ||
host: ${{ secrets.EC2_HOST }} | ||
username: ubuntu | ||
key: ${{ secrets.EC2_SSH_KEY }} | ||
script: | | ||
cd ~/yt_translator | ||
app/post_update.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
#!/bin/bash | ||
|
||
cd ~/yt_translator | ||
git pull origin main | ||
|
||
# Copy custom settings file | ||
if [ ! -f settings.py ]; then | ||
if [ ! -f video_host/settings.py ]; then | ||
echo "Restoring settings.py..." | ||
cp /home/ubuntu/settings_backup/settings.py video_host/settings.py | ||
fi | ||
|
||
source /home/ubuntu/yt_translator/venv/bin/activate | ||
python manage.py migrate | ||
|
||
sudo systemctl stop gunicorn | ||
sudo systemctl daemon-reload | ||
sudo systemctl start gunicorn | ||
sudo systemctl enable gunicorn | ||
|
||
|