Skip to content

Commit

Permalink
feat: updates to ci-cd
Browse files Browse the repository at this point in the history
  • Loading branch information
yokwejuste committed Aug 19, 2024
1 parent 096f4b0 commit c2eb700
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/azure_vm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy Azure VM

on:
push:
branches:
- prod

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.AZURE_VM_IP_ADDRESS }}
username: ${{ secrets.AZURE_VM_USER }}
key: ${{ secrets.AZURE_VM_SSH_KEY }}
port: ${{ secrets.AZURE_VM_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.AZURE_VM_IP_ADDRESS }}
username: ${{ secrets.AZURE_VM_USER }}
key: ${{ secrets.AZURE_VM_SSH_KEY }}
port: ${{ secrets.AZURE_VM_PORT }}
script: |
cd ${{ github.event.repository.name }}
source venv/bin/activate
pip install -r requirements.txt
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl restart all
2 changes: 1 addition & 1 deletion config/docker/supervisord-celery.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ nodaemon=true
user=root

[program:celery]
command=celery -A website_api worker -l info
command=/home/django_admin/website_api/venv/bin/celery -A website_api worker -l info
directory=/app
autostart=true
autorestart=true
Expand Down
2 changes: 1 addition & 1 deletion config/docker/supervisord-web.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ nodaemon=true
user=root

[program:web]
command=gunicorn website_api.wsgi:application --bind 0.0.0.0:8000
command=/home/django_admin/website_api/venv/bin/gunicorn website_api.wsgi:application --bind 0.0.0.0:8000
directory=/app
autostart=true
autorestart=true
Expand Down

0 comments on commit c2eb700

Please sign in to comment.