Configuring
The easiest way to get started with Swetrix is by using our cloud service. We do all the dirty work for you: hosting, maintenance, backups, worldwide CDN, etc. Using Cloud you still own the data, you can export it or delete it at any time you want. By using Swetrix Cloud you support maintenance and development of the product, which eventually makes it better.
The following environment variables are available for configuration:
Frontend (swetrix image)
Variable | Default | Description |
---|---|---|
API_URL | http://localhost:8080/ | URL of the self-hosted Swetrix API instance. Swetrix frontend will use this variable to connect to the API, so make sure it's correct. |
Swetrix Community Edition is split into two containers: swetrix
(frontend - the frontend web UI) and swetrix-api
(backend - the API server, that does auth, data logging, etc.). The API_URL
variable on the frontend container must point to the backend container, which by default is http://localhost:8080/
.
So if you're self-hosting on subdomains, you might run swetrix.mydomain.com proxied to port 80 for the frontend user interface (where you log in), and swetrix-api.mydomain.com proxied to port 8080, and set API_URL=https://swetrix-api.mydomain.com
.
This is the most common issue users encounter when self-hosting Swetrix Community Edition, so please make sure to set it correctly.
Backend (swetrix-api image)
Basic configuration
Variable | Default | Description |
---|---|---|
SECRET_KEY_BASE | auto-generated by configure.sh | Secret used for auth keys and login sessions. Must be set. |
CLOUDFLARE_PROXY_ENABLED | false | If set to true - Swetrix will get IP address information from cf-connecting-ip header provided by Cloudflare. |
IS_PRIMARY_NODE | true | You should not touch this variable unless you know what you are doing. It's used to spin off multiple API instances in a cluster, where only one of them will be primary. If changed to false , things like cron task manager will be disabled for this instance. |
Email configuration (SMTP)
Swetrix will send transactional emails for some actions, like password reset or project invitations. You must configure SMTP credentials for this to work correctly.
Variable | Default | Description |
---|---|---|
SMTP_HOST | SMTP host | |
SMTP_PORT | SMTP port | |
SMTP_USER | SMTP user (if your SMTP provider requires authentication) | |
SMTP_PASSWORD | SMTP password (if your SMTP provider requires authentication) | |
FROM_EMAIL | Email address to use for sending emails | |
SMTP_MOCK | false | If set to true - emails will not be sent, but will be logged to the console instead |
If you don't have an SMTP provider, some regular email providers offer this functionality. For example, you can configure Gmail for app specific passwords and use them as SMTP credentials (in this case, the SMTP_HOST
should be smtp.gmail.com
with port 587
).
OIDC configuration
Swetrix Community Edition also supports OIDC authentication. To enable it, you need to set the following variables:
Variable | Default | Description |
---|---|---|
OIDC_ENABLED | false | Must be set to true to enable OIDC authentication. |
OIDC_ONLY_AUTH | false | If set to true - Swetrix will only allow users to authenticate via OIDC (i.e. regular login / registration form will not work). |
OIDC_DISCOVERY_URL | URL of the OIDC discovery endpoint, for example https://example.com/.well-known/openid-configuration | |
OIDC_CLIENT_ID | OIDC client ID | |
OIDC_CLIENT_SECRET | OIDC client secret |
Redis
Variable | Default | Description |
---|---|---|
REDIS_PASSWORD | password | Redis password |
REDIS_PORT | 6379 | Redis port |
REDIS_USER | default | Redis user |
Clickhouse
Variable | Default | Description |
---|---|---|
CLICKHOUSE_DATABASE | analytics | ClickHouse database |
CLICKHOUSE_USER | default | ClickHouse user |
CLICKHOUSE_PORT | 8123 | ClickHouse port |
CLICKHOUSE_PASSWORD | ClickHouse password |
Help us improve Swetrix
Was this page helpful to you?