Skip to content

Commit

Permalink
Hosting django server
Browse files Browse the repository at this point in the history
  • Loading branch information
MdSamsuzzohaShayon committed Jan 22, 2024
1 parent 86c67d7 commit 32e0d70
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 127 deletions.
55 changes: 32 additions & 23 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,43 @@ name: Django CI/CD

on:
push:
branches: [ main ]
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
deploy:
# build:
# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v2
# - name: Set up Python
# uses: actions/setup-python@v2
# with:
# python-version: '3.8'
# - name: Install dependencies
# run: |
# pip install -r requirements.txt
# - name: Run Tests
# run: |
# # Add commands to run your tests
deploy_backend:
# needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Tests
run: |
python manage.py test
- name: Deploy to VPS
- uses: actions/checkout@v3
- name: SSH and Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SSH_KEY }}
host: ${{ secrets.VPS_IP }}
username: ${{ secrets.LINUX_USER_NAME }}
key: ${{ secrets.VPS_AUTHORIZED_SSH_KEY }}
script: |
cd /path/to/your/project
git pull
cd /home/shayon/webdevlab
git pull origin master
cd /home/shayon/webdevlab/server
source .venv/bin/activate
pip install -r requirements.txt
python manage.py migrate
sudo systemctl restart gunicorn
sudo systemctl restart nginx
./manage.py migrate
sudo systemctl restart your_project_service
3 changes: 0 additions & 3 deletions .idea/.gitignore

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

14 changes: 0 additions & 14 deletions .idea/the-freak-lesson.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@

- ArticleTags Table (a junction table to implement many-to-many relationship between Articles and Tags):
- article_id (Foreign Key referencing the Articles Table)
- tag_id (Foreign Key referencing the Tags Table)
- tag_id (Foreign Key referencing the Tags Table)

3 changes: 0 additions & 3 deletions server/.idea/.gitignore

This file was deleted.

6 changes: 0 additions & 6 deletions server/.idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

10 changes: 0 additions & 10 deletions server/.idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions server/.idea/modules.xml

This file was deleted.

14 changes: 0 additions & 14 deletions server/.idea/server.iml

This file was deleted.

6 changes: 0 additions & 6 deletions server/.idea/vcs.xml

This file was deleted.

Binary file removed server/db.sqlite3
Binary file not shown.

0 comments on commit 32e0d70

Please sign in to comment.