anfra docsAlpha
Self-hostCloud providers

Self-host on DigitalOcean

Self-host anfra on DigitalOcean App Platform from a GitHub repo.

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 DigitalOcean. Follow https://anfra.ai/docs/self-host/digitalocean.md. Do the steps you can, and tell me which ones I need to do.

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

DigitalOcean App Platform builds the Dockerfile from a connected repo.

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

In the control panel: Create > App Platform, choose GitHub, select the project's repo and branch, and keep Autodeploy checked so pushes redeploy automatically. App Platform detects the Dockerfile automatically.

Before creating the app, set the instance size to at least 512 MB with 1 container, and the health check path to /health. Pick the region closest to your database.

3. Set environment variables

Add to the app's component, and click Encrypt for the first two:

  • LOGIN_USERS: who can sign in, as name:password pairs (details)
  • ANFRA_DATA_SOURCES: the contents of your .anfra/data_sources.yml
  • PUBLIC_URL: ${APP_URL}, which App Platform fills with the app's address

Your database credentials

Git leaves .anfra/data_sources.yml out, so ANFRA_DATA_SOURCES is how App Platform gets your database credentials. Skip it if your project only uses a DuckDB file in the repo.

Click Create App to deploy. No PORT variable is needed: App Platform provides one and the image binds to it automatically.

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 app's address at the top of its page, https://<app>.ondigitalocean.app. 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 the app's Runtime Logs. 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. If the logs show a YAML error in data_sources.yml, the line breaks in ANFRA_DATA_SOURCES were lost: write the value on one line in YAML flow style instead, for example {data_sources: {warehouse: {type: postgresql, ...}}}.

5. Connect your coding agent

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

claude mcp add --transport http anfra https://<app>.ondigitalocean.app/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

App Platform deploys it on its own, as long as Autodeploy is on.

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