Docs / Hosting OwnBase

A Linux server with systemd

The server runs straight from Node, without Docker, as a systemd service. systemd starts it with the machine, starts it again if it stops, and keeps its log. These steps use Ubuntu 24.04. On another distribution with systemd, install Node 24 its way; the rest was only tried on Ubuntu.

1. Node 24.

curl -fsSL https://deb.nodesource.com/setup_24.x | sudo bash -
sudo apt-get install -y nodejs

2. The server. It is one file, ownbase-server.js, with the browser client in web/ beside it. Build both in a copy of the repository, on any machine with Node 24 and pnpm, and pack them the way the release workflow does. The first line installs only what the server needs, as the Docker image does, and skips the desktop app's Electron download:

ELECTRON_SKIP_BINARY_DOWNLOAD=1 pnpm install --frozen-lockfile --filter "ownbase-server..."
pnpm --filter @ownbase/web build && pnpm --filter ownbase-server build
tar -czf ownbase-server.tar.gz -C apps/server-cli/dist .

Copy the archive to the machine, unpack it, and add a user for the server that cannot sign in:

sudo mkdir -p /opt/ownbase
sudo tar -xzf ownbase-server.tar.gz -C /opt/ownbase
sudo useradd --system --no-create-home --home-dir /var/lib/ownbase \
  --shell /usr/sbin/nologin ownbase

The files in /opt/ownbase stay root's, so the server cannot change its own code.

3. Settings. What the server reads from the environment goes in /etc/ownbase/ownbase.env, such as a call relay's secret (see Your own relay with coturn). systemd reads the file before it starts the server, so it can stay readable by root alone:

sudo install -d -m 755 /etc/ownbase
sudo install -m 600 /dev/null /etc/ownbase/ownbase.env

4. The service. Save this as /etc/systemd/system/ownbase.service, with your own address in --public-url:

[Unit]
Description=OwnBase workspace server
After=network-online.target
Wants=network-online.target

[Service]
User=ownbase
Group=ownbase
EnvironmentFile=-/etc/ownbase/ownbase.env
ExecStart=/usr/bin/node /opt/ownbase/ownbase-server.js \
  --data /var/lib/ownbase/data --backup-dir /var/lib/ownbase/backups \
  --name "My Workspace" --invite-only --no-mdns \
  --host 127.0.0.1 --public-url https://chat.example.org --trust-proxy
# Asked to stop, the server closes its database first. systemd waits this long.
TimeoutStopSec=30
Restart=on-failure
RestartSec=5

# /var/lib/ownbase, made for the ownbase user and closed to everyone else. It is
# the only place the server can write.
StateDirectory=ownbase
StateDirectoryMode=0700
WorkingDirectory=/var/lib/ownbase
UMask=0077

NoNewPrivileges=yes
CapabilityBoundingSet=
ProtectSystem=strict
ProtectHome=yes
PrivateTmp=yes
PrivateDevices=yes
PrivateUsers=yes
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectKernelLogs=yes
ProtectControlGroups=yes
ProtectClock=yes
ProtectHostname=yes
ProtectProc=invisible
# AF_NETLINK lists the machine's addresses, which the server prints on start.
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK
RestrictNamespaces=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
LockPersonality=yes
RemoveIPC=yes
SystemCallArchitectures=native
SystemCallFilter=@system-service
SystemCallFilter=~@privileged
SystemCallErrorNumber=EPERM
# No MemoryDenyWriteExecute: Node turns JavaScript into machine code as it runs.

[Install]
WantedBy=multi-user.target

The workspace lives in /var/lib/ownbase/data and the daily backups in /var/lib/ownbase/backups (see Backups on a schedule). The server listens on 127.0.0.1 only, for a reverse proxy on the same machine, so --trust-proxy is safe: nothing else can reach it to forge the proxy's headers. The Caddy configuration in Docker and VPS works as it is. The lines after UMask take away what a chat server never needs: reading other users' files, changing the kernel's settings, gaining privileges, and the system calls ordinary services do not make. systemd-analyze security ownbase rates the result and lists each setting it checked.

5. Start it.

sudo systemctl daemon-reload
sudo systemctl enable --now ownbase
curl -s --retry 10 --retry-connrefused http://127.0.0.1:8543/api/health

The server takes a second or two to start listening; --retry-connrefused waits for it.

With --public-url set, creating the first account needs the claim code, which the server writes to its log when it starts:

sudo journalctl -u ownbase | grep "Claim code"

Open your address and create the first account with that code. That account owns the workspace.

For a server only your own network uses, leave out --host, --public-url, --trust-proxy and --no-mdns. It then listens on every address, and the desktop app finds it in its list of servers on the network. From another machine, the first account still needs the claim code.

Day to day.

  • sudo journalctl -u ownbase -f follows the log.
  • After changing the settings file, sudo systemctl restart ownbase. After changing the unit, sudo systemctl daemon-reload first.
  • To update, unpack the new archive over /opt/ownbase and restart. Before the new version changes the database's layout, it copies the workspace into data/pre-upgrade/ (see Backups, restore, updates).
  • Commands that change the workspace, such as restore and recover, run with the service stopped and as the ownbase user, so the files stay its own:
sudo systemctl stop ownbase
sudo -u ownbase node /opt/ownbase/ownbase-server.js recover --data /var/lib/ownbase/data
sudo systemctl start ownbase

Tried on 2026-10-28 on a new GitHub Actions machine with Ubuntu 24.04. A script ran each block above as written, with the archive built from this version and Node 24.22.1 from NodeSource:

  • Step 5's health check answered within two seconds. The server ran as ownbase with no capabilities and NoNewPrivs set. Inside the service, /opt/ownbase was read-only even to root, and /home was hidden.
  • The first account needed the claim code from the journal; without it the server answered 403. A message, an upload, and the owner's copy, which a child process makes, all worked.
  • After kill -9, the server answered again 6 seconds later, with its data.
  • systemctl stop ended with status 0, and the database's -wal file, 580 KB while it ran, was gone: the database closed cleanly.
  • recover as the ownbase user listed the accounts and left every file the user's own.
  • systemd-analyze security rated the service 1.2, "OK".
  • Without the four flags, it listened on the machine's address, printed it, and an mDNS lookup like the desktop app's found "My Workspace (OwnBase)".

Not tried: starting at boot. The service is enabled.

This page is made from docs/DEPLOYMENT.md.