From 43ca3817488c9718fa5b0ea465c3dc2ad94a4769 Mon Sep 17 00:00:00 2001 From: matei jordache Date: Fri, 3 Apr 2026 20:33:47 -0700 Subject: [PATCH] update docs for self-hosting --- docs/self-hosting.md | 92 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/docs/self-hosting.md b/docs/self-hosting.md index f5e6b83..19971c3 100644 --- a/docs/self-hosting.md +++ b/docs/self-hosting.md @@ -14,6 +14,98 @@ TONO_HOST=0.0.0.0 tono The server will be available at `http://:8188`. +## Running as a system service + +To keep tono running in the background and auto-restart on reboot, create a systemd service. + +### Create a service user + +```bash +sudo useradd --system --create-home --shell /bin/false tono +sudo mkdir -p /var/lib/tono +sudo chown tono:tono /var/lib/tono +``` + +### Clone and install + +```bash +sudo git clone https://github.com/VIPQualityPost/tono.git /opt/tono +sudo chown -R tono:tono /opt/tono +sudo -u tono bash -c 'cd /opt/tono && python3 -m venv .venv && source .venv/bin/activate && pip install -e .' +sudo -u tono bash -c 'cd /opt/tono/frontend && npm ci && npm run build' +``` + +### Create the unit file + +Save as `/etc/systemd/system/tono.service`: + +```ini +[Unit] +Description=tono +After=network.target + +[Service] +Type=simple +User=tono +WorkingDirectory=/opt/tono +ExecStart=/opt/tono/.venv/bin/tono +Environment=TONO_HOST=127.0.0.1 +Environment=TONO_PORT=8188 +Environment=TONO_APPDATA=/var/lib/tono +Environment=TONO_UPDATE_CHECK=off +Restart=always +RestartSec=5 + +[Install] +WantedBy=multi-user.target +``` + +### Enable and start + +```bash +sudo systemctl daemon-reload +sudo systemctl enable tono +sudo systemctl start tono +sudo systemctl status tono # verify it's running +``` + +### Useful commands + +```bash +sudo journalctl -u tono -f # follow logs +sudo systemctl restart tono # restart after updates +``` + +## HTTPS with Certbot + +After setting up nginx (see [Reverse proxy](#reverse-proxy) below), use Certbot to get a free TLS certificate from Let's Encrypt. + +### Install Certbot + +```bash +# Ubuntu/Debian +sudo apt install nginx certbot python3-certbot-nginx +``` + +### Get a certificate + +Point your domain's DNS A record at your server's IP, then: + +```bash +sudo certbot --nginx -d tono.yourdomain.com +``` + +Certbot will automatically: +- Obtain a certificate +- Configure nginx to use it +- Set up auto-renewal (certificates renew every 90 days) + +You can verify auto-renewal works with: + +```bash +sudo certbot renew --dry-run +``` + ## Environment variables | Variable | Default | Description |