Environment Variables
Koios is configured through environment variables passed to the Docker container. Most deployments work with the defaults, but you can customize network ports, performance tuning, logging, authentication, and reverse proxy settings.
Setting Environment Variables
Add -e flags to the docker run command in your systemd service file:
After editing the service file, reload and restart:
Network & TLS
Control how Koios handles HTTPS, HTTP, and port assignments.
Common Scenarios
Standard deployment (default): No variables needed. Koios listens on ports 443 (HTTPS) and 80 (HTTP redirect).
Custom ports:
Behind a TLS-terminating proxy (e.g., NGINX, HAProxy, AWS ALB):
Koios serves plain HTTP on port 8080. The proxy handles HTTPS and forwards traffic to this port.
HTTPS Certificate
Koios chooses the certificate it serves on the HTTPS port in this order:
- A certificate you place on the certificates volume at
certs/https/custom/. - A certificate uploaded in the web interface at System > Certificates. See Certificates.
- The built-in self-signed certificate, used when neither of the above is present or valid.
To install a CA-signed certificate at deploy time, place these files in custom/ before starting the container:
Koios revalidates the pair on every boot. A certificate that is unreadable, does not match its key, or is protected by a passphrase is rejected and Koios falls back to the self-signed certificate, so a bad certificate never locks you out of the interface you would use to fix it.
Performance Tuning
Adjust worker threads and timeouts for your deployment size.
Authentication
Control JWT token lifetimes for user sessions.
Logging
Control log output destination, format, and verbosity.
Koios holds third-party libraries at Warning, and the Modbus client at Error, so that raising a device or service to Debug returns Koios detail rather than a packet-by-packet protocol trace. KOIOS_LIBRARY_LOG_LEVELS is the only way to lift that ceiling — set it while you are diagnosing a problem, and expect the resulting logs to be large.
Log Forwarding (OpenTelemetry)
Forward logs, metrics, and traces from Koios to an external observability platform using the built-in OpenTelemetry Collector.
Example: Forwarding to Grafana Cloud
OPC-UA Configuration
Device Access
For the rare case of attaching serial, GPIO, I2C, or SPI hardware directly to the host. Two steps are needed: expose the host device node with --device, and give the Koios services membership in the group that owns it, since device nodes are group-owned and the services run as an unprivileged user.
Standard serial devices (the dialout group) work with no extra configuration. For GPIO, I2C, or SPI, whose group IDs vary between hosts, pass the numeric group ID. Find it with stat -c '%g' /dev/<node> on the host:
Reverse Proxy Settings
When running behind a reverse proxy, you may need to configure CSRF protection and cookie settings so that the proxy's domain and protocol are trusted.
Sub-Path Hosting
CSRF Protection
Session Cookies
Proxy Headers
Example: Behind NGINX with Custom Domain
Debugging
These variables are intended for troubleshooting and should not be enabled in normal operation.
What's Next
- Running Koios as a Service: apply these variables in your systemd service file
- Manually Starting Koios: pass variables to one-off
docker runcommands - Updating Koios: upgrade to a new version safely
