Skip to main content

Configuration

FastGIS is configured through environment variables (.env file or shell environment at deploy time).

Core variables

VariableRequiredDefaultDescription
SECRET_KEYSession signing key (random 32+ chars)
GRASS_GISDBASEAbsolute path to the GRASS database directory
MAPSERVER_URLBase URL of the MapServer instance
REDIS_URLredis://localhost:6379Redis connection string
ADMIN_API_KEYBootstrap admin API key on first startup
ADMIN_USERNAMEBootstrap admin web user on first startup
ADMIN_PASSWORDBootstrap admin password
ADMIN_EMAILBootstrap admin email
APP_BASE_URLPublic base URL (used in share links)
ALLOWED_ORIGINS*Comma-separated CORS allowed origins
MAX_CONCURRENT_TASKS4Maximum simultaneously running GRASS tasks
TASK_TIMEOUT_SECONDS600Kill a task after this many seconds
DATA_ROOT/dataRoot directory for all on-disk data (curvature DB, tiles, support data, …)

GRASS vector attribute backend

VariableRequiredDefaultDescription
GRASS_DB_DEFAULT_DRIVERsqliteDefault vector attribute backend (sqlite or pg)
POSTGRES_HOSTPostgreSQL/PostGIS host
POSTGRES_PORT5432PostgreSQL port
POSTGRES_DBPostgreSQL database name
POSTGRES_USERPostgreSQL user
POSTGRES_PASSWORDPostgreSQL password
POSTGRES_SCHEMApublicPostgreSQL schema for app-side DB tools

New environments can choose their vector attribute backend per create request. Setting GRASS_DB_DEFAULT_DRIVER=pg means new environments default to PostgreSQL. Existing environments keep their own db.connect state; changing the default only affects environments created afterward.

Valhalla routing

VariableRequiredDefaultDescription
VALHALLA_URLhttp://valhalla:8002Internal URL of the Valhalla service
VALHALLA_USE_TILES_IGNORE_PBFFalseSkip tile rebuild on container restart — set True after first build
VALHALLA_FORCE_REBUILDFalseForce full tile rebuild on next restart
VALHALLA_BUILD_ELEVATIONTrueInclude elevation data in tile build
VALHALLA_BUILD_ADMINSTrueBuild admin boundary database
VALHALLA_BUILD_TIME_ZONESTrueBuild timezone database
VALHALLA_SERVER_THREADS2Threads for tile serving
OVERPASS_URLhttps://overpass-api.de/api/interpreterOverpass API endpoint for speed cameras and POI

Curvature database

VariableRequiredDefaultDescription
CURVATURE_DB$DATA_ROOT/curvature/roads.dbPath to the curvature SQLite database
CURVATURE_THRESHOLDbothFallback threshold if not specified per-request (300, 1000, or both). The rebuild API curvature_threshold field takes precedence over this env var.

Offline data tiles

VariableRequiredDefaultDescription
POI_TILE_DIR$DATA_ROOT/poi-tilesDirectory containing 1°×1° POI SQLite tiles
CURV_TILE_DIR$DATA_ROOT/curv-tilesDirectory containing 1°×1° curvature SQLite tiles
POI_BUNDLE_DIR$DATA_ROOT/poi-bundlesDirectory for per-region monolithic POI bundles (legacy)
SUPPORT_DATA_DIR$DATA_ROOT/support_dataKMZ + WorldPop CSV files used by the curvature pipeline
REGIONS_YML/app/regions.ymlPath to the regions configuration file

Data pipeline control (startup skip flags)

VariableDefaultDescription
FETCH_REGION_DATAtrueSet false to skip fetch_region_data.py on container start after first build
REBUILD_CURVATURE_DBfalseSet true to force a full curvature DB rebuild on next start

MapServer

FastGIS generates a Mapfile per GRASS environment on demand. The Mapfile is written to a directory read by MapServer. Ensure MapServer has read access to GRASS_GISDBASE and write access to the Mapfile output directory.

Redis

Named workspace sessions, routing cache, and field session metadata are stored in Redis. If Redis is unavailable:

  • Session API returns 503 errors (autosave via localStorage still works)
  • Routing speed-camera / POI caches are bypassed (live Overpass requests instead)
  • Field session registry falls back to WFS-layer scanning on the mobile client

.env example

SECRET_KEY=change-me-to-a-random-32-char-string
GRASS_GISDBASE=/data/grassdb
MAPSERVER_URL=http://mapserver/cgi-bin/mapserv
REDIS_URL=redis://redis:6379/0
ALLOWED_ORIGINS=https://fastgis.example.com

# Vector attribute backend
GRASS_DB_DEFAULT_DRIVER=pg
POSTGRES_HOST=postgis
POSTGRES_PORT=5432
POSTGRES_DB=fastgis
POSTGRES_USER=fastgis
POSTGRES_PASSWORD=change-me
POSTGRES_SCHEMA=public

# Routing
VALHALLA_URL=http://valhalla:8002
VALHALLA_USE_TILES_IGNORE_PBF=True
OVERPASS_URL=https://overpass-api.de/api/interpreter

# Data root
DATA_ROOT=/data

# Offline data tiles
POI_TILE_DIR=/data/poi-tiles
CURV_TILE_DIR=/data/curv-tiles
SUPPORT_DATA_DIR=/data/support_data
REGIONS_YML=/app/regions.yml

# Skip startup rebuilds (set after first successful build)
FETCH_REGION_DATA=false
REBUILD_CURVATURE_DB=false