DEV Community

Cover image for How to install self-hosted agentes.chat on a Linux VPS
Fernando Chagas for Nuvits

Posted on Originally published at nuvits.net

How to install self-hosted agentes.chat on a Linux VPS

Self-hosting agentes.chat on your own Linux VPS gives you a private open-source (AGPL-3.0) workspace for AI agents with no license key and full control over your model credentials. In this guide you will deploy agentes.chat v0.1.12 with Docker Compose, PostgreSQL 18 + pgvector, the server itself configured as the agents' computer (browser and desktop), and automatic HTTPS via Tailscale (zero open ports) or Caddy on your own domain.

Every command, environment variable and container profile below was verified against the official v0.1.12 release of agentes-chat/agentes-chat (SELF_HOSTING.md, install.sh, docker-compose.yml and .env.example).

Debian vs. Ubuntu and how much RAM to pick

Two decisions before running the installer shape both security isolation and day-to-day stability: your Linux distribution and your memory budget.

Why Debian 12 or 13 is the recommended OS

agentes.chat supports both Debian and Ubuntu, but the agents' computer behaves differently on each:

  • Debian 12 or 13 (recommended): Debian's systemd includes BPF_FRAMEWORK, allowing system mode (--system) to isolate each agent in its own Linux user. One agent cannot read another agent's files or processes.
  • Ubuntu 22.04 or 24.04: works in simple mode, where all agents share a single unprivileged agentes user (without sudo).

RAM, vCPU and disk sizing

The official baseline is 2 vCPU, 4 GB of RAM and 20 GB of disk (the Docker image alone is roughly 2 GB). However, if you enable the agents' computer on the same VPS with live desktops and Google Chrome, 4 GB runs tight fast:

Linux VPS tier Practical headroom with agentes.chat Best fit
4 GB RAM · 2 vCPU Docker + Postgres 18 + agentes app with minimal browser use Quick evaluation or instances without a browser on the same server
8 GB RAM · 4 vCPU Full stack + agent desktops (~200 MB each) + Chrome browser (~600 MB open) Recommended sweet spot for daily use with the agent browser
12 GB+ · 6+ vCPU Concurrent agents, local builds, plus optional speech or embeddings Small teams or heavier repositories and local voice transcription

Watch the AGENTES_MEMORY cap. In a manual install using the official docker-compose.yml, mem_limit defaults to 8g via AGENTES_MEMORY (the interactive installer sets roughly three quarters of host RAM on machines under 10 GiB). On a 4 GB or 8 GB VPS shared with Postgres and Chrome, set AGENTES_MEMORY=2g or 4g in .env so the app container cannot starve the database or browser.

Architecture on a Linux VPS

By default, the official docker-compose.yml binds port 3000 to 127.0.0.1:3000 (loopback only) — never 0.0.0.0 — because Docker publishes ports through iptables past host firewalls like ufw. From there, you pick one entry profile in COMPOSE_PROFILES:

  • tailscale profile (default and safest): the tailscale container (v1.102.5, userspace networking TS_USERSPACE=true) joins your tailnet and serves real HTTPS at https://agentes.<your-tailnet>.ts.net with no custom domain and zero open ports on the public internet.
  • https profile (public domain): the caddy container (2.11.7-alpine) exposes only ports 80 and 443, obtains and renews a Let's Encrypt certificate, proxies HTTP and WebSockets, and serves an auto-reconnecting 503 page during restarts.

Architecture of self-hosted agentes.chat on a Linux VPS with private Tailscale access or public Caddy on ports 80 and 443, agentes container bound to 127.0.0.1:3000, Postgres 18 with pgvector and host agentes-runner with browser

Alongside the app and Postgres (pgvector/pgvector:0.8.7-pg18 with shm_size: 1gb), the compose file ships three optional profiles disabled by default: backup (automated dumps to R2/S3 with optional age encryption), speech (local CPU voice transcription) and embeddings (local cross-language semantic search).

Prerequisites

  • A 64-bit Linux VPS (Debian 12 or 13 recommended, or Ubuntu 22.04/24.04) with root SSH access and preferably 8 GB of RAM if you plan to run the agent browser.
  • Host firewall allowing 22/tcp (plus 80/tcp and 443 TCP/UDP only if you use a public domain with Caddy). If you use ufw with Docker, see The Docker port stays open with ufw.
  • For Tailscale: a free Tailscale account with MagicDNS and HTTPS Certificates enabled under console.tailscale.com/admin/dns.
  • For a public domain: a subdomain with a DNS A record pointing to your VPS IPv4 (chat.example.com).
  • At least one AI model API key (Claude, OpenAI, Gemini, DeepSeek, OpenRouter or another supported provider), entered later in the web UI.

Option 1: install with Tailscale (private HTTPS, no domain)

This is the fastest and safest setup for solo use or a small team: nothing listens on public HTTP/HTTPS ports.

