Skip to content

Infrastructure ​

pixel-phone runs on Azure Container Apps in the Pixelbar subscription (d150e252-e2f0-47fb-8a4a-c3f29e9aebd4), West Europe. Terraform lives in infra/:

StackApplied byWhat it holds
infra/bootstrapan Owner, by hand, onceresource groups, state containers, GitHub OIDC identities (ADR 0010)
infra/envs/deva maintainer, just tf-apply devone environment of modules/pixel-phone
infra/envs/proda maintainer, PIXEL_PHONE_APPLY_PROD=1 just tf-apply prodthe 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.

IdentityRoleScope
App (pixel-phone-ENV-app)Key Vault Secrets Userthe environment's vault
AppStorage Table Data Contributortables Calls and WebhookEvents
AppStorage Queue Data Message Senderqueue phone-events
AppStorage Blob Data Readercontainer media (it can't change recordings)
AppStorage Blob Delegatorthe account (to sign user-delegation SAS URLs)
Pixel (pixel-ENV-app)Storage Queue Data Message Processorqueue phone-events only
Each of maintainer_principal_idsKey Vault Administratorthe vault (just secrets-push)
Each of maintainer_principal_idsStorage Blob Data Contributorcontainer media (just media push)
Each of maintainer_principal_idsStorage Table Data Readerthe account's tables (reading Calls in the runbook)
Each of maintainer_principal_idsStorage Queue Data Readerqueue phone-events (peeking at events)
GitHub pixel-phone-github-ENVContributorresource group pixel-phone-ENV
GitHub pixel-phone-github-ENVStorage Blob Data Contributorstate 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.