Skip to content

Commit

Permalink
fix prod workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
elenashovtyuk committed Sep 5, 2023
1 parent bc76435 commit b49d9f2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
24 changes: 15 additions & 9 deletions .github/workflows/deploy-bot-on-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ jobs:
name: prod_deploy
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: copy service file
- uses: actions/checkout@v2
- name: Prepare infra/prod
run: |
mkdir ../build
cp -TR ./infra/prod ../build
tar -cvf deploy.tar ../build/
- name: copy infra/prod
uses: appleboy/scp-action@v0.1.4
with:
host: ${{ secrets.VM_HOST }}
username: ${{ secrets.VM_USER }}
password: ${{ secrets.VM_PASSWORD }}
source: "infra/prod/"
source: "deploy.tar"
target: /home/deploy/spread_wings_bot/infra/prod/
- name: ssh pull and start
uses: appleboy/ssh-action@master
Expand All @@ -29,6 +35,8 @@ jobs:
password: ${{ secrets.VM_PASSWORD }}
script: |
cd /home/deploy/spread_wings_bot/infra/prod/
tar -xvf deploy.tar --strip-components 1
rm deploy.tar
rm .env
touch .env
Expand Down Expand Up @@ -69,16 +77,14 @@ jobs:
docker system prune --force
# Installing defend service for app
# Шаг с копированием в строках 16-23 можно заменить командой ниже - нужно тестировать
# scp infra/prod/spread_wings_bot.service ${{ secrets.VM_USER }}@${{ secrets.VM_HOST }}:/spread_wings_bot/infra/prod/
sudo cp -f /home/deploy/spread_wings_bot/infra/prod/spread_wings_bot.service /etc/systemd/system/spread_wings_bot.service
sudo cp -f /home/deploy/spread_wings_bot/infra/prod/spread_wings_bot_prod.service /etc/systemd/system/spread_wings_bot_prod.service
sudo systemctl daemon-reload
sudo systemctl restart spread_wings_bot.service
sudo systemctl restart spread_wings_bot_prod.service
# Installing the app
docker-compose -f docker-compose.stage.yaml stop
docker-compose -f docker-compose.stage.yaml pull
docker-compose -f docker-compose.stage.yaml up -d
docker-compose -f docker-compose.prod.yaml stop
docker-compose -f docker-compose.prod.yaml pull
docker-compose -f docker-compose.prod.yaml up -d
# Applying initialization commands
docker exec spread-wings-bot python manage.py migrate
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/deploy-bot-on-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ jobs:
docker system prune --force
# Installing defend service for app
# Шаг с копированием в строках 16-23 можно заменить командой ниже - нужно тестировать
# scp infra/dev/spread_wings_bot.service ${{ secrets.VM_USER }}@${{ secrets.VM_HOST }}:/spread_wings_bot/infra/dev/
sudo cp -f /home/deploy/spread_wings_bot/infra/dev/spread_wings_bot.service /etc/systemd/system/spread_wings_bot.service
sudo systemctl daemon-reload
sudo systemctl restart spread_wings_bot.service
Expand Down
File renamed without changes.

0 comments on commit b49d9f2

Please sign in to comment.