-
Notifications
You must be signed in to change notification settings - Fork 1
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 #22 from Studio-Yandex-Practicum/feature/deploy_to…
…_server Compose и Workflow для деплоя dev на сервер
- Loading branch information
Showing
2 changed files
with
101 additions
and
12 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 |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Main Workflow | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
|
||
jobs: | ||
# test: | ||
# runs-on: ubuntu-24.04 | ||
|
||
# services: | ||
# postgres: | ||
# image: postgres:16 | ||
# env: | ||
# POSTGRES_USER: ${{ secrets.POSTGRES_USER }} | ||
# POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | ||
# POSTGRES_DB: ${{ secrets.POSTGRES_DB }} | ||
# ports: | ||
# - 5432:5432 | ||
# options: >- | ||
# --health-cmd "pg_isready -U ${{ secrets.POSTGRES_USER }}" | ||
# --health-interval 10s | ||
# --health-timeout 5s | ||
# --health-retries 5 | ||
|
||
# adminer: | ||
# image: adminer:4.8.1 | ||
# ports: | ||
# - 8080:8080 | ||
|
||
# steps: | ||
# - name: Checkout code | ||
# uses: actions/checkout@v3 | ||
|
||
# - name: Set up Python | ||
# uses: actions/setup-python@v4 | ||
# with: | ||
# python-version: '3.12' | ||
|
||
# - name: Install dependencies | ||
# run: | | ||
# python -m pip install --upgrade pip | ||
# pip install -r requirements.txt | ||
|
||
# - name: Run tests | ||
# env: | ||
# DATABASE_URL: postgres://postgres:${{ secrets.POSTGRES_PASSWORD }}@localhost:5432/${{ secrets.POSTGRES_DB }} | ||
# run: | | ||
# pytest | ||
|
||
deploy: | ||
runs-on: ubuntu-24.04 | ||
# needs: test | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Deploy to server | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USER }} | ||
key: ${{ secrets.SSH_KEY }} | ||
passphrase: ${{ secrets.SSH_PASSPHRASE }} | ||
script: | | ||
cd /Privet_Logoped_team_4/ | ||
git pull origin dev | ||
source /Privet_Logoped_team_4/src/telegram_bot/venv/bin/activate | ||
pip install -r src/telegram_bot/requirements.txt | ||
alembic upgrade head | ||
deactivate | ||
source /Privet_Logoped_team_4/src/vk_bot/venv/bin/activate | ||
pip install -r src/vk_bot/requirements.txt | ||
deactivate | ||
sudo systemctl restart docker-compose-db.service | ||
sudo systemctl restart telegram-bot.service | ||
sudo systemctl restart vk-bot.service |
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,22 +1,33 @@ | ||
version: '3' | ||
|
||
services: | ||
|
||
db: | ||
image: postgres | ||
restart: always | ||
shm_size: 128mb | ||
volumes: | ||
- db-data:/var/lib/postgresql/data | ||
env_file: .env | ||
postgres: | ||
image: postgres:16 | ||
container_name: postgres_db | ||
environment: | ||
POSTGRES_USER: ${POSTGRES_USER} | ||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} | ||
POSTGRES_DB: ${POSTGRES_DB} | ||
ports: | ||
- "5433:5432" | ||
- "5432:5432" | ||
volumes: | ||
- postgres_data:/var/lib/postgresql/data | ||
networks: | ||
- db_network | ||
|
||
adminer: | ||
image: adminer | ||
restart: always | ||
image: adminer:4.8.1 | ||
container_name: adminer | ||
ports: | ||
- "8080:8080" | ||
networks: | ||
- db_network | ||
depends_on: | ||
- postgres | ||
|
||
volumes: | ||
db-data: | ||
postgres_data: | ||
|
||
networks: | ||
db_network: | ||
driver: bridge |