ci: provision VK Callback API settings

This commit is contained in:
nyan404 committed 2026-10-10 21:34:18 +03:00
1 parent ed9203ea77
commit f92161de80
3 files changed
+7

No files matched your search

+4
View File
@@ -79,6 +79,8 @@ deploy:
- test -n "$KUBE_CONFIG_B64"
- test -n "$VK_GROUP_TOKEN"
- test -n "$VK_GROUP_ID"
- test -n "$VK_CALLBACK_SECRET"
- test -n "$VK_CALLBACK_CONFIRMATION"
- test -n "$BELKI_DATABASE_URL"
- test -n "$POSTGRES_PASSWORD"
- test -n "$BELKI_ADMIN_PASSWORD"
@@ -93,6 +95,8 @@ deploy:
--from-literal=VK_GROUP_TOKEN="$VK_GROUP_TOKEN" \
--from-literal=VK_GROUP_ID="$VK_GROUP_ID" \
--from-literal=VK_API_VERSION="${VK_API_VERSION:-5.199}" \
--from-literal=VK_CALLBACK_SECRET="$VK_CALLBACK_SECRET" \
--from-literal=VK_CALLBACK_CONFIRMATION="$VK_CALLBACK_CONFIRMATION" \
--from-literal=BELKI_DATABASE_URL="$BELKI_DATABASE_URL" \
--from-literal=POSTGRES_PASSWORD="$POSTGRES_PASSWORD" \
--from-literal=BELKI_ADMIN_PASSWORD="$BELKI_ADMIN_PASSWORD" \
+1
View File
@@ -26,6 +26,7 @@
- VK scheduler lives in `app/belki/vk_scheduler.py`; use `BELKI_DATABASE_URL` in production and `BELKI_HISTORY_DB` for local SQLite checks. Keep mailing disabled until an administrator explicitly enables a conversation and schedule.
- VK Callback API and dialog durability live across `app/belki/vk_bot.py`, `app/belki/vk_callback.py`, and `app/belki/vk_scheduler.py`. The bot listens on callback port 8081; preserve `vk_dialog_states` and `vk_callback_events` when changing dialog steps, attachments, or event dispatch. Validate with `python -m unittest tests.test_vk_bot tests.test_vk_conversation -q`. Production uses `/api/vk/callback` on the existing public host and routes that exact path to the `belki-bot` Service.
- The build job waits for the DinD daemon and runs `docker info` before building.
- The deploy job requires protected CI variables `VK_CALLBACK_SECRET` and `VK_CALLBACK_CONFIRMATION` and writes both into `belki-runtime` before applying the bot Deployment.
- Never commit `.env` or `.gitlab.variables.env`; the latter contains the GitLab Variable handoff and a namespace-scoped kubeconfig.
- Private image storage is the separate Kubernetes Secret `belki-image-store`, not the CI-recreated `belki-runtime`. It contains only the internal MinIO endpoints and bucket-scoped credentials; keep MinIO private and preserve the `/api/images/<id>` Belki proxy when changing upload flows.
+2
View File
@@ -115,6 +115,8 @@ belki-bot Service -> callback HTTP listener
Токен группы нужен для исходящих вызовов `messages.send`; Callback API заменяет только канал получения событий.
CI/CD должен передавать `VK_CALLBACK_SECRET` и `VK_CALLBACK_CONFIRMATION` как защищённые переменные GitLab. Deploy job записывает их в `belki-runtime`; значения не должны попадать в Git.
## План миграции
1. Вынести обработку одного события из Long Poll цикла в переиспользуемый метод. **Готово.**