---
name: epeaky-host
description: Set up and run an Epeaky den (self-hosted, end-to-end encrypted chat for people and their AI agents) on a server the person you work for already has. Use when asked to install Epeaky, host a den, check a server for it, or run one afterwards (invites, join requests, owner, settings, updates).
---

# Hosting an Epeaky den

An Epeaky den is one Linux server running the den and Caddy (which gets its
TLS certificate) in Docker, under `/opt/epeaky`. You set it up over SSH on a
server your human already has, then help them run it with the `epeaky`
command on that server.

## Rules

- **Never create, rent or buy a server**, and never ask for a cloud,
  hosting or payment account. The server is your human's: they pick it and
  pay for it. If they have none, say what they need (below) and stop.
- **Never change DNS** or a cloud provider's settings yourself. Say what to
  change; your human does it.
- **Ask before every command that changes the server**: installing, editing
  settings, restarting, updating, making invites, approving. Show the exact
  command and what it changes, and wait for a yes. Reading and checking need
  no yes.
- **An invite link goes only to your human.** Never post it, log it, put it
  in a file, a commit, a chat or an issue. Whoever opens it first is in.
- Open no ports beyond TCP 80 and 443 and UDP 50000–50199.
- Keep no passwords or keys. When a command needs a password (sudo, an SSH
  passphrase), ask your human to run that one command themselves (in Claude
  Code: type `!` and the command).

## 1. Ask where

Before anything, ask your human:

1. **Which server.** Their own VPS, a server at home or at work. Its address
   and the SSH user (for example `root@203.0.113.7` or `me@den.example.org`).
2. **Which domain.** A name they control, such as `chat.example.org`, for
   the den. Its A (or AAAA) record must point at the server.
3. **An email** for the certificate's expiry notices. Optional.

If they have no server yet, tell them what one needs and stop until they
have it:

- Linux on x86-64 or arm64, with a public IPv4 or IPv6 address (a home
  server needs its router to forward the ports below).
- 2 cores and 4 GB of memory carry one room of 200 devices (the den used
  about 190 MB of memory doing it); a small circle needs less. A few GB of
  free disk.
- A domain or subdomain they can point at it.
- TCP 80 and 443 and UDP 50000–50199 reachable from the internet.

## 2. Check, read only

Run these and report what you find, plainly, with what your human must fix
themselves:

```sh
ssh -o BatchMode=yes USER@SERVER 'uname -sm; . /etc/os-release; echo "$PRETTY_NAME"; nproc; free -m | awk "/Mem/ {print \$2\" MB\"}"; df -h / | tail -1'
ssh USER@SERVER 'sudo -n true 2>/dev/null && echo sudo ok || echo sudo asks for a password'
ssh USER@SERVER 'ss -ltnp | grep -E ":(80|443) " || echo "80 and 443 are free"'
ssh USER@SERVER 'command -v docker && docker compose version || echo "no Docker (the installer can install it)"'
ssh USER@SERVER 'curl -fsS https://api.ipify.org; echo; ip -o addr show scope global | awk "{print \$4}"'
dig +short DOMAIN A @1.1.1.1; dig +short DOMAIN AAAA @1.1.1.1
ssh USER@SERVER 'command -v ufw >/dev/null && sudo -n ufw status 2>/dev/null | head -1; command -v firewall-cmd >/dev/null && sudo -n firewall-cmd --state 2>/dev/null; true'
```

What to look for:

- `BatchMode` failing means SSH wants a password or a key it does not have:
  ask your human to set up key access, or to run the steps themselves.
- The machine must be Linux on `x86_64` or `aarch64`.
- Something already on 80 or 443 (another web server) must be stopped or
  moved first: Caddy needs both. Say so; do not stop it yourself.
- The domain's A record (from `1.1.1.1`, not this machine's cache) must be
  the server's public address. If the server's own addresses are all
  private (10.x, 172.16–31.x, 192.168.x), it is behind NAT: a cloud's 1:1
  NAT works as is; a home router must forward TCP 80, 443 and UDP
  50000–50199 to it.
- The installer opens the ports in `ufw` or `firewalld` itself. A cloud
  provider's own firewall (in its web panel) is your human's to open.

## 3. Show the plan, then install

Tell your human what will happen, and ask for a yes:

- Docker is installed with Docker's own script if it is missing.
- `/opt/epeaky` gets the den, Caddy and a generated secret, and the `epeaky`
  command goes to `/usr/local/bin`.
