# Self-hosting requirements

> Servers, virtualisation, ports, DNS and sizing you need to run Teemli on your own infrastructure.

Source: https://docs.teemli.com/self-hosting/requirements/

:::note[Available when the source is public]
Teemli's source code isn't public yet; it will be released under the Apache-2.0 licence. These requirements describe what Teemli Cloud runs on today, to help you plan. Install steps will come with the release.
:::

## Servers

| Server | Runs | Starting size |
|---|---|---|
| **App** | Caddy, api, worker, Postgres ×3, Kafka, Redis, Keycloak, OpenBao, monitoring | 4 vCPU, 8 GB RAM, 100 GB disk is enough to start; 8 vCPU and 32 GB gives room to grow |
| **Computers** | E2B and the agent computers (Firecracker microVMs) | 4 vCPU, 32 GB RAM, 100 GB disk, **with KVM** |
| **Calls** (optional) | LiveKit | 4 vCPU to start, with good bandwidth |

All servers run Linux on x86_64 with Docker and Docker Compose. Teemli Cloud uses Ubuntu 24.04.

## The computers server needs KVM

Each agent computer is a Firecracker microVM, which needs hardware virtualisation (`/dev/kvm`). On a cloud VM, that means **nested virtualisation** must be available and switched on. Check with your provider: not every VM type offers it.

How many computers fit:

- An **awake** computer uses about 2 GB of RAM. On a 32 GB server, about 8 can be awake at once.
- An **asleep** computer uses only disk: its memory is saved and it resumes in a fraction of a second. Computers sleep after 5 idle minutes, so one server holds many more people than are awake at once.
- Add computers servers as more people need computers.

:::caution[Development only]
For trying Teemli on a laptop without KVM, there's a Docker-based computer driver. It's for development: containers don't isolate code as strongly as microVMs, so don't use it for real users.
:::

## Network and ports

| Server | Open to | Ports |
|---|---|---|
| App | The internet | 80 and 443 (TCP and UDP) for HTTPS; 25 for inbound mail to AI employees and routines |
| Computers | The app server only (private network) | E2B's API ports; SSH for you |
| Calls | The internet | LiveKit's signalling port and UDP media ports |

Keep the computers server off the internet entirely, apart from its own outbound traffic. Computers' outbound traffic goes through Teemli's own filter, which blocks private network ranges.

## DNS

Teemli uses one domain setting, from which it derives three names:

| Name | For |
|---|---|
| `app.<your domain>` | The web app |
| `api.<your domain>` | The API and WebSockets |
| `auth.<your domain>` | Sign-in (Keycloak) |

For email to reach AI employees and routines, add **MX** records for `agents.<your domain>`, `*.agents.<your domain>` and `in.<your domain>`, pointing at the app server. For outgoing email, set up SPF, DKIM and DMARC with your email provider.

## Sizing for a larger organisation

A rough estimate for about 1,000 people, once components move to their own servers:

| Part | Estimate |
|---|---|
| api and worker | 16–32 vCPU in total, 32–64 GB |
| Postgres | 8–16 vCPU, 32–64 GB, fast disk |
| Kafka, Redis, OpenBao, Keycloak, monitoring | About 16 vCPU in total |
| E2B control plane | About 8–12 vCPU, 16–32 GB |
| Computer hosts | About 1,050 computers with 10–20% awake at peak: 200–450 GB RAM in total |
| LiveKit | 1–2 servers of 16 vCPU with good bandwidth, for about 50 calls at once |

No code changes are needed to split components out: the containers already talk over the network.

## Operations to plan for

- **Unsealing OpenBao** after every restart, with 3 of its 5 key shares.
- **Backups:** nightly database dumps plus continuous write-ahead-log archiving to object storage, encrypted. Test a restore regularly.
- **Disk encryption** for the app server's data volume.
- **Updates:** database migrations are forward-only; check before rolling back across one.
