For self-hosters
Maintain your own snug server
Check the server's health, keep backups off the host, and update on your schedule.
Run every routine task with snug-ops, from the private snug/ folder the
installer made:
cd /path/to/snug
Check health and logs
./snug-ops status
status shows the release, address, and health (Healthy, Stopped, or
Needs attention). Under Needs attention, it shows the problem and the
command to fix it. It also shows whether the host follows updates, the latest
backup and its off-host copy, and CPU and memory use by service.
Operation needs recovery means a backup, update, or restore stopped partway.
Recover the server. Running now: means another snug-ops
command is still working.
status can't prove the call ports are reachable. After a firewall, router,
address, or Docker change, make a real call from outside the host's network.
Use ./snug-ops status --json in scripts. It reports health, version, start
time, storage usage and quota, seats in use, people online, and backups. A
reading snug couldn’t take is null.
The storage quota, SNUG_UPLOADS_QUOTA in state/.env, counts uploaded files,
deleted files still waiting for removal, and the database. A new install
gets 5 GiB default total uploads, with 1 GiB per file. When the quota is full, uploads stop and
chat keeps working. Admins see what takes the room under Settings > Admin >
Storage, and free up space covers
clearing it.
./snug-ops license status shows whether the server can let members in, without
printing the certificate. ./snug-ops logs prints the last 200 lines of server
output, and ./snug-ops logs --follow keeps watching.
Stop or start snug
./snug-ops stop
Stopping keeps the server's data on the host. ./snug-ops start brings it back,
and ./snug-ops restart stops and starts it. start and restart report
success only once snug answers over HTTPS.
snug-ops has no command that uninstalls snug or deletes its data.
Move the server to a new address
If you started at the server's IP address and have since bought a domain, point its A record at the host, then run:
./snug-ops address chat.example.com
Confirm the change when prompted. Members who saved the old address must
open the new one. The command checks whether the new address answers. If it
doesn't, the command prints how to restore the old address. To go back to the
IP address, run address with that address.
Each browser and app stays signed in only at the address it joined through, so everyone who joined at the old address signs in again at the new one, as if every device is gone describes. To keep members signed in at the old domain, pass it as the second address:
./snug-ops address chat.example.org chat.example.com
Run address with only the new domain once nobody needs the old one.
If the public address calls announce has changed, as it can on a home
connection, pass the new one with --ip. That restarts snug once, which
disconnects everyone in a call:
./snug-ops address --ip 203.0.113.9
Keep backups
snug backs itself up every night, in the same one-hour window it uses for updates. Members keep chatting, with no notice and no disconnect. A night skips its backup when one from the last 20 hours is already there, such as the safety backup an update leaves.
The newest three nightly backups stay in state/backups/. status names the
newest one and its age. When a night didn't happen, status says why and what
to do.
Every backup is a full copy of the database and the uploads. Before each night,
snug checks that the disk can hold another copy with a fifth to spare and 1 GiB
left over. If it can't, snug removes older nightly backups first, then skips the
night and reports it in status.
Copy backups off the host
To copy every backup off the host, set this in state/.env:
SNUG_BACKUP_COPY_TO=/mnt/backup/snug
snug copies every backup into that directory and checks it byte for byte:
nightly backups, the ones you make, and the ones updates leave. For an rsync
target, an rclone remote, or a NAS, name your own program instead
(run:/home/alex/copy.sh). It gets the backup's path as its argument, and six
hours to finish. status shows when the last copy succeeded, or why it failed.
snug never removes anything from that directory, so delete old copies there yourself. A copy shows up under its backup's name only once every file matches.
Two more lines shape where backups live:
SNUG_BACKUP_DIRpoints every backup, manual ones included, at another disk instead ofstate/backups/.SNUG_BACKUP_KEEPsets how many nightly backups stay, from 1 to 90. With copies going off the host,SNUG_BACKUP_KEEP=1keeps only the newest one here.
Machine snapshots from your provider work too, since the disk holds last night's verified backup.
Make a backup now
Before an upgrade or a move, run:
./snug-ops backup
It prints the path of the backup it made. To put it on a mounted disk, pass one new directory:
./snug-ops backup /mnt/encrypted/snug-before-moving
A manual backup starts only if it fits on disk. Each backup records its size
and when it passed verification. To check it again, run ./snug-ops verify
with its path.
Backups you make, and the safety backup each manual update leaves, stay until
you remove them. To keep only the newest few, add these lines to state/.env:
SNUG_BACKUP_KEEP_MANUAL=2
SNUG_BACKUP_KEEP_UPGRADE=1
The first keeps your two newest manual backups. The second keeps the newest update backup. Once an older update backup is gone, that update can't roll back with its data.
Backups leave out the license, so keep the original .lic file separately.
Never copy the database files yourself while snug is running. The commands above
take a consistent snapshot.
Update snug
If you installed with snug's public installer, the server follows verified releases by default. A scheduled task runs every 15 minutes and updates only during the one-hour window an admin picks in Settings > Admin > Server > Updates. The first window starts at 04:00 UTC. Five minutes before the server restarts, members see the expected time in the header. The notice doesn't appear in chat history.
To keep this host on the release it's running:
./snug-ops updates pin
./snug-ops updates status shows the current choice, and
./snug-ops updates follow returns to updating in the admin's window. Nightly
backups keep running while the host is pinned.
Pinning holds only the server. Members' desktop apps keep updating and work with a server on any release since 3.0.0. The phone apps need a server on 3.17.1 or newer. Their apps hide anything that needs a newer server until you update. In a browser, everyone runs the app this server serves.
Update now
To update immediately, even when the host is pinned or outside its window, run:
./snug-ops upgrade
It asks snug.chat for the newest release. If this host already runs it, it says so and stops. Otherwise it downloads and verifies the new package, then hands the update to it.
Update when a brief disconnect is fine. The update makes and verifies a safety backup, prints its path, and disconnects members once. It checks that the new version can join, write, and upload, then removes its test data. Members never see the test.
Use ./snug-ops upgrade --check to check for a newer release without
downloading it or interrupting the server.
To put the safety backup on a particular mounted disk, pass a new directory:
./snug-ops upgrade /mnt/encrypted/snug-pre-upgrade
Manual updates keep every safety backup unless you set
SNUG_BACKUP_KEEP_UPGRADE. Automatic updates keep their newest one and remove
the one before it.
A server on a release older than 3.0.0 can't fetch its own update. If upgrade
refuses instead of asking snug.chat, install the newest package once with the
installer. The single command works from then on:
(cd .. && curl -fsSL https://snug.chat/install.sh | sh) && ./snug-ops upgrade
If an update stops partway or leaves the server unavailable, go straight to recover the server.
Change settings
Use Settings > Admin for group settings.
On the host, edit state/.env only for the lines these guides name:
- the backup lines above
SNUG_ADMIN_SETUP_CODE, to recover admin access
current/RUNBOOK.md lists every other host setting, such as the limit on
cameras and screen shares per call.