Skip to content

Install a community server

Run your own Tusile community on your own machine. You need Docker and Docker Compose, nothing else: one script sets up the rest.

The bundle is a normal Compose stack of five containers: the community server, Postgres, Caddy for HTTPS, LiveKit for voice and video, and a small livekit-cert-sync sidecar that hands Caddy’s certificate to LiveKit.

Download community-server.zip

This is the only choice that changes what you need. Everything after it is the same either way, and the setup script asks you which one you want.

Cloud Offgrid
Accounts Tusile accounts usernames and passwords that exist only on your server
Contacts tusile.com yes never, from either the server or the app
You need a server token created in the app, and a public hostname any address the app can reach, a LAN IP such as 192.168.1.50 included
Listed in the app’s server list yes no

No hostname yet? Duck DNS, No-IP and FreeDNS all hand out a free subdomain you point at your server’s IP. Offgrid does not need one: the script sets up a local certificate for whatever address you give it, and the app asks you to confirm that certificate the first time you connect.

Self-hosting either way means your community’s messages live on hardware you control; see where Tusile stands on EU Chat Control.

  1. Unpack community-server.zip.

  2. Run the setup script in the community-server folder.

    Double-click setup.bat.

  3. At Choice [1]: pick 1 for Cloud or 2 for Offgrid, then answer the prompts. Cloud asks for your server token, which you get by creating a server in the Tusile app.

    The script generates LiveKit keys, writes .env and the Caddyfile, configures HTTPS and TURN/TLS, and starts the stack.

  4. Open the ports it prints (see Ports to open).

  5. Connect from the app.

The script is safe to re-run. If the stack does not come up, it prints the failing container’s logs and you run it again. It does the same steps you would do by hand, and you are welcome to read it first.

Text chat works as soon as setup finishes. Voice can lag around six minutes behind on a first run with a public domain: LiveKit will not start without its TURN certificate, Caddy has to obtain that from Let’s Encrypt first, and the livekit-cert-sync sidecar copies it across on a five-minute cycle. LiveKit restart-loops until then. That is expected, and it fixes itself.

Terminal window
docker compose logs -f livekit

Cloud: your server appears in the app’s server list. Sign in with your Tusile account and open it.

Offgrid: the server starts with no accounts at all, so setup prints a one-time owner claim token when it finishes:

OWNER CLAIM TOKEN 4f8c-2a91-ee03-7b1d-a52f-91c4-3e07-d6b8
Valid 24h, single use.
  1. Turn the Offgrid toggle on, on the sign-in screen or at the top of the server rail.

  2. Enter your server’s address and press Connect. Use the same address you gave the script: a certificate issued for 127.0.0.1 is not valid for localhost, and the connection fails if the two disagree.

  3. Choose Create account, pick a username and password, and paste the claim token.

That first account becomes the owner and gets the Admin role. The token is then spent, and everyone else joins with an invite you create from the app. New Offgrid servers are invite-only by default; you can switch that to open or closed in Server settings.

It stays on the data volume until it is used, so you can read it again at any time. No output means the server has already been claimed.

Terminal window
docker compose exec -T community-server cat /app/data/owner_claim_token

If it expired, or the server was claimed by the wrong account, clear the owner and restart. A fresh token is issued on the next boot. This needs shell access to the machine, which is the point.

Terminal window
docker compose exec postgres psql -U tusile_community -d tusile_community \
-c "UPDATE server_settings SET owner_user_id = NULL"
docker compose restart community-server
Terminal window
docker compose ps # five containers, each up or healthy
curl https://your-domain/health # {"status":"ok"}
curl https://your-domain/info # Offgrid: "offgrid": true, plus claim_available

Then join from the Tusile app and try text and voice in one channel. If something is wrong, Troubleshooting lists the usual causes by symptom.

To prove an Offgrid server really is standalone, block outbound traffic to api.tusile.com and confirm nothing breaks. docker compose logs community-server | grep -i tusile.com should stay empty.

