-
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.
- Loading branch information
1 parent
511ab9c
commit b14400a
Showing
6 changed files
with
56 additions
and
48 deletions.
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,50 @@ | ||
name: Deploy Django and Celery to EC2 instance | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
|
||
jobs: | ||
deploy_project: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4.1.7 | ||
- name: Get changed files | ||
id: changed-files | ||
uses: tj-actions/changed-files@v44.5.7 | ||
with: | ||
since_last_remote_commit: true | ||
separator: "," | ||
|
||
- name: Copy files via scp using SSH key | ||
uses: appleboy/scp-action@v0.1.7 | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
key: ${{ secrets.DEPLOY_KEY }} | ||
port: ${{ secrets.PORT }} | ||
source: "." | ||
target: ${{ github.event.repository.name }} | ||
|
||
build_project: | ||
name: Build | ||
needs: deploy_project | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Executing remote SSH commands using SSH key | ||
uses: appleboy/ssh-action@v1.0.3 | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
key: ${{ secrets.DEPLOY_KEY }} | ||
port: ${{ secrets.PORT }} | ||
script: | | ||
cd aws-django-redis/ | ||
source venv/bin/activate | ||
pip install -r requirements.txt | ||
python manage.py migrate | ||
sudo supervisorctl reread | ||
sudo supervisorctl update | ||
sudo supervisorctl restart all |
This file was deleted.
Oops, something went wrong.
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,4 @@ | ||
#!/bin/bash | ||
|
||
export $(cat ~/aws-django-redis/.env | xargs) | ||
exec celery -A my_schedular worker --loglevel=INFO |
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,7 +1,4 @@ | ||
#!/bin/bash | ||
|
||
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord-web.conf & | ||
|
||
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord-celery.conf & | ||
|
||
wait | ||
export $(cat ~/aws-django-redis/.env | xargs) | ||
exec gunicorn my_schedular.wsgi:application --bind 0.0.0.0:8000 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.