Self-hosting

Run your own server with Docker, behind TLS, with persistence.

Docker Compose

The project ships a Compose file that runs the Go server and nginx (which serves the web app and proxies /api, /ws, /install.sh and /download on one origin). Sessions are stored in the zero-data volume.

PUBLIC_ORIGIN=https://files.example.com docker compose up --build -d

TLS

Browsers only expose the encryption API on secure origins, so serve Zero Portal over HTTPS (or use localhost). Terminate TLS in a reverse proxy or load balancer in front of port 8080 and enable HSTS. Set TRUST_PROXY=true so rate limits see the real client address, and PUBLIC_URL=https://files.example.com so install scripts hand out the right address.

Configuration

VariableDefaultMeaning
ADDR:8080Listen address of the Go server.
ALLOWED_ORIGIN*Allowed web origin(s), comma separated. Set this in production.
PUBLIC_URL(from the request)Address agents are told to use, e.g. https://files.example.com.
SESSION_RETENTION168hHow long a session with no device online is kept (7 days). The same for everyone.
DATA_DIRdataWhere sessions are saved. off = memory only. Hashes only, file mode 0600.
AGENT_DIRdist/agentFolder with the agent binaries served at /download.
MAX_PEERS / MAX_FILE_SIZE8 / 10737418240Defaults for new sessions.
MAX_PORTALS10000Cap on stored sessions (503 when full).
RATE_CREATE_PER_MIN, RATE_LOOKUP_PER_MIN, RATE_WS_PER_MIN10 / 60 / 60Per-IP limits; 0 disables a limit.
TRUST_PROXYfalseRead the client IP from X-Real-IP / X-Forwarded-For. Only behind a proxy that sets them.

Operating it

  • Backups: back up the data volume if sessions must outlive the host. It contains no tokens or passwords in clear text.
  • Upgrades: rebuild and restart. Sessions are restored and members reconnect on their own.
  • Health: GET /health, and zero-server healthcheck inside the container.
  • Cross-compile agents yourself: make dist writes binaries and checksums for every platform.