Configuration¶
Configure Tempo for your environment using configuration files or environment variables.
Configuration Methods¶
Tempo can be configured via:
- Configuration files (
appsettings.json) - For local development - Environment variables - For Docker deployments and production
Database Connection¶
Local Development (appsettings.json)¶
{
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Port=5432;Database=tempo;Username=postgres;Password=postgres"
}
}
Docker (Environment Variable)¶
ConnectionStrings__DefaultConnection="Host=postgres;Port=5432;Database=tempo;Username=postgres;Password=postgres"
Note: In Docker, use double underscores (__) for nested configuration keys.
Media Storage¶
Local Development (appsettings.json)¶
Docker (Environment Variables)¶
Elevation Calculation¶
Configure elevation smoothing thresholds:
Or via environment variables:
CORS Configuration¶
Allow specific origins for API access:
In Docker:
JWT Authentication¶
Important: Before deploying to production, you must set the JWT secret key.
Generate a Secure JWT Secret Key¶
Set in Docker Compose¶
JWT Configuration Options¶
JWT__SecretKey- JWT signing key (REQUIRED in production, minimum 32 characters)JWT__Issuer- JWT issuer (default: "Tempo")JWT__Audience- JWT audience (default: "Tempo")JWT__ExpirationDays- Token expiration in days (default: 7)JWT__RememberMeExpirationDays- Token expiration when "Remember me" is enabled (default: 30)
Security Requirements¶
- The JWT secret key should be at least 32 characters and cryptographically random
- Use HTTPS in production (session cookies are
Secure; see Reverse Proxy and Login Cookies) - Change the default database password in production
- Store the JWT secret key securely (environment variables, secrets manager, etc.)
CARTO Basemaps (Maps)¶
Workout maps use CARTO raster tiles (Dark Matter / Voyager). CARTO now requires a free API key; without one, tiles show an "API key required" watermark.
- Request a key at carto.com/basemaps/apikey (free within CARTO's fair use limit; no CARTO account required).
- Configure the key on the API service (not the frontend). Do not commit the key to git.
Docker¶
Add to a gitignored .env file in your deployment directory:
Both docker-compose.yml and docker-compose.prod.yml pass this to the API as CartoBasemaps__ApiKey. Restart the API after changing the key.
Local development¶
Set the environment variable before starting the API:
Or add to api/appsettings.Development.json (local only; do not commit real keys):
After configuring, hard-refresh the browser — CARTO and your browser may cache watermarked tiles briefly.
Logging profiles¶
API console verbosity is controlled by one named profile — host config (environment / appsettings), restart to change. Not a Settings UI toggle. Do not use Microsoft.Extensions.Logging Logging:LogLevel or Serilog__MinimumLevel__Override__… as the public interface; the named profile owns Serilog levels.
| Profile | Behavior |
|---|---|
standard (default) |
Tempo Information stays (imports, backfills, auth, media). Microsoft / System at Warning (hosting lifetime still prints). No EF SQL dumps. Request middleware logs 5xx and unhandled exceptions only. |
debug |
EF SQL and non-probe request traces at Information. Profile name debug is not Serilog level Debug. |
Successful /health and /ready request lines are omitted on both profiles (failed probes still log). Empty or unset profile → standard. Unknown values refuse to start (allowed: standard, debug; case-insensitive).
Docker¶
Official Compose passes Tempo__Logging__Profile from .env:
Restart the API after changing. Official Compose Postgres also runs with log_checkpoints=off; setting debug does not turn checkpoints back on (see production logging).
Local development¶
Or in api/appsettings.Development.json:
Unset still means standard even when ASPNETCORE_ENVIRONMENT=Development.
Startup backfills¶
Some upgrades add data that older workouts don't have yet (route previews, timer time, device laps, zone seconds, best efforts, ...). Tempo fills it in with backfills. Each logs <name> backfill: N of N and, once a run finds nothing to do (0 of 0), is recorded complete in the CompletedBackfills table.
Normal starts run none. After migrations, one query checks the records:
| Startup log | Meaning |
|---|---|
Startup backfills: all 8 complete; none run |
Nothing to do. |
Startup backfills: no workouts yet, nothing to fill; recorded all 8 complete |
New install. |
WRN Startup backfills: N of 8 have not completed on this library (...) |
An install that skipped versions, or a restore cut short. Run the command below once. |
When backfills run¶
- Tempo ZIP restore: repairs the restored workouts before the job reports Completed, so a finished restore is fully usable without a restart.
- The
backfillcommand: runs every backfill not yet recorded, records them, and exits. Safe while the API is running. Exit code 0 when all are recorded complete, 1 otherwise (see the log). - Opt-in at startup (for hosts where you can't run a command in the container), via
Tempo:Backfills:OnStartup:
| Value | Behavior |
|---|---|
skip (default) |
Run none; check and warn as above. |
run |
Run the pending ones in the background once, without blocking browsing or /ready. |
force |
Run all of them in the background once, recorded or not. |
Empty or unset → skip. Unknown values refuse to start (allowed: skip, run, force; case-insensitive). Host config only; restart to change. Set run back to skip (or remove it) once the log says Backfills finished: all 8 recorded complete.
Environment Variables Reference¶
All configuration can be set via environment variables using the double underscore (__) notation for nested keys:
| Configuration Key | Environment Variable | Default |
|---|---|---|
ConnectionStrings:DefaultConnection |
ConnectionStrings__DefaultConnection |
- |
MediaStorage:RootPath |
MediaStorage__RootPath |
./media |
MediaStorage:MaxFileSizeBytes |
MediaStorage__MaxFileSizeBytes |
52428800 |
ElevationCalculation:NoiseThresholdMeters |
ElevationCalculation__NoiseThresholdMeters |
2.0 |
ElevationCalculation:MinDistanceMeters |
ElevationCalculation__MinDistanceMeters |
10.0 |
CartoBasemaps:ApiKey |
CartoBasemaps__ApiKey or CARTO_BASEMAPS_API_KEY (via compose .env) |
empty (watermarked tiles) |
Tempo:Logging:Profile |
Tempo__Logging__Profile or TEMPO_LOGGING_PROFILE (via compose .env) |
standard |
Tempo:Backfills:OnStartup |
Tempo__Backfills__OnStartup or TEMPO_BACKFILLS_ON_STARTUP (via compose .env) |
skip |
CORS:AllowedOrigins |
CORS__AllowedOrigins |
http://localhost:3000 |
Cookie:Secure |
Cookie__Secure or TEMPO_COOKIE_SECURE (via compose .env) |
unset (always Secure in Production) — see Reverse Proxy |
Cookie:Domain |
Cookie__Domain |
unset (host-only cookie) |
Tempo:Proxy:TrustedNetworks |
Tempo__Proxy__TrustedNetworks |
loopback + private ranges |
JWT:SecretKey |
JWT__SecretKey |
- (REQUIRED in production) |
JWT:Issuer |
JWT__Issuer |
Tempo |
JWT:Audience |
JWT__Audience |
Tempo |
JWT:ExpirationDays |
JWT__ExpirationDays |
7 |
JWT:RememberMeExpirationDays |
JWT__RememberMeExpirationDays |
30 |
Next Steps¶
- Import your first workout
- Learn about production deployment