墨kazokuai.dev

Install Sumi

Sumi is one container: a Node server with SQLite, its own members and its own data, all of it in one folder you choose. This guide is for any operator on any Docker host. Every <placeholder> is yours to fill in.

1. The image

Build it from the repo (Node and the toolchain stay inside the build; the host needs only Docker 23 or later, whose BuildKit builder the Dockerfile needs — on an older one, DOCKER_BUILDKIT=1 docker build …):

git clone <the repo's address> sumi && cd sumi
docker build -t sumi:<version> -t sumi:latest .

Or load a release image someone built for you:

docker load -i sumi-<version>.tar     # it brings sumi:<version> and sumi:latest

The image runs as user and group 99:100, listens on 8395 and keeps everything under /data. It has a health check on /api/health.

2. The folder

Pick a folder on the host for Sumi's data — the database, the two toml files, projects, the library and music — and give it to 99:100:

mkdir -p <data folder>
chown 99:100 <data folder>

If the container stops at boot with sumi: /data must be owned by 99:100 (chown 99:100), that chown is the fix.

3. The container

One container, one bind mount, one port:

docker run -d --name sumi --restart unless-stopped \
  -p 8395:8395 \
  -v <data folder>:/data \
  sumi:latest

Or as compose:

services:
  sumi:
    image: sumi:latest
    container_name: sumi
    ports:
      - "8395:8395"
    volumes:
      - <data folder>:/data
    restart: unless-stopped

4. First boot: the two toml files

On its first boot Sumi writes config.toml and secrets.toml into the folder (mode 600), every key at its default with a comment above it, and logs one line naming them (docker logs sumi). From then on you edit the keys in place — the file already holds every key; never append: change a value where it stands, or uncomment its line and fill it in. A line added to the end of a file is a second copy of a key (a boot error) or, in secrets.toml, which ends with a section Sumi writes when it pairs, a key inside that section. Every value is a quoted string. Restart the container after an edit (docker restart sumi).

config.toml

secrets.toml

5. Setup

Open http://<host>:8395. With no member yet Sumi shows the setup page: the first member you make is the admin. Each member gets a name and a hue, their colour across the app.

6. A public address

To reach Sumi from outside your network, put it behind a reverse proxy or a tunnel that serves it over HTTPS at an address of your own, https://<your domain>, forwarding to http://<host>:8395. The proxy must pass the visitor's scheme in X-Forwarded-Proto and the visitor's address in CF-Connecting-IP (Cloudflare's proxy and tunnel send both; with another proxy, have it overwrite that header with the client's address — never pass one through from the client). Sumi reads CF-Connecting-IP only from a connection that comes from loopback or the Docker bridge's gateway, with Sumi on Docker's default bridge network: a proxy or tunnel connector in a bridge container that reaches Sumi at the host's published port, or one on the host itself that reaches it at http://localhost:8395. A proxy that reaches Sumi by its container name over a shared network, or from another machine, isn't trusted: the header is ignored (Sumi's log says so, once an address) and every visitor shares the proxy's one address in the sign-in throttle — unless you name that address in config.toml's trusted_proxies = ["<the proxy's address>"], which adds to loopback and the gateway (empty, the default, is those two only). Turn off anything at the proxy that rewrites HTML or injects scripts: Sumi's game frames run under a policy with no inline script.

Then set, in config.toml:

public_origin = "https://<your domain>"

and restart. With an https:// public origin Sumi knows it is behind the proxy: a request that came in over HTTPS gets a Secure cookie and HSTS, the sign-in throttle counts each visitor by their CF-Connecting-IP address (without the header it counts the proxy's address, so every visitor would share one limit), and Sumi names itself by that origin when it pairs with another app. On your own network http://<host>:8395 keeps working as before.

Check it from outside your network:

curl -s https://<your domain>/api/health     # {"ok":true,"version":"…","origin":"https://<your domain>"}

The origin it shows must be exactly the address your members type. Set public_origin before you pair Sumi with another app; a pairing keeps the address it was made with.

On a phone, opening https://<your domain> and choosing Add to Home Screen (iOS) or Install app (Android) installs Sumi as an app.

7. Updates and backups

A new version is a new image: build or load it, then recreate the container with the same -v and -p (the folder keeps everything). Before an update, stop the container and copy the folder somewhere safe; sumi.db with its -wal and -shm files, the two toml files and the projects, library and music folders are the whole of Sumi's state.