Skip to Content
Reference
Next: these pages describe unreleased changes on the develop branch. Read the docs for the current release

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

VariableDefaultDescription
APP_AUTH_DISABLEDfalseDisable 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_USERadminAdmin login username
APP_ADMIN_PASSWORD-Admin login password (required unless APP_AUTH_DISABLED=true or OpenID Connect (OIDC_*) is configured)
APP_SESSION_SECUREfalseMark 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_DAYS7How 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

VariableDefaultDescription
DB_USERgeouserDatabase user
DB_PASSWORD-Database password
DB_HOSTlocalhostDatabase host
DB_PORT5432Database port
DB_DATABASEgeometrikksDatabase name

Log parser

VariableDefaultDescription
LOGPARSER_LOG_PATHS/var/log/access/access.logAccess log files to tail. Env accepts a single path or a JSON list of paths. Default: /var/log/access/access.log
LOGPARSER_LOG_FORMATSautoLog 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_LINESfalseStore 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.
LOGPARSER_ERROR_LOG_PATHS(empty)Error log files to tail. Env accepts a single path or a JSON list of paths. Empty (default), or a blank string, turns error logs off on this instance.
LOGPARSER_ERROR_LOG_FORMATSnginxFormat per error log path. Env accepts one value for every path, or a JSON list matching LOGPARSER_ERROR_LOG_PATHS by position. Only nginx in this version.
LOGPARSER_ERROR_LOG_TIMEZONESTZ, else UTCIANA time zone per error log path, for timestamps written in local time with no offset. Env accepts one value for every path, or a JSON list matching LOGPARSER_ERROR_LOG_PATHS by position. Default: the zone named by the TZ environment variable when it is a valid IANA name (a leading : is dropped), else UTC.
LOGPARSER_ERROR_LOG_SERVER_NAMESfirst server nameServer name recorded per error log path. Env accepts one value for every path, or a JSON list matching LOGPARSER_ERROR_LOG_PATHS by position. Default: the first LOGPARSER_SERVER_NAME.

GeoIP

VariableDefaultDescription
GEOIP_DB_PATHdata/geoip/GeoLite2-City.mmdbPath 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_PATHdata/geoip/GeoLite2-ASN.mmdbPath to the GeoLite2 ASN database file
GEOIP_ASN_ENABLEDtrueDownload 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.

VariableDefaultDescription
PUID1000User 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.
PGID1000Group 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/nginxHost 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_USERgeouserDatabase 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_PASSWORDDB_PASSWORD, else geopassPassword 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_DBgeometrikksDatabase 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_CONCURRENCY1Worker 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_CONCURRENCY1Same as LITESTAR_WEB_CONCURRENCY, which wins when both are set.
GRANIAN_WORKERS1Same 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

VariableDefaultDescription
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_FORMATSautoLog 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

VariableDefaultDescription
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_LOCATIONtrueLook 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

VariableDefaultDescription
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_DURATION4hDefault duration for manual bans (Go duration string)
CROWDSEC_VERIFY_TLStrueVerify TLS when LAPI uses https

DROP lists

VariableDefaultDescription
DROP_ENABLEDtrueDownload 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

VariableDefaultDescription
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_ENABLEDfalseAllow 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_ENABLEDfalseDownload 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_ISSUER or OIDC_REDIRECT_URI uses plain http on a host other than localhost or a loopback IP address.
  • OIDC_ISSUER or OIDC_REDIRECT_URI carries credentials, a query string or a fragment.
  • The path of OIDC_REDIRECT_URI is not /api/v1/auth/oidc/callback.
  • Neither OIDC_ALLOWED_USERS nor OIDC_ALLOWED_GROUPS is set.
  • OIDC_SCOPES does not include openid.
  • OIDC_CA_BUNDLE names a file that is missing or unreadable.
  • APP_AUTH_DISABLED=true is set.
  • OIDC_REDIRECT_URI is https and APP_SESSION_SECURE is not true.
VariableDefaultDescription
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_CLAIMgroupsClaim that carries group membership, read from the ID token and the userinfo endpoint.
OIDC_SCOPESopenid profile email groupsSpace-separated scopes requested at login. Must include openid.
OIDC_PROVIDER_NAMESSOLabel on the login button: "Sign in with {name}".
OIDC_LOGOUT_IDPfalseOn 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