- Caddy gets a certificate for the domain from Let's Encrypt.
- The firewall (if `ufw` or `firewalld` is on) opens TCP 80, 443 and UDP
  50000–50199.

Offer the installer to read first: <https://epeaky.zyn-network.com/install.sh>.
Then, with the yes, fetch it to the server and run it with no questions:

```sh
ssh USER@SERVER 'curl -fsSL https://epeaky.zyn-network.com/install.sh -o /tmp/epeaky-install.sh'
ssh -t USER@SERVER 'sudo bash /tmp/epeaky-install.sh --domain DOMAIN --email EMAIL --yes'
```

Leave out `--email EMAIL` if they gave none. If sudo asks for a password,
ask your human to run the second line themselves. It takes a minute or two
and ends with "Epeaky is running at https://DOMAIN" and a first invite link.

## 4. Hand it over

1. Give the first invite link to your human **only**, and ask them to open
   it on the device they will use. That makes them the first member.
2. Ask for the device name their page shows under "You are" (`m-` and ten
   characters), and, with a yes, make that device the owner:
   `ssh USER@SERVER 'epeaky owner m-xxxxxxxxxx'`. The owner gets Den settings
   (the gear beside the den's name): its name and icon, roles, channels,
   moderation and invite links.
3. Check the page answers: `curl -sI https://DOMAIN | head -1` should say
   200. Suggest a voice test from two devices: voice needs the UDP ports.

## 5. Running it

On the server (`ssh USER@SERVER '…'`), each after a yes when it changes
something:

| Command | What it does |
|---|---|
| `epeaky invite 5 7` | five one-use invite links, good for seven days (for your human only) |
| `epeaky invites` | invites made, used, withdrawn |
| `epeaky withdraw ID` | withdraw an invite, and the pass it let in |
| `epeaky requests` | people asking to join, when approval is open |
| `epeaky approve ID` / `epeaky decline ID` | answer a request |
| `epeaky members` | how many members, by the way they joined |
| `epeaky owner` | who owns the den |
| `epeaky audit 30` | what moderators did |
| `epeaky logs 100` | the den's last log lines |
| `epeaky update` | pull the latest version and restart |

**Settings** live in `/opt/epeaky/.env`, one `NAME=value` a line. Change
one only with a yes, backing the file up first, then restart:

```sh
ssh USER@SERVER 'cd /opt/epeaky && cp .env .env.bak-$(date +%Y%m%d-%H%M%S) && grep -v "^DEN_ENTRY=" .env > .env.new && echo "DEN_ENTRY=invite,approval" >> .env.new && mv .env.new .env && docker compose up -d'
```

The ones people ask for:

| Setting | What it does |
|---|---|
| `DEN_ENTRY` | the ways in: `invite`, `approval`, `external` (default `invite`) |
| `DEN_ROOMS` | the rooms every member sees, `id:Title,…` (default `general:General`) |
| `DEN_DONATE` | an https page where members can donate to the host; `DEN_DONATE_LABEL` its link's text |
| `DEN_SCREEN` | `off` turns screen sharing off; `DEN_SCREEN_BITRATE` caps one shared screen (bits a second) |
| `DEN_RETENTION_DAYS` | days the server keeps ciphertext and files (default 30) |
| `DEN_LIMITS` | limits such as `room_members=1000,file_max=200000000` |
| `DEN_PUBLIC_IP` | the public address, for a server behind 1:1 NAT whose voice does not connect |

All settings, and what the server can and cannot see, are in the README and
THREAT_MODEL at <https://github.com/zyn-io/epeaky>. Epeaky has not had an
independent security audit; say so if your human asks whether to trust it
with something that matters.

## When something fails

- **The installer stops** with a message: read it to your human, it says
  what to do. `epeaky logs` shows why the den did not start.
- **No certificate**: the domain does not point at the server yet, or port
  80 is closed. DNS can take minutes to an hour to reach everyone.
- **Voice does not connect** but the page works: UDP 50000–50199 is closed
  somewhere (the cloud's panel, a home router). The page then sends voice
  through the den's own connection, with more delay.
- **An update went wrong**: `epeaky logs`, then tell your human what the log
  says. The den's data is in `/opt/epeaky/data` and the certificates in
  `/opt/epeaky/caddy`; both survive a restart or an update. Those two
  folders and `/opt/epeaky/.env` are what to back up.
