anfra docsAlpha
Self-hostCloud providers

Self-host on Azure

Self-host anfra on Azure Container Apps with the az CLI.

Set up with a coding agent

Paste this prompt into your coding agent, and it helps you set this up.
Self-host this anfra project on Azure Container Apps. Follow https://anfra.ai/docs/self-host/azure.md. Do the steps you can, and tell me which ones I need to do.

You need your project on GitHub (how) and a Azure account.

Azure Container Apps builds the Dockerfile and runs it with HTTPS ingress. The image reads its address from Azure, so you don't set PUBLIC_URL.

1. Add a Dockerfile to your project

From your project's folder, run:

curl -fsSL -O https://raw.githubusercontent.com/holistics/anfra-hosting/main/Dockerfile \
  -O https://raw.githubusercontent.com/holistics/anfra-hosting/main/.dockerignore
git add Dockerfile .dockerignore
git commit -m "Add Dockerfile"
git push

2. Create the app

az containerapp up --name anfra --resource-group anfra --location <region> \
  --source . --ingress external --target-port 8080

This builds the image and creates the app. It doesn't start yet: it needs the variables from the next step.

3. Set secrets and variables

az containerapp secret set --name anfra --resource-group anfra --secrets \
  login-users='maria:a-long-password,agent:another-long-password' \
  data-sources="$(cat .anfra/data_sources.yml)"

az containerapp update --name anfra --resource-group anfra \
  --cpu 0.5 --memory 1Gi --min-replicas 1 --max-replicas 1 \
  --set-env-vars LOGIN_USERS=secretref:login-users ANFRA_DATA_SOURCES=secretref:data-sources

Your database credentials

Git leaves .anfra/data_sources.yml out, so this is how Azure gets your database credentials. If your project only uses a DuckDB file in the repo, leave out data-sources and ANFRA_DATA_SOURCES.

Exactly one replica keeps sign-in working and the app awake.

To let people sign in with Google or GitHub instead, or to use your own login such as Tailscale or Cloudflare Access, see Authentication.

4. Check that it works

Open the address that az containerapp show --name anfra --resource-group anfra --query properties.configuration.ingress.fqdn prints. You see a login page. Sign in with a user from LOGIN_USERS, and open one of your Data Apps: it shows your data.

If it doesn't start, read the logs with az containerapp logs show --name anfra --resource-group anfra. The last line starting with start.sh: says what to fix, see Troubleshooting. If your apps show errors instead of data, anfra can't reach your database: check your database credentials, and your database's IP allowlist.

5. Connect your coding agent

In Claude Code, with your address and the agent user's password:

claude mcp add --transport http anfra https://<your-address>/mcp \
  --header "Authorization: Basic $(printf 'agent:<agent-password>' | base64 | tr -d '\n')"

Ask it to list your datasets and run a small query. For other agents, see Coding agents with MCP.

Updates

Your anfra project

When you change your project, such as a new or edited Data App, model or dataset, commit it and push it:

git add .
git commit -m "Add the sales dashboard"
git push

If you created the app with --repo, Azure deploys it on its own. Otherwise, run the az containerapp up command from step 2 again.

anfra

Your Dockerfile pins the anfra version. To move to the latest one, download it again from your project's folder, and push it:

curl -fsSL -O https://raw.githubusercontent.com/holistics/anfra-hosting/main/Dockerfile
git add Dockerfile
git commit -m "Update anfra"
git push

It deploys like any change to your project. Run anfra update too, so your CLI matches.

On this page