1. Prepare Tailscale and create an auth key

In the Tailscale admin console:

  1. Install Tailscale on your own computer and sign in (verify it shows up at console.tailscale.com/admin/machines).
  2. Open console.tailscale.com/admin/dns, turn on MagicDNS and click Enable HTTPS under HTTPS Certificates.
  3. Open console.tailscale.com/admin/settings/keys and click Generate auth key. Leave Reusable and Ephemeral off, enable Pre-approved if shown, and copy the one-time key (tskey-auth-...).

2. Preview the installer plan and run it on the VPS

SSH into the VPS as root. You can inspect what the official installer will do first with --plan (dry run, makes no changes):

curl -fsSL https://agentes.chat/install | sh -s -- --plan
Enter fullscreen mode Exit fullscreen mode

Once verified, run the interactive setup:

curl -fsSL https://agentes.chat/install | sh
Enter fullscreen mode Exit fullscreen mode

The script ensures Docker Engine and Compose v2 (>= 2.23.1) are ready, fetches a SHA-256-verified Bun runtime and launches the setup wizard in /opt/agentes:

  1. Press Enter for Tailscale and paste your tskey-auth-... key.
  2. Press Enter to skip transactional email for now (or configure SMTP/Resend if you want email invites).
  3. Press Enter to configure this VPS as the agents' computer (installs agentes-runner, virtual desktop support and Chrome for agents).
  4. Choose whether to disable anonymous usage statistics.

The first run downloads roughly 2 GB and takes a few minutes. When it completes, it prints your private HTTPS URL and a QR code for the phone app:

◇  On your tailnet as agentes.tail1234.ts.net
◇  .env: PUBLIC_URL=https://agentes.tail1234.ts.net
◇  HTTPS certificate ready
◇  agentes.chat 0.1.12 is up
◇  Agents' computer: this machine
Enter fullscreen mode Exit fullscreen mode

Disable key expiry for the server in Tailscale. Tailscale node keys expire after 180 days by default, taking the server off your tailnet. Open console.tailscale.com/admin/machines, click the ⋯ menu on agentes and choose Disable key expiry.

Option 2: public domain with Caddy (automatic HTTPS)

