diff --git a/.github/workflows/deploy_api.yml b/.github/workflows/deploy_api.yml index 51c00c16..fe815fe4 100644 --- a/.github/workflows/deploy_api.yml +++ b/.github/workflows/deploy_api.yml @@ -30,18 +30,34 @@ jobs: host: ${{ secrets.DEVSERVER }} username: ${{ secrets.USERNAME }} key: ${{ secrets.SECRETKEY }} - command_timeout: 10m + command_timeout: 5m script: | cd xfluencer/influencer-marketplace git pull + pgrep gunicorn | xargs kill -9 cd src/api/marketplace source venv/bin/activate pip3 install -r requirements.txt pip3 install pyxfluencer-1.2.0-py3-none-any.whl python3 manage.py migrate python3 manage.py collectstatic -link --noinput + echo "Stopping previous processes..." + pgrep gunicorn | xargs kill -9 + echo "Stopping redis service..." + sudo systemctl stop redis + echo "Starting redis service..." + sudo systemctl start redis + echo "Starting gunicorn..." + nohup sh -c 'gunicorn -w 4 marketplace.wsgi:application > gunicorn.out 2>&1' & + echo "Gunicorn started." + echo "Starting celery worker..." + nohup sh -c 'celery -A marketplace worker -l info > celery_worker.out 2>&1' & + echo "Celery worker started." + echo "Starting celery beat..." + nohup sh -c 'celery -A marketplace beat -l info > celery_beat.out 2>&1' & + echo "Celery beat started." sudo systemctl restart nginx - sudo supervisorctl restart marketplace + echo "Restarted nginx" - name: Remove Github Actions IP from security group if: always() diff --git a/.github/workflows/deploy_prod_api.yml b/.github/workflows/deploy_prod_api.yml index b13bff5e..ab353e5f 100644 --- a/.github/workflows/deploy_prod_api.yml +++ b/.github/workflows/deploy_prod_api.yml @@ -2,7 +2,7 @@ name: Deploy API - Prod on: push: - branches: [ github-actions-prod ] + branches: [ release ] jobs: deploy: runs-on: ubuntu-latest @@ -36,6 +36,7 @@ jobs: pwd git status git pull + pgrep gunicorn | xargs kill -9 cd src/api/marketplace source venv/bin/activate pip3 install -r requirements.txt diff --git a/.github/workflows/deploy_ui.yml b/.github/workflows/deploy_ui.yml index d2bc78dc..b3f86279 100644 --- a/.github/workflows/deploy_ui.yml +++ b/.github/workflows/deploy_ui.yml @@ -30,7 +30,7 @@ jobs: host: ${{ secrets.DEVSERVER_UI }} username: ${{ secrets.USERNAME }} key: ${{ secrets.SECRETKEY_UI }} - command_timeout: 10m + command_timeout: 5m script: | cd xfluencer/influencer-marketplace git pull