-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #126 from cau-likelion-org/refactoring
Refactoring
- Loading branch information
Showing
5 changed files
with
75 additions
and
98 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 |
---|---|---|
@@ -1,31 +1,30 @@ | ||
name: Deploy | ||
name: Django EC2 Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- deploy | ||
branches: [main] | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
name: "Django CD" | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up SSH | ||
uses: webfactory/[email protected] | ||
- name: EC2 ssh connection test | ||
uses: appleboy/ssh-action@master | ||
with: | ||
ssh-private-key: ${{ secrets.CHUNGHAHA_DEPLOY_KEY }} | ||
|
||
- name: SSH to EC2 and kill running processes | ||
run: | | ||
ssh ubuntu@ip-172-31-1-75 "ps -ef | grep manage.py | grep -v grep | awk '{print \$2}' | xargs -r kill -9" | ||
- name: Activate virtualenv and install dependencies | ||
run: | | ||
ssh ubuntu@ip-172-31-1-75 "source venv/bin/activate && cd cau-likelion-django && pip install -r requirements.txt" | ||
- name: Update code and run server | ||
run: | | ||
ssh ubuntu@ip-172-31-1-75 "git pull origin main && nohup python manage.py runserver 0.0.0.0:8000 &" | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
key: ${{ secrets.SSH_PEM }} | ||
command_timeout: 3m | ||
script: | | ||
sudo apt-get update | ||
sudo apt-get -y upgrade | ||
cd cau-likelion-django | ||
source venv/bin/activate | ||
git pull origin main | ||
sudo lsof -t -i tcp:8000 | xargs kill -9 | ||
pip install -r requirements.txt | ||
python manage.py makemigrations | ||
python manage.py migrate | ||
nohup gunicorn --bind 0.0.0.0:8000 config.wsgi > nohup.out 2> nohup.err < /dev/null & | ||
exit 0 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
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,79 +1,32 @@ | ||
appnope==0.1.3 | ||
asgiref==3.6.0 | ||
asttokens==2.2.1 | ||
async-generator==1.10 | ||
attrs==22.2.0 | ||
backcall==0.2.0 | ||
beautifulsoup4==4.11.2 | ||
boto3==1.26.48 | ||
botocore==1.29.48 | ||
bs4==0.0.1 | ||
cached-property==1.5.2 | ||
certifi==2022.12.7 | ||
cffi==1.15.1 | ||
charset-normalizer==3.0.1 | ||
commonmark==0.9.1 | ||
cryptography==39.0.0 | ||
decorator==5.1.1 | ||
asgiref==3.7.2 | ||
boto3==1.34.39 | ||
botocore==1.34.39 | ||
certifi==2024.2.2 | ||
cffi==1.16.0 | ||
charset-normalizer==3.3.2 | ||
cryptography==42.0.2 | ||
defusedxml==0.7.1 | ||
dictdiffer==0.9.0 | ||
dj-rest-auth==2.2.7 | ||
Django==4.1.5 | ||
django-allauth==0.51.0 | ||
django-cors-headers==3.14.0 | ||
django-storages==1.13.2 | ||
dj-rest-auth==5.0.2 | ||
Django==4.2.10 | ||
django-allauth==0.61.1 | ||
django-cors-headers==4.3.1 | ||
django-storages==1.14.2 | ||
djangorestframework==3.14.0 | ||
djangorestframework-simplejwt==5.0.0 | ||
exceptiongroup==1.1.0 | ||
executing==1.2.0 | ||
ez-setup==0.9 | ||
h11==0.14.0 | ||
idna==3.4 | ||
ipython==8.9.0 | ||
jedi==0.18.2 | ||
djangorestframework-simplejwt==5.3.1 | ||
idna==3.6 | ||
jmespath==1.0.1 | ||
lxml==4.9.2 | ||
matplotlib-inline==0.1.6 | ||
mysqlclient==2.1.1 | ||
notion==0.0.28 | ||
oauthlib==3.2.2 | ||
outcome==1.2.0 | ||
packaging==23.0 | ||
parso==0.8.3 | ||
pexpect==4.8.0 | ||
pickleshare==0.7.5 | ||
Pillow==9.4.0 | ||
prompt-toolkit==3.0.36 | ||
ptyprocess==0.7.0 | ||
pure-eval==0.2.2 | ||
pillow==10.2.0 | ||
pycparser==2.21 | ||
Pygments==2.14.0 | ||
PyJWT==2.6.0 | ||
PySocks==1.7.1 | ||
PyJWT==2.8.0 | ||
PyMySQL==1.1.0 | ||
python-dateutil==2.8.2 | ||
python-dotenv==0.21.1 | ||
python-slugify==8.0.0 | ||
python3-openid==3.2.0 | ||
pytz==2022.7 | ||
pytz-deprecation-shim==0.1.0.post0 | ||
requests==2.28.2 | ||
pytz==2024.1 | ||
requests==2.31.0 | ||
requests-oauthlib==1.3.1 | ||
s3transfer==0.6.0 | ||
selenium==4.8.2 | ||
s3transfer==0.10.0 | ||
six==1.16.0 | ||
sniffio==1.3.0 | ||
sortedcontainers==2.4.0 | ||
soupsieve==2.4 | ||
sqlparse==0.4.3 | ||
stack-data==0.6.2 | ||
text-unidecode==1.3 | ||
tqdm==4.64.1 | ||
traitlets==5.9.0 | ||
trio==0.22.0 | ||
trio-websocket==0.9.2 | ||
tzdata==2022.7 | ||
tzlocal==4.2 | ||
urllib3==1.26.14 | ||
wcwidth==0.2.6 | ||
webdriver-manager==3.8.5 | ||
wsproto==1.2.0 | ||
sqlparse==0.4.4 | ||
typing_extensions==4.9.0 | ||
urllib3==1.26.18 |