Infrastructure
pixel-phone runs on Azure Container Apps in the Pixelbar subscription (d150e252-e2f0-47fb-8a4a-c3f29e9aebd4), West Europe. Terraform lives in infra/:
| Stack | Applied by | What it holds |
|---|---|---|
infra/bootstrap | an Owner, by hand, once | resource groups, state containers, GitHub OIDC identities (ADR 0010) |
infra/envs/dev | a maintainer, just tf-apply dev | one environment of modules/pixel-phone |
infra/envs/prod | a maintainer, PIXEL_PHONE_APPLY_PROD=1 just tf-apply prod | the same module, with phone.pixelbar.nl and Key Vault purge protection (ADR 0011) |
CI validates every stack and plans dev on pull requests that touch infra/ (terraform.yml). prod is planned by a maintainer (just tf-plan prod): Environment prod deploys from main only and needs an approval. Nothing applies from CI.
One environment
flowchart LR
telnyx[Telnyx] -- webhooks --> app
ha[Home Assistant] -- accept API --> app
pixel[Pixel] -- accept API --> app
subgraph rg["pixel-phone-ENV"]
app["Container App<br/>pixel-phone-ENV<br/>1 replica, always warm, port 3000"]
kv["Key Vault<br/>pixel-phone-ENV-kv"]
subgraph st["Storage account (Azure AD only)"]
tables["Tables<br/>Calls, WebhookEvents"]
queue["Queue<br/>phone-events"]
media["Blob container<br/>media"]
end
logs["Log Analytics"]
end
app -- secrets --> kv
app -- read/write --> tables
app -- send --> queue
app -- read, sign SAS --> media
pixel -- poll and delete --> queue
telnyx -- SAS URL --> media
app --> logs
Who can reach what
The storage account has shared keys off, so every data access needs an Azure AD role. Contributor on the resource group (which the GitHub identity has) can't read any data.
| Identity | Role | Scope |
|---|---|---|
App (pixel-phone-ENV-app) | Key Vault Secrets User | the environment's vault |
| App | Storage Table Data Contributor | tables Calls and WebhookEvents |
| App | Storage Queue Data Message Sender | queue phone-events |
| App | Storage Blob Data Reader | container media (it can't change recordings) |
| App | Storage Blob Delegator | the account (to sign user-delegation SAS URLs) |
Pixel (pixel-ENV-app) | Storage Queue Data Message Processor | queue phone-events only |
Each of maintainer_principal_ids | Key Vault Administrator | the vault (just secrets-push) |
Each of maintainer_principal_ids | Storage Blob Data Contributor | container media (just media push) |
Each of maintainer_principal_ids | Storage Table Data Reader | the account's tables (reading Calls in the runbook) |
Each of maintainer_principal_ids | Storage Queue Data Reader | queue phone-events (peeking at events) |
GitHub pixel-phone-github-ENV | Contributor | resource group pixel-phone-ENV |
GitHub pixel-phone-github-ENV | Storage Blob Data Contributor | state container pixel-phone-ENV |
Maintainers are listed by name in each environment's maintainer_principal_ids (in the env's terraform.tfvars, shared with just pull / just push), not taken from whoever runs Terraform, so an apply from any laptop agrees. To add one, add their Entra ID object ID there, push and apply. Add them to terraform.example.tfvars too, so CI's plan of dev matches.
Images
The Container App is created from container_image, then Terraform ignores the image. Deploys swap it with az containerapp update (ADR 0003). dev was created with a placeholder (traefik/whoami, told to listen on port 3000) and has run pixel-phone since the first deploy (#6). prod is created from :main; after that only the Release workflow (or just rollback prod) changes its image.
Custom domains
custom_domains binds a hostname with a free managed certificate (prod: phone.pixelbar.nl). DNS is outside Azure, so its CNAME and asuid TXT records are made by hand before the hostname is listed (infra/envs/prod/README.md). domain.tf attaches the hostname, issues the certificate and binds it in one apply, through hostname.sh as spacestate does, so that apply needs the az CLI.