Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
KonstantinRaikhert committed Sep 5, 2023
2 parents 3fbdfda + 935b66e commit 586043f
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 17 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/deploy-bot-on-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@ jobs:
name: stage_deploy
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: copy service file
- uses: actions/checkout@v2
- name: Prepare infra/dev
run: |
mkdir ../build
cp -TR ./infra/dev ../build
tar -cvf deploy.tar ../build/
- name: copy infra/dev
uses: appleboy/scp-action@v0.1.4
with:
host: ${{ secrets.VM_HOST }}
username: ${{ secrets.VM_USER }}
password: ${{ secrets.VM_PASSWORD }}
port: 22
source: "infra/dev/spread_wings_bot.service"
source: "deploy.tar"
target: /home/deploy/spread_wings_bot/infra/dev/
- name: ssh pull and start
uses: appleboy/ssh-action@master
Expand All @@ -30,6 +35,8 @@ jobs:
password: ${{ secrets.VM_PASSWORD }}
script: |
cd /home/deploy/spread_wings_bot/infra/dev/
tar -xvf deploy.tar --strip-components 1
rm deploy.tar
rm .env
touch .env
Expand Down Expand Up @@ -70,17 +77,11 @@ 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
# 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
# Applying initialization commands
sleep 7
docker exec spread-wings-bot python manage.py migrate
docker exec spread-wings-bot python manage.py collectstatic --noinput
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,4 @@ local_persistence

# Others
coordinator_contacts.html
static/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Бот для фонда "Расправь крылья!"

#### Проект телеграм-бота, который позволяет всем желающим и нуждающимся получить ответы на все необходимые вопросы в телеграме. [“Расправь крылья”](https://detskyfond.info/).
#### Проект телеграм-бота, который позволяет всем желающим и нуждающимся получить ответы на все необходимые вопросы в телеграме. [“Расправь крылья!](https://detskyfond.info/).

Бот забирает необходимые вопросы и контакты с базы данных сайта на CMS Wordpress.

Expand Down
8 changes: 4 additions & 4 deletions infra/dev/docker-compose.stage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
volumes:
- ./redis.conf:/usr/local/etc/redis.conf
- data_value:/data
- ./logs/redis/:/var/log/
- ../../logs/redis/:/var/log/
networks:
- spread-wings-network

Expand All @@ -33,7 +33,7 @@ services:
- "5432:5432"
volumes:
- db_data:/var/lib/postgresql/data
- ./logs/db/:/var/log/postgres
- ../../logs/db/:/var/log/postgres
restart: always
networks:
- spread-wings-network
Expand All @@ -47,7 +47,7 @@ services:
volumes:
- ../../static:/app/src/staticfiles
- ../../media:/app/src/media
- ./logs/bot/:/app/src/logs
- ../../logs/bot/:/app/src/logs
restart: always
env_file:
- ./.env
Expand All @@ -63,7 +63,7 @@ services:
- ./nginx.stage.conf.template:/etc/nginx/templates/default.conf.template
- ../../static:/var/html/static/
- ../../media:/var/html/media/
- ./logs/nginx/:/var/log/nginx/
- ../../logs/nginx/:/var/log/nginx/
env_file:
- ./.env
depends_on:
Expand Down
49 changes: 49 additions & 0 deletions src/bot/migrations/0008_alter_coordinator_phone_number_and_more.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Generated by Django 4.2.4 on 2023-09-03 17:19

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):
"""Migrations for bot."""

dependencies = [
("bot", "0007_alter_question_short_description"),
]

operations = [
migrations.AlterField(
model_name="coordinator",
name="phone_number",
field=models.CharField(
blank=True,
help_text="Введите номер телефона регионального координатора",
max_length=20,
null=True,
validators=[
django.core.validators.RegexValidator(
message="Введите номер телефона в формате: +7 (777) 777-77-77",
regex="^[\\+]?[7, 8][-\\s\\.]?[(]?[0-9]{3}[)]?[-\\s\\.]?[0-9]{3}[-\\s\\.]?[0-9]{2}[-\\s\\.]?[0-9]{2}$",
)
],
verbose_name="Номер телефона",
),
),
migrations.AlterField(
model_name="coordinator",
name="telegram_account",
field=models.CharField(
blank=True,
help_text="Введите телеграмм-аккаунт регионального координатора",
max_length=32,
null=True,
validators=[
django.core.validators.RegexValidator(
message="Введите название аккаунта telegram в формате: username",
regex="^[\\w\\_]{5,32}$",
)
],
verbose_name="Telegram",
),
),
]
2 changes: 0 additions & 2 deletions src/bot/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class Coordinator(BaseModel):
)
phone_number = models.CharField(
max_length=20,
unique=True,
validators=[phone_regex],
blank=True,
null=True,
Expand All @@ -49,7 +48,6 @@ class Coordinator(BaseModel):
)
telegram_account = models.CharField(
max_length=32,
unique=True,
validators=[telegram_regex],
blank=True,
null=True,
Expand Down

0 comments on commit 586043f

Please sign in to comment.