The setup script prints this list when it finishes. Open these ports on your router or firewall and forward them to the machine. A LAN-only Offgrid server needs nothing forwarded.

Port Why
80/tcp, 443/tcp Caddy: the community API, and the Let’s Encrypt challenge. Port 80 is not optional on Cloud.
7880/tcp LiveKit WebSocket, through Caddy.
7881/tcp LiveKit ICE/TCP fallback.
50000-50060/udp RTP media. Required for voice and video.
3478/udp TURN/UDP and STUN. Helps clients behind strict firewalls.
5349/tcp TURN/TLS. Setup enables it and livekit-cert-sync feeds it the certificate, so just open the port. Without it, people on UDP-blocked or symmetric-NAT networks get one-way audio.

Port 9090 is also published on the host for direct access to the community API. With Caddy in front, 80 and 443 are the main entry. The media range holds about one port per simultaneous voice user; to widen it, see LIVEKIT_RTP_PORT_START in the configuration reference.

If you cannot forward ports (your ISP uses CGNAT, or the router is not yours), or you would rather members never see your home IP, put a small VPS in front. A WireGuard tunnel links the VPS to the machine running the stack, the VPS forwards the ports above through it, and your home network opens nothing. It works for Cloud and Offgrid alike.

  1. Bring up WireGuard between the two machines. The examples below use 10.8.0.1 for the VPS and 10.8.0.2 for your machine, on the tunnel.

  2. Point your hostname at the VPS public IP, and give setup that hostname.

  3. On the VPS, allow the ports from the table above in its firewall and forward them into the tunnel (eth0 is the VPS’s public interface):

    Terminal window
    sysctl -w net.ipv4.ip_forward=1
    iptables -t nat -A PREROUTING -i eth0 -p tcp -m multiport --dports 80,443,7880,7881,5349 -j DNAT --to-destination 10.8.0.2
    iptables -t nat -A PREROUTING -i eth0 -p udp -m multiport --dports 3478,50000:50060 -j DNAT --to-destination 10.8.0.2

    Put these in the VPS’s WireGuard config as PostUp lines so they survive a reboot.

  4. Send the replies back the same way. The simplest route is iptables -t nat -A POSTROUTING -o wg0 -j MASQUERADE on the VPS, but then every member reaches your server from 10.8.0.1 and they all share its per-IP rate limits. That is fine for a group of friends. For a bigger community, skip the masquerade and set AllowedIPs = 0.0.0.0/0 for the VPS peer on your machine instead, so its traffic leaves through the tunnel and members keep their own addresses.

  5. Tell LiveKit to advertise the VPS. It finds its public IP by asking from your machine, which returns your home address, not the VPS. In livekit.prod.yaml set node_ip: <VPS public IP> and use_external_ip: false, then run docker compose restart livekit. If you skip this, text works and voice connects, but nobody hears anything.

Tunnel services that forward only HTTP(S) cannot carry the UDP media ports, so text chat works through them but voice does not.

Every answer can also be given as a flag, so nothing prompts. This is the path for cloud-init, CI and fleets. Supply the mode, the hostname, and for Cloud the token; the “Press Enter to start” gate is then implied.

Terminal window
./setup.sh --offgrid --hostname chat.example.com --yes
./setup.sh --cloud --token YOUR_TOKEN --hostname chat.example.com --yes
./setup.sh --help
Flag What it does
--offgrid / -Offgrid Standalone server with local accounts.
--cloud / -Cloud Tusile accounts; needs a token.
--token / -Token The server token from the app. Implies Cloud.
--hostname / -HostName The domain (or, for Offgrid, a LAN IP) the server is reached on.
--yes / -Yes Skip the “Press Enter to start” gate.
--force / -Force Allow a Cloud install on a host Let’s Encrypt cannot issue a certificate for. Almost always a mistake.

Check the exit code rather than parsing the output:

