Configuration
Every environment variable GeoMetrikks reads, generated from the settings classes.
Settings that control how the server runs are environment variables or
.env entries. Lists you create in the app, such as API keys and
Muted IPs, live in the database instead. A setting never lives in both
places. The short list most users need is in .env.example. This page
lists every environment variable.
The variables come in five groups:
- Essentials: login, database, the logs to read and GeoIP.
- Container and compose variables: read by the image and the compose file, not by the app.
- Optional settings: one subsection per feature. Skip the ones you don't use.
- Advanced tuning: pool sizes, poll intervals, timeouts and log rotation. The defaults fit almost every install.
- Developer settings: for working on GeoMetrikks itself.
GEOMETRIKKS_ENV_FILE overrides the path of the .env file itself
(default: .env in the working directory); setting it to an empty
value disables dotenv loading entirely, so configuration comes only
from real environment variables. It is read once at import time.
Essentials
Most installs set these. The compose file sets DB_HOST for you.
Application
| Variable | Default | Description |
|---|---|---|
APP_AUTH_DISABLED | false | Disable the built-in login and sessions. Anyone who reaches the port can then use every API action, so set true only behind a reverse proxy that authenticates every request, such as one guarded by Authelia. Setting it together with OIDC_ISSUER, OIDC_CLIENT_ID, OIDC_CLIENT_SECRET and OIDC_REDIRECT_URI stops startup. |
APP_ADMIN_USER | admin | Admin login username |
APP_ADMIN_PASSWORD | - | Admin login password (required unless APP_AUTH_DISABLED=true or OpenID Connect (OIDC_*) is configured) |
APP_SESSION_SECURE | false | Mark the session cookie Secure so browsers only send it over HTTPS. OpenID Connect with an https OIDC_REDIRECT_URI needs it, or startup fails. Recommended behind any TLS reverse proxy. |
APP_SESSION_MAX_AGE_DAYS | 7 | How many days a login lasts before the user has to sign in again. Each login keeps the lifetime it started with, so a change only applies to logins made after it. Raise it for an unattended wall screen. 400 is the longest cookie lifetime browsers accept. |
APP_TRUSTED_PROXIES | (empty) | Reverse-proxy IPs/CIDRs allowed to supply X-Forwarded-For. The login log, the OIDC login lines, an API key's last-used-from IP and the api_key_rejected, api_key_created and api_key_revoked log lines record the client IP resolved through it, and the Exclude your IP filter on the log pages looks up your address through it. The list must cover the proxy that connects to the app. With Docker, that is the subnet of the network the proxy and GeoMetrikks share, and CDN ranges go next to it, not instead of it. Env accepts one value, comma-separated values, or a JSON list. Default is empty. When it is empty or misses the connecting proxy, forwarded headers are ignored, the app records the proxy's address, and the filter shows Needs APP_TRUSTED_PROXIES. |
Database
| Variable | Default | Description |
|---|---|---|
DB_USER | geouser | Database user |
DB_PASSWORD | - | Database password |
DB_HOST | localhost | Database host |
DB_PORT | 5432 | Database port |
DB_DATABASE | geometrikks | Database name |
Log parser
| Variable | Default | Description |
|---|---|---|
LOGPARSER_LOG_PATHS | /var/log/access/access.log | Access log files to tail. Env accepts a single path or a JSON list of paths. Default: /var/log/access/access.log |
LOGPARSER_LOG_FORMATS | auto | Log format per tailed file: 'auto' (default, detected from the file's content), 'geometrikks-json', 'nginx', 'traefik-json', or 'caddy-json'. Env accepts a single value applied to every path, or a JSON list matching LOGPARSER_LOG_PATHS by position. |
LOGPARSER_SERVER_NAME | (the machine's hostname) | Name recorded on every request this server ingests. It is a name you choose for this server, not your nginx server_name. Env accepts one value for every tailed file, or a JSON list matching LOGPARSER_LOG_PATHS by position. Default: this machine's hostname. Formerly LOGPARSER_HOST_NAME, which still works until 1.0. |
LOGPARSER_STORE_DEBUG_LINES | false | Store all raw log lines in AccessLogDebug table. When False, only malformed requests are stored. |
LOGPARSER_IGNORE_IPS | (empty) | IPs/CIDRs the parser drops entirely (no geo event, access log, or debug row). Use for your own traffic hitting the reverse proxy. Env accepts one value, comma-separated values, or a JSON list. Empty (default): nothing is ignored. |
GeoIP
| Variable | Default | Description |
|---|---|---|
GEOIP_DB_PATH | data/geoip/GeoLite2-City.mmdb | Path to GeoIP2/GeoLite2 database file |
GEOIP_LOCALES | ["en"] | List of GeoIP locales to use |
MAXMINDDB_USER_ID | - | MaxMind account ID for GeoLite2 auto-download |
MAXMINDDB_LICENSE_KEY | - | MaxMind license key for GeoLite2 auto-download |
GEOIP_ASN_DB_PATH | data/geoip/GeoLite2-ASN.mmdb | Path to the GeoLite2 ASN database file |
GEOIP_ASN_ENABLED | true | Download and use the GeoLite2 ASN database for per-request ASN/organization enrichment. Uses the same MaxMind credentials as the City database; without credentials or a database file the app simply ingests without ASN data. |
Container and compose variables
The image and the shipped docker-compose.yml read these. They are not app settings, so Settings > Environment does not list them.
| Variable | Default | Description |
|---|---|---|
PUID | 1000 | User id the app runs as. At startup the entrypoint remaps the geometrikks user to it, chowns /app, /app/logs and /app/data/geoip to PUID:PGID, then drops root. Match your host user (id -u) so host tools can manage the files in ./logs. A non-root user: on the app service skips the remap and every chown. That user must then own ./logs and the geoip volume, or GeoLite2 downloads fail. It must also be able to write to /app, which UID 1000 owns in the image. In full mode the app rewrites /app/.litestar.json through a temporary file in /app at startup, so without that access startup stops with a PermissionError. |
PGID | 1000 | Group id the app runs as. At startup the entrypoint remaps the geometrikks group to it and chowns /app, /app/logs and /app/data/geoip to PUID:PGID. Match your host group (id -g). A non-root user: on the app service skips this remap too. See PUID for what that user then needs. |
ACCESS_LOG_DIR | /var/log/nginx | Host folder the compose file mounts read-only at /var/log/access, where LOGPARSER_LOG_PATHS points by default. Set it to the folder that holds your proxy's access logs. |
NGINX_LOG_DIR | - | Older name for ACCESS_LOG_DIR. The compose file uses it only when ACCESS_LOG_DIR is unset. |
POSTGRES_USER | geouser | Database user the timescale_db service creates. The compose file sets it on that service, so a value in .env changes nothing. It must match DB_USER. Postgres reads it only when it creates the data volume. |
POSTGRES_PASSWORD | DB_PASSWORD, else geopass | Password of the database user. The compose file sets it to ${DB_PASSWORD:-geopass} and sets the app's DB_PASSWORD the same way, so both fall back to geopass when DB_PASSWORD is unset. Postgres applies it only when it creates the data volume. Changing DB_PASSWORD later locks the app out of the database until you also change the password inside Postgres with ALTER USER geouser PASSWORD '...'. |
POSTGRES_DB | geometrikks | Database the timescale_db service creates. The compose file sets it on that service, so a value in .env changes nothing. It must match DB_DATABASE. Postgres reads it only when it creates the data volume. |
LITESTAR_WEB_CONCURRENCY | 1 | Worker count for litestar run. The image's command passes --workers 1, which wins over this and the two variables below, so they change nothing in the container. Outside the image, every worker runs the whole app. Each one tails every log, so each line is stored once per worker, and runs every scheduled job. Each process runs its own /ws/crowdsec and /ws/logs feeds and keeps its own session lock, so logins and logouts on different workers can race. Two processes can also run migrations at once. See Deployment. |
WEB_CONCURRENCY | 1 | Same as LITESTAR_WEB_CONCURRENCY, which wins when both are set. |
GRANIAN_WORKERS | 1 | Same as LITESTAR_WEB_CONCURRENCY, read only when neither it nor WEB_CONCURRENCY is set. |
LITESTAR_APP | (set by the image) | Tells litestar CLI commands where the app is. The image sets it to geometrikks.server.core:create_app, so commands run in the container need no --app. Outside the image, pass --app geometrikks.server.core:create_app. |
Optional settings
Set these only for a feature you use, or to change a default.
Loki
| Variable | Default | Description |
|---|---|---|
LOKI_URL | - | Base URL of the Loki server, e.g. http://loki:3100. http or https. Unset (default): no Loki source. |
LOKI_QUERIES | (empty) | LogQL stream selectors, one source each, e.g. {job="traefik"}. Env accepts a single selector or a JSON list. Empty (default): no Loki source. |
LOKI_FORMATS | auto | Log format per query, same values as LOGPARSER_LOG_FORMATS. Env accepts one value for every query, or a JSON list matching LOKI_QUERIES by position. |
LOKI_SERVER_NAMES | (empty) | Server name per query. Env accepts one value or a JSON list matching LOKI_QUERIES by position. Empty (default): the first LOGPARSER_SERVER_NAME. |
LOKI_TENANT_ID | - | Sent as X-Scope-OrgID, for a multi-tenant Loki. Unset (default): no header. |
LOKI_USERNAME | - | Basic auth username, with LOKI_PASSWORD. |
LOKI_PASSWORD | - | Basic auth password, with LOKI_USERNAME. |
Map
| Variable | Default | Description |
|---|---|---|
MAP_SERVER_LATITUDE | - | Latitude of this server on the map, where live request routes end. Set it with MAP_SERVER_LONGITUDE to skip public-IP detection. Formerly MAP_HOME_LATITUDE, which still works until 1.0. |
MAP_SERVER_LONGITUDE | - | Longitude of this server on the map, where live request routes end. Set it with MAP_SERVER_LATITUDE to skip public-IP detection. Formerly MAP_HOME_LONGITUDE, which still works until 1.0. |
MAP_AUTO_DETECT_SERVER_LOCATION | true | Look up this server's public IP at startup and geolocate it when MAP_SERVER_LATITUDE and MAP_SERVER_LONGITUDE are unset. Formerly MAP_AUTO_DETECT_HOME, which still works until 1.0. |
MAP_SERVER_LOCATIONS | (empty) | Fixed map locations per server name, as a JSON object of {"server": [latitude, longitude]}. An entry here wins over the location that server detects for itself. Removing an entry deletes its row at the next startup. Use it for a server whose public IP geolocates wrong (CGNAT, VPN), or whose logs are shipped from another machine. Formerly MAP_HOME_LOCATIONS, which still works until 1.0. |
MAP_DEFAULT_VIEW | - | Where the map opens, as latitude,longitude or latitude,longitude,zoom (zoom 0-22, default 3). Example: 71.129982,27.653369,15 opens on northern Norway at zoom 15. When unset, the map opens on the server locations, or on the whole world if there are none. |
MAP_CARTO_API_KEY | (empty) | CARTO basemaps API key, sent as ?key= on every basemap request the browser makes. CARTO's terms require one per deployment; keys are free at https://carto.com/basemaps/apikey. Not a secret: it is visible to anyone who can open the map. |
MAP_ESRI_API_KEY | (empty) | ArcGIS Location Platform API key for the map's Satellite view, which draws Esri World Imagery. Keys are free at https://location.arcgis.com. Without one the Satellite switch stays off. It is not a secret, since anyone who can open the map can see it. |
CrowdSec
| Variable | Default | Description |
|---|---|---|
CROWDSEC_LAPI_URL | - | CrowdSec Local API base URL, e.g. http://crowdsec:8080 |
CROWDSEC_BOUNCER_API_KEY | - | Bouncer API key (cscli bouncers add geometrikks) - read access |
CROWDSEC_MACHINE_ID | - | Machine ID (cscli machines add) - enables ban/unban |
CROWDSEC_MACHINE_PASSWORD | - | Machine password - enables ban/unban |
CROWDSEC_DEFAULT_BAN_DURATION | 4h | Default duration for manual bans (Go duration string) |
CROWDSEC_VERIFY_TLS | true | Verify TLS when LAPI uses https |
DROP lists
| Variable | Default | Description |
|---|---|---|
DROP_ENABLED | true | Download the Spamhaus DROP lists from www.spamhaus.org every DROP_REFRESH_HOURS and mark traffic from listed networks in the UI. Needs the scheduler. Set to false to stop the downloads and hide every DROP element. |
AbuseIPDB
| Variable | Default | Description |
|---|---|---|
ABUSEIPDB_API_KEY | - | AbuseIPDB API key. Setting it lets GeoMetrikks check IPs against api.abuseipdb.com. Opening a public IP in the inspector sends it to AbuseIPDB and uses one daily check. Opening the same IP again within 15 minutes spends none, unless the server restarted or checked 512 other IPs in between. |
ABUSEIPDB_REPORTING_ENABLED | false | Allow reporting IPs to AbuseIPDB from the UI. A report sends the IP, your comment, the categories and the attack time to AbuseIPDB, where they are public. Needs ABUSEIPDB_API_KEY. |
ABUSEIPDB_BLACKLIST_ENABLED | false | Download AbuseIPDB's blacklist from api.abuseipdb.com every ABUSEIPDB_BLACKLIST_REFRESH_HOURS, or read ABUSEIPDB_BLACKLIST_FILE, and mark listed IPs in the UI. The request sends your key and no IPs. Needs the scheduler and either ABUSEIPDB_API_KEY or ABUSEIPDB_BLACKLIST_FILE. The list is for your own use. AbuseIPDB forbids republishing it, and free plans can't be used commercially. |
ABUSEIPDB_BLACKLIST_FILE | - | Read the blacklist from this file instead of downloading it, for a list you already download some other way. It takes AbuseIPDB's JSON answer as saved, or one IP per line. GeoMetrikks checks the file every 5 minutes and needs no API key for it. Needs ABUSEIPDB_BLACKLIST_ENABLED=true. |
OpenID Connect
Login with OpenID Connect turns on when OIDC_ISSUER, OIDC_CLIENT_ID,
OIDC_CLIENT_SECRET and OIDC_REDIRECT_URI are all set. Setting only some of
them stops startup with an error that names the missing ones. Startup also fails when:
OIDC_ISSUERorOIDC_REDIRECT_URIuses plain http on a host other than localhost or a loopback IP address.OIDC_ISSUERorOIDC_REDIRECT_URIcarries credentials, a query string or a fragment.- The path of
OIDC_REDIRECT_URIis not/api/v1/auth/oidc/callback. - Neither
OIDC_ALLOWED_USERSnorOIDC_ALLOWED_GROUPSis set. OIDC_SCOPESdoes not includeopenid.OIDC_CA_BUNDLEnames a file that is missing or unreadable.APP_AUTH_DISABLED=trueis set.OIDC_REDIRECT_URIis https andAPP_SESSION_SECUREis nottrue.
| Variable | Default | Description |
|---|---|---|
OIDC_ISSUER | - | Issuer URL of the identity provider, e.g. https://auth.example.com. Discovery is read from {issuer}/.well-known/openid-configuration and the issuer it names must match this value apart from a trailing slash. The ID token's iss claim must equal that discovered issuer. Must be https unless the host is localhost or a loopback IP address, and must not carry credentials, a query string or a fragment, or startup fails. |
OIDC_CLIENT_ID | - | Client id registered at the identity provider. |
OIDC_CLIENT_SECRET | - | Client secret registered at the identity provider. |
OIDC_REDIRECT_URI | - | The exact callback URL registered at the identity provider: the public https address of this app plus /api/v1/auth/oidc/callback. Plain http works only on localhost or a loopback IP address, and credentials, a query string or a fragment in the URI stop startup. An https URI also needs APP_SESSION_SECURE=true, or startup fails. |
OIDC_ALLOWED_USERS | (empty) | People allowed to sign in, each a verified email address or a subject identifier. One value, comma-separated values, or a JSON list. At least one of OIDC_ALLOWED_USERS and OIDC_ALLOWED_GROUPS is required. |
OIDC_ALLOWED_GROUPS | (empty) | Groups allowed to sign in; membership in any one is enough. Same formats as OIDC_ALLOWED_USERS. |
OIDC_GROUPS_CLAIM | groups | Claim that carries group membership, read from the ID token and the userinfo endpoint. |
OIDC_SCOPES | openid profile email groups | Space-separated scopes requested at login. Must include openid. |
OIDC_PROVIDER_NAME | SSO | Label on the login button: "Sign in with {name}". |
OIDC_LOGOUT_IDP | false | On logout, also end the identity provider session when discovery advertises an end_session_endpoint. Register {app origin}/signed-out as the post-logout redirect URI before enabling it. When the endpoint is absent, logout still clears the GeoMetrikks session but cannot end the provider session. |
OIDC_CA_BUNDLE | - | PEM file with the CA that signed the identity provider's certificate, for providers behind an internal CA. There is no switch to turn verification off. |
Instance and notices
| Variable | Default | Description |
|---|---|---|
APP_MODE | full | Either full, which runs everything, or agent, which only tails logs into the head's database and serves the two health routes, /health and /health/ready. |
APP_PROXY_ADVISORY | true | Warn on Settings > Status when most recent traffic for a tailed file comes from CDN or private peer addresses, meaning the proxy logs its upstream instead of the visitor. CDN findings for agent-tailed sources are scanned from the database on the head every 5 minutes. Set to false when the traffic mix is deliberate (Tailscale-only access, a CDN you front on purpose). |
APP_UPDATE_CHECK | true | Check GitHub Releases every 12 hours for a newer GeoMetrikks release and mention it on the About page. The request goes to api.github.com and carries no information about this instance. Set to false for an offline install or if you don't want the app to contact GitHub. |
APP_INSTANCE_NAME | - | Name this instance goes by on Settings > Agents, where the head lists every instance that reports in. Unset, agents show as "agent" and the head as "head". Set it on every agent. Two unnamed agents share one name and overwrite each other's status. Up to 255 characters, no slashes, no control characters, and not "." or "..". |
Analytics & retention
| Variable | Default | Description |
|---|---|---|
ANALYTICS_RAW_RETENTION_DAYS | 180 | Days to keep raw geo_events and access_logs data. At least 4: the daily aggregates refresh their last 3 days from raw rows, and a shorter retention makes each refresh erase those buckets. Startup refuses lower values. |
ANALYTICS_DEBUG_RETENTION_DAYS | 30 | Days to keep access_log_debug data |
ANALYTICS_HOURLY_RETENTION_DAYS | 60 | Days to keep hourly continuous aggregate data |
Logging
| Variable | Default | Description |
|---|---|---|
LOG_LEVEL | INFO | Root log level |
Advanced tuning
Change these only to fix a problem you have measured, such as a connection pool that runs dry or a log that rotates too often.
| Variable | Default | Description |
|---|---|---|
DB_MAX_OVERFLOW | 10 | Max connections above pool_size |
DB_POOL_SIZE | 5 | Database connection pool size |
DB_POOL_TIMEOUT | 30 | Connection pool timeout in seconds |
DB_POOL_RECYCLE | 3600 | Connection recycle time in seconds |
DB_POOL_PRE_PING | true | Enable pool pre-ping to check connections |
DB_MIGRATE_ON_STARTUP | true | Run alembic migrations at app startup. Set to false when migrations run as a separate deployment step (litestar database upgrade). Startup then doesn't check the schema revision, so run the migration before the new version starts, or startup and later requests fail where the code expects tables the old schema lacks. |
DB_STARTUP_WAIT_SECONDS | 30 | How long startup waits for the database before serving in degraded mode. 0 probes once. The app keeps re-probing in the background after this window and recovers on its own when the database answers. |
LOGPARSER_ENABLED | true | Enable log parser ingestion service |
LOGPARSER_POLL_INTERVAL | 1.0 | Interval in seconds to poll the log file for new entries |
LOGPARSER_SEND_LOGS | true | Send parsed logs to the database |
LOGPARSER_BATCH_SIZE | 100 | Max records before forced commit. |
LOGPARSER_COMMIT_INTERVAL | 5.0 | Maximum time interval in seconds between database commits. This will commit even if batch_size is not reached. |
GEOIP_REFRESH_DAYS | 7 | Re-download the GeoLite2 database when older than this many days |
LOKI_POLL_INTERVAL | 5.0 | Seconds between reads of each query. LOGPARSER_POLL_INTERVAL paces the file tail separately. |
LOKI_LOOKBACK | 60.0 | Seconds each read looks back for lines that reached Loki late. Every poll re-reads this whole window. The window never reaches back more than an hour, so values above 3600 behave as 3600. |
MAP_PUBLIC_IP_URL | https://api64.ipify.org?format=json | JSON endpoint used for public-IP discovery; the response must contain an 'ip' field. |
MAP_PUBLIC_IP_TIMEOUT | 3.0 | Timeout in seconds for public-IP discovery. |
MAP_SERVER_LOCATION_REFRESH_HOURS | 24 | Hours between re-detecting this server's public-IP location and updating its stored server locations. Formerly MAP_HOME_REFRESH_HOURS, which still works until 1.0. |
CROWDSEC_REQUEST_TIMEOUT | 10.0 | LAPI request timeout in seconds |
CROWDSEC_STREAM_POLL_INTERVAL | 15.0 | Seconds between decision-stream polls, which keep the banned-IP list and the live ban/unban updates current |
DROP_REFRESH_HOURS | 24 | Hours between DROP list downloads. A list is never fetched again within an hour of its last attempt, whatever this is set to. |
ABUSEIPDB_BLACKLIST_REFRESH_HOURS | 24 | Hours between blacklist downloads, from 6 to 36. The list is never fetched again within 5 hours of the last attempt, since free plans get 5 calls a day. If downloads keep failing, a list more than 72 hours old is no longer shown. Not used with ABUSEIPDB_BLACKLIST_FILE. |
ABUSEIPDB_REQUEST_TIMEOUT | 10.0 | AbuseIPDB request timeout in seconds |
ANALYTICS_CAGG_REFRESH_INTERVAL_MINUTES | 5 | Minutes between continuous aggregate refreshes |
ANALYTICS_COMPRESSION_AFTER_DAYS | 7 | Days after which to compress hypertable chunks |
LOG_DIR | logs | Directory for application log files |
LOG_MAIN_MAX_BYTES | 10485760 | Rotate the main JSONL log when it exceeds this size (bytes) |
LOG_MAIN_BACKUP_COUNT | 5 | Number of gzipped main-log archives to keep |
LOG_LOGIN_MAX_BYTES | 10485760 | Rotate the login log when it exceeds this size (bytes) |
LOG_LOGIN_BACKUP_COUNT | 5 | Number of gzipped login-log archives to keep |
SCHEDULER_ENABLED | true | Enable scheduled background tasks |
Developer settings
For working on GeoMetrikks itself. Deployments leave these at their
defaults. The container image sets APP_RUNTIME and APP_IMAGE_TAG itself.
| Variable | Default | Description |
|---|---|---|
APP_DEBUG | false | Puts the traceback in error responses and logs 401, 404 and 503 errors with one. Never in production. |
APP_ENVIRONMENT | production | Shown on Settings > About. DB_DROP_ON_STARTUP runs only when this is development. |
APP_RUNTIME | host | Execution runtime; container images set this to container. |
APP_IMAGE_TAG | - | Container image tag, set at image build time. |
DB_ECHO | false | Log every SQL statement |
DB_ECHO_POOL | false | Log connection pool checkouts and returns |
DB_POOL_DISABLED | false | Open a new connection for every session instead of pooling |
DB_DROP_ON_STARTUP | false | Drop every table and TimescaleDB object at startup, then migrate from scratch. Only runs when APP_ENVIRONMENT=development. |
LOGPARSER_SKIP_VALIDATION | false | Start parsing without first waiting for a line in a known format. Auto-detection still picks the format from the first parseable line. |
SCHEDULER_LOCATION_REFRESH_INTERVAL_MINUTES | 10 | Minutes between GeoLocation.last_hit refresh jobs |
VITE_DEV_MODE | false | Start vite development server. |
VITE_USE_SERVER_LIFESPAN | true | Auto start and stop vite processes when running in development mode. |
VITE_HOST | 0.0.0.0 | The host the vite process will listen on. Defaults to 0.0.0.0. |
VITE_PORT | 5173 | The port to start vite on. Default is 5173. |
VITE_HTTP2 | true | Enable HTTP/2 for the Vite development server. |