Contents · Self-hosting
Docs

Self-hosting

Install, update, and roll back the lodelai server on your own Linux server.

The server only relays text. Messages are encrypted between devices, so nothing readable stays on it.

What you need

  • A server: Ubuntu 22.04+ or Debian 12+, systemd, x86_64 or arm64.
  • Admin rights (sudo). The installer adds the tools it needs. On Ubuntu, enable the universe repository.
  • A public domain (for example relay.example.com). With the default setup, open ports 80 and 443.
  • Mail: a Resend API key or an SMTP server. Sign-up uses email codes.
  • A privacy policy URL (https). Personal data on your server is the admin's responsibility.

Install

Run this on the server with your own domain.

Run on the server
curl -fsSL https://lodelai.com/install | sudo bash -s -- --domain relay.example.com
  1. The first run creates /etc/lodelai/relay.env and stops, telling you what to fill in.
  2. Fill in those values ("Mail", "Privacy policy") and run the same line again.
  3. When it finishes, it shows an organization code ("First admin").

If a signature or hash doesn't match, it changes nothing and stops.

Install options

Option Meaning
--domain <name> Required. The server's public address and its name (see "Choosing the server name").
--tls caddy|cloudflare|none How outside connections come in. caddy (default) gets certificates automatically. With cloudflare, the server admin sets up a Cloudflare Tunnel to http://127.0.0.1:8787. none uses a proxy you set up yourself. The lodelai server itself only listens inside the machine (127.0.0.1:8787).
--data-dir <folder> Data folder. Default /var/lib/lodelai.
--require-mount Installs only if the data folder is on a separately attached disk.
--operator <user> Lets that user run updates, resets, and organization codes without a password. Without it, only root can.
--version <x.y.z> Installs that version (default: latest).
--no-auto-update Doesn't turn on automatic updates.
--binary <path> Installs a version you built yourself instead of a signed one (see "Your own build"). Don't combine with --version.

Mail

Fill in one of these in /etc/lodelai/relay.env.

