Skip to content

fix(ops): починить provision-prod.sh + доки под живой прод - #7

Merged
bronxtc52 merged 1 commit into
mainfrom
docs/prod-live
Jul 17, 2026
Merged

fix(ops): починить provision-prod.sh + доки под живой прод#7
bronxtc52 merged 1 commit into
mainfrom
docs/prod-live

Conversation

@bronxtc52

Copy link
Copy Markdown
Owner

Скрипт провижининга

Первый прогон упал на середине: я написал -d для имени БД, а CLI требует -n. Упал после создания RG, ACR и PG-сервера — самого долгого. Повторный запуск попытался бы пересоздать их.

  • флаг исправлен;
  • скрипт стал перезапускаемым: ACR / PG / env / identities / роли / federated credentials защищены проверками существования.

Доки под факт

CLAUDE.md бота говорил «прод-инфраструктуры нет» — теперь ПРОД с 2026-07-17. Секция отладки ссылалась на локальный docker-compose, которого больше нет → переписана на логи ACA. Записана грабля OIDC.

Прод проверен живьём

ревизия: ca-launch11-bot--8o4k00q — Healthy / RunningAtMaxScale
ingress: None | реплики 1/1 | @launch_11_bot polling | 409-конфликтов: 0

🤖 Generated with Claude Code

The first prod provisioning died halfway: I wrote `-d` for the database name where the CLI
wants `-n`, so it failed AFTER creating the RG, ACR and the Postgres server — the slow part.
Re-running would have tried to recreate them.

- fixed the flag; the script now guards ACR / PG server / env / identities / roles /
  federated credentials with existence checks, so it resumes instead of colliding.
- CLAUDE.md: status is now PROD (was "инфраструктуры нет"), debugging section points at ACA
  logs instead of the local compose that no longer exists, and records the OIDC gotcha.

Prod verified live: revision Healthy/RunningAtMaxScale, ingress None, 1/1 replica,
@launch_11_bot polling, zero 409 conflicts.

Co-Authored-By: Claude <noreply@anthropic.com>
@bronxtc52
bronxtc52 merged commit a80da52 into main Jul 17, 2026
1 check passed
@bronxtc52
bronxtc52 deleted the docs/prod-live branch July 17, 2026 02:21

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2451edb1ff

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bot/ops/provision-prod.sh
Comment on lines +55 to +56
az postgres flexible-server db create -g "$RG" -s "$PG" -n "$PGDB" -o none 2>/dev/null \
|| echo " (БД уже есть)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve real database-creation failures

On a rerun, any database-creation failure—not only an AlreadyExists response—is converted to success here. For example, a transient Azure error, expired authorization, or a server that is not ready will be reported as “БД уже есть”; nothing later verifies that the database exists, so the script stores a DATABASE_URL for it and ultimately reports that provisioning succeeded while the deployed bot cannot connect. Check for the database explicitly or suppress only the expected conflict.

Useful? React with 👍 / 👎.

Comment thread bot/ops/provision-prod.sh
Comment on lines 99 to +100
az role assignment create --assignee-object-id "$CI_PRINCIPAL" --assignee-principal-type ServicePrincipal \
--role "Contributor" --scope "$RG_ID" -o none
--role "Contributor" --scope "$RG_ID" -o none 2>/dev/null || echo " (роль уже есть)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Fail when required role assignment cannot be created

If assigning Contributor fails for any reason other than an existing assignment—for example insufficient role-assignment privileges, throttling, or a transient API error—this handler prints that the role already exists and continues through the success message. The deploy workflow relies on this CI identity to create or update the Container App, so subsequent deployments will fail despite provisioning appearing successful; explicitly query the assignment or suppress only the AlreadyExists error. The same unrestricted suppression is also used for AcrPull, Managed Identity Operator, and the federated credentials.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant