Migrate ask.defang.io deploy from AWS to Azure - #130
Conversation
- drop x-defang-dns-role (AWS-only; Azure's DNS writer only touches
Azure DNS zones, same as defang-mvp PR 3187 for the website)
- llm's x-defang-llm now provisions a managed Azure AI Foundry
deployment instead of running the Bedrock gateway container, so
MODEL becomes the deployment alias ("llm") instead of a Bedrock
model ID — accepted per-Lio's call on #126
to let Azure pick the model
- switch deploy.yaml from AWS role-chaining + Bedrock model-agreement
steps to Azure OIDC (defang-github-action exchanges the workflow's
own token, no credential step needed) and provider: azure
- add .defang/production, reusing the shared UAMI already used by
defang-mvp's website (needs a new federated credential for this
repo's subject — see defang-mvp PR for that)
No staging/dev deploy exists for this repo, so this takes effect the
moment it merges to main.
197aa0e to
8cf051b
Compare
- compose.yaml: Azure Container Apps caps a probe's InitialDelaySeconds at 60, and Defang maps start_period onto it, so the inherited 240s failed the deploy outright with ContainerAppProbeInitialDelaySecondsOutOfRange. Keep the startup budget inside that limit (60 + 10*30 = 360s); ECS treats start_period as a grace window, so this stays equivalent there. - app/rag_system.py: two real bugs against GPT-5.1 that Bedrock never exposed, found via a live Azure preview deploy: max_tokens is rejected in favor of max_completion_tokens, and Azure opens a stream with a chunk whose choices list is empty (content filtering), which raised IndexError and killed the answer mid-stream. Verified end to end against a throwaway Azure preview stack: Deploy succeeds, the llm service provisions via Azure AI Foundry with MODEL correctly wired to the "llm" deployment alias, and /v1/ask answers correctly on gpt-5.1. Stack has been torn down. Same fixes as #134, ported here so this PR is correct standalone regardless of merge order between the two. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MPfV4G82XiSnHVUhyqXzXv
Route53 cutover runbook for
|
Status updateRebased onto current Verified end to end against a throwaway Azure preview stackDeployed this branch's compose/deploy config to an isolated stack (not
With both fixed, Note: #134 (open, independent) found and fixed the same two bugs via its own preview-overlay approach, plus flagged two pulumi-defang defects (#536, #538, both merged). Worth deciding merge order between #130 and #134 — right now they'll conflict on Also found while verifying: even with pulumi-defang#538 (raise LLM deployment capacity to 10K TPM) merged, the actual deployed Still blocking a real (non-preview) DeployDefangLabs/defang-mvp#3225 is merged, but Route53 cutover runbook posted separately once the above lands and a real production deploy exists. |
Summary
Implements the AWS→Azure migration plan from #126, per Lio's answers
in that issue:
x-defang-dns-role(AWS-only) and switchdeploy.yamltoprovider: azurewithdefang-github-action's OIDC flow — nocloud-credential step needed, and the AWS-Bedrock "Ensure model
access" step goes with it.
llm'sx-defang-llmnow provisions a managed Azure AI Foundrydeployment instead of running the Bedrock gateway container, so
MODELbecomes the deployment alias ("llm") instead of a Bedrockmodel ID — Azure picks the actual model dynamically from its own
preference list at deploy time (no way to pin a specific
"haiku-quality" model there; see the note on the issue).
.defang/production, reusing the shared UAMIwebsitealreadyuses (client ID
6e15e174-...), same call as the website migration.Depends on
This is a draft because it needs DefangLabs/defang-mvp#3225 merged
and applied first — that PR adds the federated credential
(
repo:DefangLabs/docs-chatbot:environment:production) this identityneeds to trust this repo's
productionenvironment. Without it, theDeploystep will fail to get Azure credentials.Not included
explicit legacy suffix — this uses
project: docs-chatbot/stack: production(no-beta/-staging), so there's nothing left torename on the Azure side — it's a clean project name from day one.
If you meant something more (e.g. renaming the GitHub repo itself),
let me know on Deploy to Defang Azure subscription #126.
zones, so
ask.defang.ioneeds a manual Route53 A +asuidTXTrecord after the first successful deploy (root AWS account, same
shape as defang-mvp#3190). I'll post the exact runbook once this
merges and the first deploy exists.
Test plan
pulumi up --stack defangappliedDeploystep green)ask.defang.iowith whichever GPT model Azure picked)
🤖 Generated with Claude Code
https://claude.ai/code/session_hook-DefangLabs-docs-chatbot-c7fc