Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Swetrix CE v4 update

Blue Mouse5e16069e6faa
diff --git a/docs/accountsettings/two-factor-authentication.md b/docs/accountsettings/two-factor-authentication.md
index 85d156507..958df1f67 100644
--- a/docs/accountsettings/two-factor-authentication.md
+++ b/docs/accountsettings/two-factor-authentication.md
@@ -38,6 +38,6 @@ To disable 2FA, on the [account settings page](https://swetrix.com/user-settings
In the input field shown afterwards, enter a one-time code generated by your authenticator app or a recovery code and click on the "Disable" button.
-:::warning
+:::caution
Once you disable the 2FA, verification codes from the authenticator application and saved recovery codes will become invalid.
:::
diff --git a/docs/selfhosting/configuring.md b/docs/selfhosting/configuring.md
index b2ae942da..5a57e99be 100644
--- a/docs/selfhosting/configuring.md
+++ b/docs/selfhosting/configuring.md
@@ -15,18 +15,51 @@ The following environment variables are available for configuration:
| --------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
| `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. |
-## API (swetrix-api image)
+:::caution
+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 |
| -------------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| `EMAIL` | Required | Email address to use for access to dashboard |
-| `PASSWORD` | Required | Password to use for access to dashboard |
-| `JWT_ACCESS_TOKEN_SECRET` | _auto-generated by `configure.sh`_ | Secret for JWT access tokens |
-| `JWT_REFRESH_TOKEN_SECRET` | _auto-generated by `configure.sh`_ | Secret for JWT refresh tokens |
-| `API_KEY` | | An optional API key for accessing your stats via the API directly. If not set - direct API access is disabled. |
+| `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](https://support.google.com/mail/answer/185833) 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 |