Self-host anfra Core
Get your anfra project online for your team and your coding agents in a few minutes, on any hosting provider.
Set up with a coding agent
Self-host this anfra project. Follow https://anfra.ai/docs/self-host.md. Ask me which host to use. Do the steps you can, and tell me which ones I need to do.Get your anfra project online in a few minutes. Add one file to your project, deploy it on any hosting provider, and you're live: your team opens your Data Apps in the browser, and your coding agents connect over MCP.
anfra works on any hosting provider. These guides walk you through some popular ones, step by step:
- Render (has a free plan, November 2026)
- Railway (has a free plan, November 2026)
- Fly.io (has a free plan, November 2026)
- DigitalOcean App Platform
- Heroku
- Google Cloud Run
- Azure Container Apps
- AWS (Lightsail containers)
- Your own server, with Docker Compose
Using another provider? Follow the general steps below.
Put your project on GitHub
Every host deploys your project from a GitHub repo. If yours isn't on GitHub yet:
-
Create a new repository on GitHub, empty: no README, license or
.gitignore. -
From your project's folder, push your project to it, with your repo's address:
git init git add . git commit -m "anfra project" git branch -M main git remote add origin https://github.com/<you>/<repo>.git git push -u origin main
anfra init doesn't set up git, but it already keeps .anfra/data_sources.yml out of it, so your database credentials stay on your machine.
Should you self-host?
Self-host when you want:
- A quick, free way to share your Data Apps with your team and your coding agents
- Full control over where anfra runs and when it updates
- anfra next to a database that only your own network can reach
However, you should be aware that there are tradeoffs associated with self-hosting anfra projects:
- Several anfra BI Cloud features, such as members with roles and a sign-in for each person's AI client, are not built in
- You need to handle security, monitoring, updates and upgrades on your own
Generic Docker deployment
Every host runs the ghcr.io/holistics/anfra-hosting image: anfra serve, the same server as on your machine, with a login in front when you want one. Details may differ, but these steps are required for all Docker deployments.
-
Add a
Dockerfileto 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 -
Keep
.anfra/data_sources.ymlout of git (it is gitignored by default). anfra connects to your database with the credentials in that file, and the container writes it when it starts, from theANFRA_DATA_SOURCESenvironment variable. -
Add environment variables
Env Var Purpose Required? ANFRA_DATA_SOURCESThe contents of your .anfra/data_sources.ymlYes* PUBLIC_URLThe address people open, for example https://data.example.com. Sign-in only works on this address.Yes LOGIN_USERSWho can sign in, as name:passwordpairs (details). Without it, or Google or GitHub sign-in, there is no login.- LOGIN_GOOGLE_*,LOGIN_GITHUB_*,LOGIN_ALLOWED_EMAILSSign-in with Google or GitHub accounts (details) - PORTPort the server listens on (default: 8080)- LOGIN_TITLETitle of the login page (default: anfra)- LOGIN_BACKGROUNDBackground of the login page: paper(default),ink, or the URL of your own image- * Unless the file is mounted at
/etc/secrets/data_sources.yml, or the project folder is mounted with its own file. A mounted file wins over the variable. -
Give the container at least 512 MB of memory and run a single instance. With more than one instance, sign-in breaks.
-
Start the server, with HTTPS in front and the health check path set to
/health
On your own server, mount the project folder instead of copying it into an image. See your own server.
Updates
Your anfra project
anfra serves the files of your project, and picks up new ones on its own. To update it, get your new files to where anfra runs: push them to your repo, and your host deploys them. Each host's page says how.
anfra
Your Dockerfile pins the anfra version. To move to the latest one, download it again from your project's folder, and push:
curl -fsSL -O https://raw.githubusercontent.com/holistics/anfra-hosting/main/Dockerfile
git add Dockerfile
git commit -m "Update anfra"
git pushYour host deploys it like any other push. Run anfra update too, so your CLI matches. To go back, run git revert HEAD and push.
Authentication
anfra serve has no built-in authentication. Put an authenticating proxy in front of it, so only signed-in people and agents reach your data.
The anfra-hosting image has a login built in. It turns on when you set LOGIN_USERS, or sign people in with Google or GitHub. With neither, anfra starts without a login, and anyone who can reach the address can use it: leave them out only when your own proxy controls access, such as Tailscale or Cloudflare Access. See Authentication.
Troubleshooting
https://<your-address>/health answers without a login, with anfra's status and version. If the container stops right after it starts, the last line of its logs starts with start.sh: and says what to fix:
| Message | What to do |
|---|---|
set PUBLIC_URL | Set PUBLIC_URL to the address people open. The login needs it. |
PUBLIC_URL needs a domain name | Use the address with its domain name, such as https://data.example.com |
set LOGIN_ALLOWED_EMAILS | List who can sign in with Google or GitHub |
set both ..._CLIENT_ID and ..._CLIENT_SECRET | Set the missing half of the Google or GitHub app |
LOGIN_USERS: '...' has no password | Each user looks like name:password. Look for a missing colon, or a comma inside a password. |
can't write ... data_sources.yml | Give uid 1000 write access to the project folder |
a process stopped | Read the lines above it for the cause |
anfra also warns without stopping: no login means you set no users and no Google or GitHub sign-in, and no database credentials means queries fail until you add them.
If your charts show errors, anfra can't reach your database. Check its IP allowlist and the credentials.