VariableDefaultDescription
APP_MODEfullEither 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_ADVISORYtrueWarn 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_CHECKtrueCheck 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

VariableDefaultDescription
ANALYTICS_RAW_RETENTION_DAYS180Days to keep raw geo_events, access_logs and error_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_DAYS30Days to keep access_log_debug data
ANALYTICS_HOURLY_RETENTION_DAYS60Days to keep hourly continuous aggregate data

Logging

VariableDefaultDescription
LOG_LEVELINFORoot 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.

VariableDefaultDescription
DB_MAX_OVERFLOW10Max connections above pool_size
DB_POOL_SIZE5Database connection pool size
DB_POOL_TIMEOUT30Connection pool timeout in seconds
DB_POOL_RECYCLE3600Connection recycle time in seconds
DB_POOL_PRE_PINGtrueEnable pool pre-ping to check connections
DB_MIGRATE_ON_STARTUPtrueRun 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_SECONDS30How 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_ENABLEDtrueEnable log parser ingestion service
LOGPARSER_POLL_INTERVAL1.0Interval in seconds to poll the log file for new entries
LOGPARSER_SEND_LOGStrueSend parsed logs to the database
LOGPARSER_BATCH_SIZE100Max records before forced commit.
LOGPARSER_COMMIT_INTERVAL5.0Maximum time interval in seconds between database commits. This will commit even if batch_size is not reached.
GEOIP_REFRESH_DAYS7Re-download the GeoLite2 database when older than this many days
LOKI_POLL_INTERVAL5.0Seconds between reads of each query. LOGPARSER_POLL_INTERVAL paces the file tail separately.
LOKI_LOOKBACK60.0Seconds 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_URLhttps://api64.ipify.org?format=jsonJSON endpoint used for public-IP discovery; the response must contain an 'ip' field.
MAP_PUBLIC_IP_TIMEOUT3.0Timeout in seconds for public-IP discovery.
MAP_SERVER_LOCATION_REFRESH_HOURS24Hours 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_TIMEOUT10.0LAPI request timeout in seconds
CROWDSEC_STREAM_POLL_INTERVAL15.0Seconds between decision-stream polls, which keep the banned-IP list and the live ban/unban updates current
DROP_REFRESH_HOURS24Hours 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_HOURS24Hours 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_TIMEOUT10.0AbuseIPDB request timeout in seconds
ANALYTICS_CAGG_REFRESH_INTERVAL_MINUTES5Minutes between continuous aggregate refreshes
ANALYTICS_COMPRESSION_AFTER_DAYS7Days after which to compress hypertable chunks
LOG_DIRlogsDirectory for application log files
LOG_MAIN_MAX_BYTES10485760Rotate the main JSONL log when it exceeds this size (bytes)
LOG_MAIN_BACKUP_COUNT5Number of gzipped main-log archives to keep
LOG_LOGIN_MAX_BYTES10485760Rotate the login log when it exceeds this size (bytes)
LOG_LOGIN_BACKUP_COUNT5Number of gzipped login-log archives to keep
SCHEDULER_ENABLEDtrueEnable 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.

VariableDefaultDescription
APP_DEBUGfalsePuts the traceback in error responses and logs 401, 404 and 503 errors with one. Never in production.
APP_ENVIRONMENTproductionShown on Settings > About. DB_DROP_ON_STARTUP runs only when this is development.
APP_RUNTIMEhostExecution runtime; container images set this to container.
APP_IMAGE_TAG-Container image tag, set at image build time.
DB_ECHOfalseLog every SQL statement
DB_ECHO_POOLfalseLog connection pool checkouts and returns
DB_POOL_DISABLEDfalseOpen a new connection for every session instead of pooling
DB_DROP_ON_STARTUPfalseDrop every table and TimescaleDB object at startup, then migrate from scratch. Only runs when APP_ENVIRONMENT=development.
LOGPARSER_SKIP_VALIDATIONfalseStart 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_MINUTES10Minutes between GeoLocation.last_hit refresh jobs
VITE_DEV_MODEfalseStart vite development server.
VITE_USE_SERVER_LIFESPANtrueAuto start and stop vite processes when running in development mode.
VITE_HOST0.0.0.0The host the vite process will listen on. Defaults to 0.0.0.0.
VITE_PORT5173The port to start vite on. Default is 5173.
VITE_HTTP2trueEnable HTTP/2 for the Vite development server.

On this page