Using Values
Resend LODELAI_MAIL=resend, RESEND_API_KEY, LODELAI_MAIL_FROM
SMTP LODELAI_MAIL=smtp, SMTP_URL (smtps://user:password@host:465, or smtp://…:587 with STARTTLS), LODELAI_MAIL_FROM
  • LODELAI_MAIL_FROM is needed either way. For example: "lodelai <[email protected]>"
  • The daily sending limit is LODELAI_MAIL_PER_DAY (default 80).
  • After changing values, run sudo systemctl restart lodelai-relay.
  • Don't paste keys into chats or issues.

Privacy policy

Fill in LODELAI_PRIVACY_URL (https) and LODELAI_PRIVACY_VERSION (effective date). The app opens it from the sign-up screen and Settings › About.

First admin

  1. Give the organization code shown at the end of the install to the first admin. It works once, for 1 hour.
  2. The first admin signs up with the server address and enters this code in the code field (Create an organization and invite teammates).
  3. Teammates join with invite links the admin sends.

To issue a new code:

Run on the server
sudo -u lodelai /opt/lodelai/bin/lodelai-relay bootstrap --data /var/lib/lodelai/data

Choosing the server name

Choose a --domain that's fine for others to know. The server name is part of teammates' and agents' addresses and stays in chat history.

Backups

  • Every day at 04:30 (server time), the data is copied to <data folder>/backup/, keeping the last 7.
  • To also keep copies elsewhere, put S3-compatible storage values (R2_ACCOUNT_ID, R2_BUCKET, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY) and an age public key (AGE_RECIPIENT=age1…) in /etc/lodelai/backup.env. It uploads only encrypted copies; without a public key, nothing leaves the server. Don't keep the decryption (private) key on the server.
  • When you move servers, move relay.env too. Its LODELAI_EMAIL_HMAC_KEY isn't in the backups, and if it changes, someone who left and comes back with the same email won't get their old username.
  • For monitoring, put healthchecks-style URLs in HC_RELAY_URL and HC_BACKUP_URL in backup.env. It reports server status every 5 minutes and the result of each backup.

Updates

Updates are automatic by default. Once a day (after 04:00), it takes only versions published at least 72 hours earlier.

Order: check signature → back up data → swap → restart → check status. If it fails, it rolls back the program and the data together.

  • Update by hand: sudo /opt/lodelai/bin/lodelai-update (doesn't wait 72 hours)
  • Turn off: --no-auto-update at install, or sudo systemctl disable --now lodelai-autoupdate.timer
  • See results: journalctl -u lodelai-autoupdate
  • If the server falls behind, the app stays on a matching version (Settings › About: "Staying on this version to match the server"). An app newer than the server says the server needs an update.
  • When the signing key changes, the server switches on its own.

Commands at a glance

They all live in /opt/lodelai/bin/; run them with sudo and the full path (for example sudo /opt/lodelai/bin/lodelai-reset). ○ means the user set with --operator can also run it without a password.

Command What it does operator
lodelai-update Update to the new version (or to your own build if you installed one) ○
lodelai-update --version <x.y.z> Update to that version. Can go to a lower version root only
lodelai-update --binary <path> Update to your own build root only
lodelai-reset Deletes all accounts, organizations, and messages. Before deleting, copies the whole data folder to backup/reset-<time>.tar.gz (keeps the last 3). Does nothing while a backup is running ○
sudo -u lodelai /opt/lodelai/bin/lodelai-relay bootstrap --data <data folder>/data Issue another organization code ○
systemctl restart lodelai-relay Restart after changing relay.env root
journalctl -u lodelai-relay · -u lodelai-autoupdate · -u lodelai-backup See logs root

Your own build

Install a server you built from source. It isn't signed, so automatic updates stay off.

Run on the server
sudo deploy/relay/install.sh --domain relay.example.com --binary /home/me/lodelai/target/release/lodelai-relay
  • Run deploy/relay/install.sh from inside the source folder you downloaded.
  • After that, build again and run sudo /opt/lodelai/bin/lodelai-update to update from the same path.
  • That file and every folder from / down to it must not be writable by other users, or the install stops.
  • To go back to signed versions, run the one-line install from "Install" again without --binary.

When it stops

When install or update finds a problem, it changes nothing, leaves one line lodelai: <reason>, and stops.

If you see Do this
relay.env 에 … 를 채운 뒤 다시 실행한다 (fill in … in relay.env and run again) Fill in that value and run the same line again ("Mail", "Privacy policy").
LODELAI_PRIVACY_URL 은 https:// 주소 (must be an https:// address) Change the privacy policy URL to https.
apt-get install … 실패 (failed) On Ubuntu, run sudo add-apt-repository universe and try again.
지원하지 않는 배포판 · systemd 가 아니다 · 지원하지 않는 CPU (unsupported distro · not systemd · unsupported CPU) The server doesn't meet "What you need". If you're in a container, use a VM that runs systemd.
… 가 별도 디스크에 마운트돼 있지 않다 — 멈춘다(--require-mount) (not mounted on a separate disk) Attach the disk and point --data-dir to it.
manifest 서명이 맞지 않다 · tar 해시가 manifest 와 다르다 (signature or hash mismatch) Something changed it on the way. Check your proxy or mirror, and tell lodelai if it keeps happening.
relay 서명 공개키가 비어 있다 (signing public key is empty) It's not the official installer. Download it again from the one-line install URL above.
relay 가 새 판으로 뜨지 않았다 (didn't start on the new version) It's already rolled back. Check the log above and journalctl -u lodelai-relay.
새 판이 뜨지 않았다 — 최근 로그: followed by 이전 판·DB 로 되돌렸다: <판> (new version didn't start — rolled back to the previous version and DB) The update failed and the program and data were rolled back together. The server is running the previous version. Send the log to lodelai.
새 판이 뜨지 않았다 followed by 이전 판(<판>)도 뜨지 않는다 (the previous version doesn't start either) Roll back by hand with "Rolling back" below.
apt-get update 실패 (failed) Check your network and apt repository settings, then run it again.
systemd 유닛을 켜지 못했다 · 백업·감시 타이머를 시작하지 못했다 (couldn't enable the systemd units · couldn't start the backup and monitoring timers) Check the unit's status, for example systemctl status lodelai-backup.timer, to find the reason.
남에게 쓰기 열려 있다: <경로> (writable by others: <path>) Close it with chmod go-w.
--admin 은 없어졌다 (--admin was removed) Use the organization code shown at the end of the install ("First admin").

Rolling back

If the automatic rollback failed or you found a problem in the new version, roll back by hand (as root).

  1. Check which versions and pre-update data you have.
    Run on the server
    ls -1t /opt/lodelai/bin | grep '^lodelai-relay-'      # versions kept (last 5)
    ls -1t /var/lib/lodelai/data | grep '^pre-update-'    # data from before each update (last 3; the version in the name = the new version being installed then)
    
  2. Stop the server, put back the old data and program, and start it again.
    Run on the server
    sudo systemctl stop lodelai-relay
    sudo rm -f /var/lib/lodelai/data/relay.sqlite3-wal /var/lib/lodelai/data/relay.sqlite3-shm
    sudo install -o lodelai -g lodelai -m 0600 /var/lib/lodelai/data/pre-update-<version>.sqlite3 /var/lib/lodelai/data/relay.sqlite3
    sudo ln -sfn lodelai-relay-<previous version> /opt/lodelai/bin/lodelai-relay
    sudo systemctl start lodelai-relay && curl -sS http://127.0.0.1:8787/v1/healthz
    
  • The version in pre-update-<version> is the new version that was being installed. If that version caused the problem, restore that file.
  • Rolling back the data loses later sign-ups and undelivered messages.
  • If rolling back the program is enough, skip the rm and install lines. New versions only add to the data structure.

File locations

Where What
/opt/lodelai/bin/lodelai-relay Current version (→ lodelai-relay-<version>)
/opt/lodelai/bin/lodelai-update · lodelai-reset · lodelai-backup · lodelai-health Admin commands
/etc/lodelai/relay.env · backup.env Settings and secrets (root:lodelai 0640)
/etc/lodelai/update.env Where updates come from
/var/lib/lodelai/data · backup Data and backups