title: Run your own Slirc
crumb: Connect / Self-hosting
description: Run Slirc on your own server: what you need, the two containers, the Ergo oper, Caddy, and your first sign-in.
lead: Slirc runs as two containers on a private network behind Caddy. Bun serves the app, and Ergo handles chat. This guide takes you from a fresh Linux server to your first message.

The [Elastic License 2.0](https://www.elastic.co/licensing/elastic-license) lets you run Slirc for your own group. Hosting it for others requires permission from the author.

<div class="callout info"><h4><svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>Source coming soon</h4><p>The repository is private for now, so the clone step below won't work yet. We'll post on <a href="https://slirc.org/blog/">the blog</a> when the source opens.</p></div>

## What you need

- A Linux server with [rootless Podman](https://podman.io/docs/installation), [`podman-compose`](https://github.com/containers/podman-compose), [Git](https://git-scm.com/) and [just](https://just.systems/). Slirc runs on a 2 vCPU, 4 GB box with room to spare. The [Ergo](https://ergo.chat/) image `ghcr.io/bitbonsai/slirc-ergo:v2.19.1` ships for ARM64 and x86_64 under one tag; Podman picks the right one.
- A domain. Point `app.yourdomain` at the server. `docs.yourdomain` and the bare domain are optional.
- [Caddy](https://caddyserver.com/docs/install) on the host for TLS.
- A free [Resend](https://resend.com/) account to deliver sign-in links.
- Your own machine with Git and just for deploys. Deploys push a committed tree and reset the server checkout to that exact commit, so the server never holds uncommitted code.

## 1. Clone and set your host

On your machine:

```bash
git clone https://github.com/bitbonsai/slirc
cd slirc
```

Open `justfile` and set the SSH host, checkout path, and config directory at the top to your own values. Every recipe below uses them.

## 2. Config on the server

Slirc keeps secrets out of git. Two files live in the config directory on the server, both mode `0600`:

```bash
ssh yourserver
mkdir -p ~/.config/slirc && chmod 700 ~/.config/slirc
```

`~/.config/slirc/env` is the app's environment:

```bash
APP_HOST=app.yourdomain
OWNER_NICK=yournick
USERS_JSON={"yournick":"you@example.com"}
ERGO_OPER_USER=slirc-org
ERGO_OPER_PASS=another-long-random-password
RESEND_API_KEY=re_...
RESEND_FROM=Slirc <slirc@yourdomain>
VAPID_CONTACT=mailto:you@example.com
```

Optional keys: `GIPHY_API_KEY` for [GIPHY search](https://developers.giphy.com/docs/api/), `OPENROUTER_API_KEY` for the [help bot and natural-language reminders](/docs/bots), which reach every model through [OpenRouter](https://openrouter.ai), `HELP_ANSWER_MODEL` for the model that writes help answers (default `anthropic/claude-haiku-5.5`), `HELP_CLASSIFIER_MODEL` for the cheaper model that first sorts each message into a Slirc question, small talk, or off topic, `TYPESAFE_API_KEY` to do that sorting with [TypeSafe](https://typesafe.ai)'s Jev (the classifier then defaults to `jev-latest` instead of `xiaomi/mimo-v2.6-flash`; `TYPESAFE_BASE_URL` and `TYPESAFE_INPUT_PRICE_PER_BILLION` are optional), `HELP_MODEL` for reminders and the other helpers (default `xiaomi/mimo-v2.5`), `SLIRC_HELPERS` to pick which helpers run, as a comma list such as `help,remind` (unset runs `help`, `remind`, `poll` and `welcome`; `links` runs only when listed; an unknown name stops the app at start). To turn a helper on later, add its name and restart the app: it creates the helper's IRC account on start, and the helper joins channels as people add it, `SLIRC_HELPERS_ENABLED=false` to run none of them. `SLIRC_AGENTS_ENABLED=false` refuses agent pairing on the instance. `SLIRC_EMOJI_BUDGET_BYTES` caps the total bytes of custom emoji on the instance (default 104857600, which is 100 MB); each member can add 50 custom emoji per 24 hours. `TESTFLIGHT_URL` is the iPhone beta's public TestFlight link, in the form `https://testflight.apple.com/join/<code>`: signed-in, verified members see **Get the iPhone app** in More on a phone and in **Devices → Add your phone** on desktop. Unset, or any other link, hides it. The app counts the mail it hands to Resend per day and kind, and logs one line when a day's sent mail reaches `MAIL_DAILY_WARN` (default 80) and `MAIL_DAILY_LIMIT` (default 100), the free tier's daily cap. Bulk email invites stop at 75% of `MAIL_DAILY_LIMIT`, so sign-in emails still get through. Each instance counts only its own mail, so when several instances share one Resend key, split the account's daily limit between them. `bun scripts/mail-count.ts` in the app container prints today, the last 7 days and the month so far. Model names are OpenRouter ids; older bare names such as `mimo-v2.5` still work. `SLIRC_HELPER_DAILY_LIMIT` caps the model calls the help bot and natural-language reminders make for one account in 24 hours, both together (default 100); past it, help says to try again tomorrow and reminders take only the short forms. Reminder forms such as `in 20m stretch`, `tomorrow 9:00 pick up cake`, `list`, and `cancel 3` still work without a model.

The `welcome` helper sits in `#open-chat` and posts a G'day gif there once a day when `GIPHY_API_KEY` is set. The gif goes through Ergo like any message, so IRC clients see it too.

The app makes every IRC password from a key: 32 random bytes in a file outside `~/.config/slirc`, so a backup of that folder or of the database never holds anything that logs in to IRC. Create it once and keep a copy in your password manager, not next to the backups:

```bash
mkdir -p ~/.config/slirc-keys/org && chmod 700 ~/.config/slirc-keys
openssl rand -out ~/.config/slirc-keys/org/irc-key 32 && chmod 600 ~/.config/slirc-keys/org/irc-key
```

The app refuses to start without it. Never replace it while people use the instance: every IRC client on a password, and every bot, then needs a new password.

`~/.config/slirc/ergo.yaml` is Ergo's config. Start from the one in the repo:

```bash
scp ergo/ergo.example.yaml yourserver:~/.config/slirc/ergo.yaml
```

Then edit two things in it. Set `network.name` and `server.name` to your domain. Replace the password hash of the `slirc-org` oper with one for the `ERGO_OPER_PASS` you chose:

```bash
podman run --rm -it ghcr.io/bitbonsai/slirc-ergo:v2.19.1 ergo genpasswd
```

Keep `accounts.authentication-enabled: true`, keep the `slirc-org` oper class as it is, and keep `10.0.0.0/8` in `ip-limits.exempted`. Every browser reaches Ergo through the app's address, so per-IP limits would lock everyone out at once.

## 3. Caddy

Copy `caddy/slirc.caddy` to your Caddy sites directory and replace `slirc.org` with your domain and the checkout paths with yours. The app block is the one that matters:

```
app.yourdomain {
	handle {
		reverse_proxy 127.0.0.1:9010 {
			lb_try_duration 20s
		}
	}
}
```

Port 9010 is the app and binds to localhost only. Browsers reach IRC through the app's `/irc` relay, so Ergo needs no WebSocket listener. Reload Caddy.

## 4. Bootstrap

Back on your machine, with a clean tree:

```bash
just bootstrap
```

This pushes `main`, resets the server checkout to it, creates the `slirc-org` network and the three volumes, starts Ergo, then builds and starts the app. The app registers your account with Ergo from `USERS_JSON`, creates `#open-chat` and `#help`, and starts the helpers. Check it:

```bash
just status
just logs app
```

The first line you want in the log is `app listening on :8080`.

## 5. First sign-in

Open `https://app.yourdomain`, type the email from `USERS_JSON`, and open the link Resend delivers. That account is the owner and an admin, so it can create channels and invite people. Other people join by invitation; ordinary sign-in does not create an account for an uninvited address. Only a public instance (`SLIRC_MODE=public_playground`) signs up a new address from the sign-in form, and only while the day's mail count plus that day's signups is under `MAIL_DAILY_LIMIT` (`SIGNUP_DOMAIN_LIMIT`, default 30, caps new signups per receiving domain per hour); it also shows recent `#open-chat` messages to signed-out visitors at `/open-chat`. See [Getting started](/docs/getting-started).

## Day to day

```bash
just deploy          # tests, then rebuild and recreate the app; Ergo keeps running
just deploy-ergo     # recreate Ergo; the app keeps running
just deploy-docs     # publish the docs site, if you serve one
just logs ergo
```

`deploy` refuses to run if Ergo restarted underneath it, and `deploy-ergo` refuses if the app did.

## Backups

Three things hold state:

- `slirc-org-data`, the volume with the app's SQLite database (accounts, sessions, channel metadata, uploads).
- `slirc-org-ergo-data`, the volume with Ergo's history and account database.
- `~/.config/slirc/`, the two config files, which hold every secret.

Copy the config directory into private backup storage. Do not export a live database volume and assume the result is consistent: SQLite's WAL must be included in a transactionally consistent snapshot. Use SQLite's backup API for the app database and Ergo's SQLite history. A full Ergo account-store backup needs a separately authorized maintenance stop unless a supported live-backup method is available. With services stopped, `podman volume export` and `podman volume import` can back up and restore complete volumes.

Before upgrading, rehearse app schema migrations on a consistent snapshot, never the live database:

```sh
cd app
bun scripts/rehearse-migration.ts /private/backups/app.sqlite
```

The rehearsal runs migrations twice on a disposable copy, checks SQLite integrity, and verifies existing rows and account IDs stay unchanged. It does not run IRC provisioning or connect to production.

## History retention

The supplied Ergo config uses `history.restrictions.expire-time: 0s`: persistent messages do not expire automatically. Explicit message deletion still works. Existing installations must update their mounted config separately; changing the example does not change a running server. Ergo can apply this setting by rehash without restarting. Disabling expiry does not restore messages already purged under an earlier policy. Monitor disk usage and keep backups.

## When something is off

- **"Reconnecting…" in the browser after a burst of joins.** The `10.0.0.0/8` exemption is missing from `ergo.yaml`. Add it and `POST /v1/rehash` from inside the app container, or run `just deploy-ergo`.
- **`owner credentials are missing` on start.** `OWNER_NICK` is not a key in `USERS_JSON`.
- **`IRC key file /run/slirc-irc-key is missing` on start.** Create the key above; `SLIRC_IRC_KEY_PATH` names it for Compose.
- **Sign-in links never arrive.** Check `RESEND_FROM` is a verified sender on your Resend account, then `just logs app` for the send error.
- **Ergo logs `read ircd.yaml: is a directory`.** The `ergo.yaml` file was missing when the container started, and the bind mount created a directory in its place. Remove that directory, restore the file, recreate Ergo.
