Skip to main content

Configuring

note

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)

VariableDefaultDescription
API_URLhttp://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.

API (swetrix-api image)

VariableDefaultDescription
EMAILRequiredEmail address to use for access to dashboard
PASSWORDRequiredPassword to use for access to dashboard
JWT_ACCESS_TOKEN_SECRETauto-generated by configure.shSecret for JWT access tokens
JWT_REFRESH_TOKEN_SECRETauto-generated by configure.shSecret for JWT refresh tokens
API_KEYAn optional API key for accessing your stats via the API directly. If not set - direct API access is disabled.
CLOUDFLARE_PROXY_ENABLEDfalseIf set to true - Swetrix will get IP address information from cf-connecting-ip header provided by Cloudflare.
IS_PRIMARY_NODEtrueYou 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.

Redis

VariableDefaultDescription
REDIS_PASSWORDpasswordRedis password
REDIS_PORT6379Redis port
REDIS_USERdefaultRedis user

Clickhouse

VariableDefaultDescription
CLICKHOUSE_DATABASEanalyticsClickHouse database
CLICKHOUSE_USERdefaultClickHouse user
CLICKHOUSE_PORT8123ClickHouse port
CLICKHOUSE_PASSWORDClickHouse password