Code Meaning
0 The stack is up and serving.
1 Bad arguments, or a host a Cloud install cannot work on.
2 The stack did not come up. The failing logs are printed, and re-running is safe.

For a full cloud walkthrough (instance sizing, firewall rules, Docker via cloud-init, teardown), see Host on AWS EC2.

The setup script only writes config files, so you can write them yourself.

  1. Unpack the archive:

    Terminal window
    unzip community-server.zip
    cd community-server
  2. Create your .env from the template:

    Terminal window
    cp .env.example .env

    The bundle deliberately ships no .env: an existing one is how the setup script recognises a previous install, and a ready-made file made every fresh install look like an upgrade.

  3. Generate a LiveKit key pair and put it in .env as LIVEKIT_API_KEY and LIVEKIT_API_SECRET:

    Terminal window
    docker run --rm livekit/livekit-server generate-keys

    There is no default, and the stack will not start without them. Compose hands the pair to LiveKit as LIVEKIT_KEYS, which replaces the keys: block of livekit.prod.yaml, so leave that block as it ships.

  4. Set the rest of .env:

    • COMMUNITY_PUBLIC_URL: your server’s public URL, such as https://chat.example.com. Required in both modes.
    • Cloud: SERVER_TOKEN, the token from the app.
    • Offgrid: OFFGRID_MODE=true, and leave SERVER_TOKEN empty.

    Everything else has a working default. Every variable is in the configuration reference.

  5. Edit the Caddyfile: replace community.example.com with your domain in both site blocks. Caddy obtains TLS certificates automatically.

  6. Enable TURN/TLS (recommended): in livekit.prod.yaml uncomment tls_port, domain, cert_file and key_file, and set domain to your hostname. The livekit-cert-sync container then supplies the certificate from Caddy, for the host of COMMUNITY_PUBLIC_URL (set TURN_DOMAIN only to override it).

  7. Enable voice presence events (recommended): in livekit.prod.yaml uncomment the webhook: block and set its api_key to your LIVEKIT_API_KEY. That is how the server learns who joined or left a voice channel.

  8. Start the stack:

    Terminal window
    docker compose up -d

Let’s Encrypt will not issue for an IP address, so Caddy has to use its own certificate authority. Do not use a bare tls internal: the app pins the certificate fingerprint, and the default internal certificate lives only 12 hours, so the connection breaks after the first renewal. The exact stanzas, and why the web app cannot use a self-signed server at all, are in App says the certificate changed.

Each Caddy site block gets its own certificate, matched by name. A block for 127.0.0.1 will not answer for localhost: it aborts the handshake rather than presenting anything. Connect using exactly the address you configured, or list both names on the block.

There is no migration. Offgrid is for new installs: existing members are identified by their Tusile account, and on an Offgrid server there is nothing local to map them onto.

To run Offgrid on the same machine anyway, start a fresh install next to the old one. Bring the old stack down first and move its .env aside:

Terminal window
cd community-server
docker compose down # volumes are kept
mv .env .env.cloud # keeps the old project name on record
./setup.sh --offgrid --hostname chat.example.com --yes

Both steps matter. Setup keeps the Compose project name of an existing .env, so re-running it in place would point the Offgrid server at the Cloud database; with no .env it treats the run as a new install and picks a fresh name (community-offgrid-<hash>). And once the old .env is gone, Compose no longer knows that project, so a stack you did not bring down first keeps running and the new one cannot bind ports 80, 443 or 7880.

The Offgrid stack starts with an empty database. The old volumes stay on disk until you remove them with docker volume rm. To go back, bring the Offgrid stack down and restore .env.cloud as .env.

The community-data volume holds community_key on an Offgrid server: the signing key the server’s identity is derived from. Losing it is far worse than losing a Cloud server’s install ID. Back it up together with the database and uploads, as described in Backup and restore.

Do not change COMPOSE_PROJECT_NAME on a running deployment. It prefixes every volume name, so changing it silently orphans your database and your uploads.

To move to a newer server version, see Upgrades.