# Self-hosting

Run AgenticMind in Docker, use PostgreSQL, scale with run workers, and keep data, keys and backups safe.

Source: https://glamorous-boar.cloudvent.net/self-hosting/

---

## One container

<CodeBlock language="bash" filename="terminal" showCopy={true}>

```
git clone https://github.com/taeefnajib/AgenticMind.git && cd AgenticMind
cp .env.example .env        # add your model keys
docker compose up --build   # http://localhost:8000
```

</CodeBlock>

The image (`infra/docker/Dockerfile`) builds the web IDE with Node 22, installs the Python workspace with uv on Python 3.11, and serves the API and the built IDE together with uvicorn on port 8000, as an unprivileged user. Data (SQLite database, uploaded files, vector collections, models, the secrets key) lives in the `agenticmind-data` volume at `/data`. A health check calls `/api/health`.

The port is published on `127.0.0.1` only, because sign-in is off by default. To serve other machines, set `AGENTICMIND_AUTH=required` and `AGENTICMIND_BIND=0.0.0.0` in `.env` (see the [exposure checklist](/security/#exposing-a-server-checklist)).

## PostgreSQL

<CodeBlock language="bash" filename="terminal" showCopy={true}>

```
# .env
AGENTICMIND_DATABASE_URL=postgresql+psycopg://agenticmind:agenticmind@postgres:5432/agenticmind

docker compose --profile postgres up --build
```

</CodeBlock>

SQLite is the zero-setup default; PostgreSQL is recommended for shared servers and required for several processes. The schema is created automatically (`create_all`); there are no Alembic migrations yet, so back up before upgrading.

## Run workers

<CodeBlock language="bash" filename="terminal" showCopy={true}>

```
docker compose --profile postgres --profile workers up --scale worker=3
```

</CodeBlock>

Workers run `agenticmind-worker`, claim runs from the database queue, and resume runs from any worker that stops or crashes. Set `AGENTICMIND_EMBEDDED_WORKER=0` on the API to leave execution to workers. All processes need the same database and data directory. See [Durable runs](/durable-runs/).

## Local Docker deployments from a container

The Deployment Center's Local Docker target runs `docker` itself; it is off by default (`AGENTICMIND_LOCAL_DEPLOY=1` to enable) and needs access to a Docker daemon.

## Sandboxed code from a container

The Code node's default `docker` sandbox needs a Docker daemon reachable from the API process. Without one, use `AGENTICMIND_SANDBOX=process` (trusted code only) or `off`.

## Backups

Back up together:

1. the database (SQLite file or PostgreSQL dump);
2. the data directory (uploaded files, embedded vector stores, keyword indexes);
3. the secrets key (`<data>/secret.key` or `AGENTICMIND_SECRET_KEY`). Without it, stored secrets cannot be decrypted.

Projects can also be backed up as canonical IR (Export IR) or continuously to GitHub (auto-push).

## Monitoring

`/api/health` for liveness, `/api/metrics` for Prometheus (set `AGENTICMIND_METRICS_TOKEN`), and OpenTelemetry trace export. See [Observability](/observability/).