If you want to reach your instance without installing Tailscale on client devices — or expose it on a company domain (https://chat.example.com) — use the built-in https profile with Caddy.

1. Boot on loopback and create the owner account first

One security rule matters before going public: the first account signed up becomes the instance owner and automatically closes open registration. Always create that owner account before exposing the domain.

Start the stack bound to 127.0.0.1:3000:

mkdir -p /opt/agentes && cd /opt/agentes
curl -fsSLO https://raw.githubusercontent.com/agentes-chat/agentes-chat/v0.1.12/docker-compose.yml
(umask 077 && printf 'AGENTES_IMAGE=ghcr.io/agentes-chat/agentes:0.1.12\nAGENTES_SECRET=%s\nPOSTGRES_PASSWORD=%s\nPUBLIC_URL=http://localhost:3000\n' "$(openssl rand -base64 48)" "$(openssl rand -hex 24)" > .env)
docker compose up -d
Enter fullscreen mode Exit fullscreen mode

From your local workstation, open a temporary SSH tunnel to port 3000:

ssh -N -L 3000:127.0.0.1:3000 root@YOUR_VPS_IP
Enter fullscreen mode Exit fullscreen mode

Open http://localhost:3000 in your browser, create the owner account and confirm the dashboard loads. Then close the SSH tunnel (Ctrl+C).

2. Enable the https Caddy profile in .env

Make sure the A record for chat.example.com points to the VPS IPv4 and ports 80/tcp and 443 (TCP/UDP) are open. Update /opt/agentes/.env to set your public URL and profile:

```ini .env
DOMAIN=chat.example.com
PUBLIC_URL=https://chat.example.com
COMPOSE_PROFILES=https




Apply the change so Caddy obtains the Let's Encrypt certificate and restarts `agentes` with the new `PUBLIC_URL`:



```bash
cd /opt/agentes
docker compose up -d
docker compose ps
Enter fullscreen mode Exit fullscreen mode

Leave TRUSTED_PROXIES unset with the bundled Caddy. The caddy service in the official compose file passes only the real client IP in X-Forwarded-For, which agentes trusts directly. If you run another proxy or Cloudflare in front and hit 502 or TLS errors, see Fix Caddy 502 Bad Gateway and HTTPS errors with Docker.

Verify health, pair your phone and add AI keys

Check on the VPS that the containers are healthy and /api/health responds on loopback:

cd /opt/agentes
docker compose ps
curl -fsS http://127.0.0.1:3000/api/health
Enter fullscreen mode Exit fullscreen mode

If you set up this VPS as the agents' computer, confirm the runner status:

agentes-runner status
Enter fullscreen mode Exit fullscreen mode

Then open your HTTPS URL in the browser:

  1. Add model API keys under Settings → AI and usage (Claude, OpenAI, Gemini, DeepSeek, OpenRouter, etc.). Keys are encrypted at rest with a key derived from AGENTES_SECRET and are never sent back to browsers.
  2. Pair the mobile app (optional): open Settings → Your account → Open on your phone and scan the QR code from the agentes.chat app (make sure Tailscale is connected on the phone if using a tailnet). That one-time sign-in token expires in 3 minutes — only show it to your own phone.
  3. Connect a desktop computer (optional): download the desktop app from /download on your instance, pick Use your own server and enter your HTTPS address.

Encrypted backups to S3/R2 and safe upgrades

A self-hosted agentes.chat instance consists of three things: the Postgres database, the files volume (/data/files) and AGENTES_SECRET in .env.

Store AGENTES_SECRET separately from database dumps. Restoring a dump without AGENTES_SECRET makes every stored model key, connector and mailbox credential unreadable; storing both together lets anyone with bucket access decrypt those keys.

Enable the built-in backup service (Cloudflare R2 or S3)

Create a private bucket for dumps only and add its credentials to /opt/agentes/.env:

```ini .env
S3_ENDPOINT=https://.r2.cloudflarestorage.com
S3_ACCESS_KEY_ID=your-access-key
S3_SECRET_ACCESS_KEY=your-secret-key
S3_BACKUP_BUCKET=agentes-backups
BACKUP_RETENTION_DAYS=14




To encrypt every dump before it leaves the VPS (optional and recommended), generate an [`age`](https://age-encryption.org) key pair **off the server** (`age-keygen -o key.txt`) and put only the public recipient key in `.env`:



```ini .env
BACKUP_AGE_RECIPIENT=age1your-public-key-here
Enter fullscreen mode Exit fullscreen mode

Add backup to COMPOSE_PROFILES (for example COMPOSE_PROFILES=tailscale,backup or COMPOSE_PROFILES=https,backup), reload Compose and run a first manual check:

cd /opt/agentes
docker compose up -d
docker compose run --rm backup now
docker compose run --rm backup list
Enter fullscreen mode Exit fullscreen mode

The backup service dumps only the PostgreSQL database (pg_dump). Uploaded files stored in the files volume (/data/files) need their own archive (unless you store attachments in an S3 bucket):

cd /opt/agentes
(umask 077 && docker compose run --rm --no-deps -T --entrypoint tar agentes czf - -C /data/files . > "files-$(date +%F).tar.gz")
Enter fullscreen mode Exit fullscreen mode

Upgrading without losing settings

Keep all configuration in .env (or a docker-compose.override.yml) instead of editing docker-compose.yml. For each new release on github.com/agentes-chat/agentes-chat/releases, take a dump first, download that release's docker-compose.yml, bump AGENTES_IMAGE in .env if pinned, and run migrations before starting the new container:

cd /opt/agentes
RELEASE=vX.Y.Z # replace with the target release tag
docker compose run --rm backup now # if the backup profile is enabled
curl -fsSLO "https://raw.githubusercontent.com/agentes-chat/agentes-chat/${RELEASE}/docker-compose.yml"
docker compose pull
docker compose run --rm agentes migrate
docker compose up -d
Enter fullscreen mode Exit fullscreen mode

Database migrations are forward-only: an older image refuses to start against a database already migrated by a newer build.

Four common pitfalls (and how to fix them)

Symptom / log error Root cause Fix
"Invalid origin" on sign-in or bad_origin on save PUBLIC_URL in .env does not match the exact scheme, host and port in the browser Update PUBLIC_URL (use the .ts.net hostname, not the 100.x IP) and run docker compose up -d
Live messages stop and WebSocket closes with 1006 External proxy strips WebSocket upgrades for /api/ws, /api/machines/connect, /api/desktop, /api/terminal or /api/machines/stream Use the bundled Caddy/Tailscale profile or forward Upgrade/Connection over HTTP/1.1 (read_timeout >= 60s)
extension "vector" is not available Plain Postgres image without pgvector Use pgvector/pgvector:0.8.7-pg18 from the official compose file (or install pgvector on external Postgres)
Agent reports Google Chrome failed to start Too little RAM (< 8 GB under browser load) or missing Chrome system libraries Check `dmesg -T \

Want to skip the manual setup?

If you prefer starting with Docker, Postgres 18 with {% raw %}pgvector, agentes.chat bound to 127.0.0.1:3000 and the agents' computer already provisioned on Debian 13 at first boot, Nuvits offers it preinstalled at no extra charge on VPS for agentes.chat — complete with a client-side command helper in the dashboard for Tailscale or Caddy HTTPS. Nuvits provides independent VPS hosting with the open-source project preinstalled and is not the official agentes.chat Cloud service.

Next steps


Originally published at https://nuvits.net/en/blog/install-agentes-chat-self-hosted-linux-vps

Top comments (0)