Server Hosting, Auth & Reverse Proxy
Stravia Server runs headless on Linux or Windows, inside containers, or as a declarative NixOS service. By default it binds 127.0.0.1:23471.
Prerequisites
- Data directory: A writable directory with exclusive instance access (Server enforces
.instance.lock). - Reverse proxy (for remote access): TLS termination via Nginx, Caddy, or Traefik before exposing
/api/v1/*or/v1/*beyondlocalhost.
Steps
1. Run via Binary, Docker, or NixOS
- Standalone binary: Linux Server releases use
./stravia-server --data-dir /var/lib/stravia --listen 127.0.0.1:23471shmimalloc(with C allocator override andMIMALLOC_PURGE_DELAY=0by default) to reduce steady-state resident memory. When any provider, web provider, or updater uses the defaultsystemproxy mode, Server reads standard process proxy environment variables (HTTP_PROXY,HTTPS_PROXY,ALL_PROXY,NO_PROXY) and connects directly if none are set. - Docker (
ghcr.io/stravia-ai/straviaplatform:latest, runs asnonroot:nonrootUID/GID65532and listens on0.0.0.0:23471inside the container,HEALTHCHECKhits/healthz):If mounting a host directory instead of a named volume, ensure UID/GIDdocker run -d --name stravia \ -p 127.0.0.1:23471:23471 \ -v stravia-data:/data \ ghcr.io/stravia-ai/straviaplatform:latestsh65532can write to/data. - NixOS (
services.stravia): ImportnixosModules.defaultfrom the Stravia flake and setservices.stravia.enable = true. The module creates a non-rootstraviauser/group, binds127.0.0.1:23471(firewall untouched), stores state under/var/lib/stravia(0700), and bundles all official vendor plugins via--features bundled-vendors. If overridingservices.stravia.configFile, point to a writable runtime file path—never a read-only/nix/storepath.
2. Claim initial /setup
On first start without an initialized database, Server prints a one-time setup token and URL to stdout/journal (on NixOS, inspect journalctl -u stravia.service -b—never share logs containing the raw token). Open /setup, select your database backend, and create your administrator username and password.
3. Configure Reverse Proxy, Admin Origins & Trusted Proxies
When serving Stravia behind HTTPS (for example https://stravia.example.com):
- Pass
--admin-origin https://stravia.example.com(or NixOSservices.stravia.adminOrigins) and configure--trusted-proxy(trustedProxies) to match your real reverse proxy IP/CIDR—do not rely on permissive CORS or open firewalls as admin access control. - Proxy both HTTP, Server-Sent Events (
/api/v1/observations/events), and WebSocket upgrades (/v1/responses), disabling request/response buffering for streams and allowing bodies up to at least150m(PROXY_JSON_BODY_LIMIT_BYTESis140 MiBafter decompression). - Set Settings → Artifacts → Client base URL (
client_base_url) to your public URL (https://stravia.example.com) so generated imagedownload_urllinks resolve externally.
location / {
proxy_pass http://127.0.0.1:23471;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_buffering off;
client_max_body_size 150m;
} nginx
Verify
- Confirm
curl -fsS http://127.0.0.1:23471/readyzreturns HTTP200. - Open your public HTTPS URL, log in with your admin cookie session, and check Connect clients → Code shows your public base URL.
Troubleshooting
- WebSocket
/v1/responsesor live logs drop every 60s: Increase proxy read/send timeouts and ensureUpgrade/Connectionheaders plusproxy_buffering offare enabled. - Docker container exits with permission error on
/data: Fix host mount ownership for UID/GID65532(chown -R 65532:65532). - Setup token rejected: Restart Server if expired or check that you copied the token from the current boot's startup logs.
Next
- Databases, Storage & Backups — configure PostgreSQL + Redis, S3 artifacts, outbound proxy, and history retention.
- Configuration, CLI & Paths — complete list of Server flags and
STRAVIA_*environment variables.