deploy: подготовить артефакты для деплоя на baton.itafrika.com
- nginx/baton.conf: заменить <YOUR_DOMAIN> на baton.itafrika.com - deploy/baton.service: добавить systemd-юнит для uvicorn (/opt/baton, port 8000) - deploy/baton-keepalive.service: прописать реальный URL health-эндпоинта - deploy/env.template: шаблон .env для сервера (без секретов) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2ee953866b
commit
b70d5990c8
4 changed files with 42 additions and 5 deletions
|
|
@ -5,6 +5,6 @@ Description=Baton keep-alive ping
|
|||
[Service]
|
||||
Type=oneshot
|
||||
# Замените URL на реальный адрес вашего приложения
|
||||
ExecStart=curl -sf https://your-app.example.com/health
|
||||
ExecStart=curl -sf https://baton.itafrika.com/health
|
||||
StandardOutput=null
|
||||
StandardError=journal
|
||||
|
|
|
|||
18
deploy/baton.service
Normal file
18
deploy/baton.service
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
[Unit]
|
||||
Description=Baton — Telegram bot FastAPI backend
|
||||
After=network.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=www-data
|
||||
WorkingDirectory=/opt/baton
|
||||
EnvironmentFile=/opt/baton/.env
|
||||
ExecStart=/opt/baton/venv/bin/uvicorn backend.main:app --host 127.0.0.1 --port 8000
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
19
deploy/env.template
Normal file
19
deploy/env.template
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# /opt/baton/.env — заполнить перед деплоем
|
||||
# ВНИМАНИЕ: этот файл НЕ для git, только шаблон для ручного создания на сервере
|
||||
|
||||
# Telegram Bot — токен ТРЕБУЕТ замены через @BotFather (текущий скомпрометирован)
|
||||
BOT_TOKEN=***BOT_TOKEN_REMOVED***
|
||||
|
||||
# Chat ID для уведомлений — получить у @userinfobot или из Telegram API
|
||||
CHAT_ID=
|
||||
|
||||
# Webhook secret — случайная строка 32+ символа (сгенерировать: openssl rand -hex 32)
|
||||
WEBHOOK_SECRET=
|
||||
|
||||
# Webhook URL
|
||||
WEBHOOK_URL=https://baton.itafrika.com/api/webhook/telegram
|
||||
|
||||
WEBHOOK_ENABLED=true
|
||||
FRONTEND_ORIGIN=https://baton.itafrika.com
|
||||
APP_URL=https://baton.itafrika.com
|
||||
DB_PATH=/opt/baton/baton.db
|
||||
|
|
@ -31,7 +31,7 @@ log_format baton_secure '$remote_addr - $remote_user [$time_local] '
|
|||
# ---------------------------------------------------------------------------
|
||||
server {
|
||||
listen 80;
|
||||
server_name <YOUR_DOMAIN>;
|
||||
server_name baton.itafrika.com;
|
||||
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
|
|
@ -41,10 +41,10 @@ server {
|
|||
# ---------------------------------------------------------------------------
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name <YOUR_DOMAIN>;
|
||||
server_name baton.itafrika.com;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/<YOUR_DOMAIN>/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/<YOUR_DOMAIN>/privkey.pem;
|
||||
ssl_certificate /etc/letsencrypt/live/baton.itafrika.com/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/baton.itafrika.com/privkey.pem;
|
||||
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue