-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration
Wiki Publisher edited this page Jan 23, 2026
·
1 revision
Grimnir Radio is configured via environment variables or configuration files.
HTTP Server:
GRIMNIR_HTTP_BIND=0.0.0.0 # Bind address (default: 0.0.0.0)
GRIMNIR_HTTP_PORT=8080 # HTTP port (default: 8080)Database:
GRIMNIR_DB_BACKEND=postgres # postgres, mysql, or sqlite
GRIMNIR_DB_DSN=postgres://user:pass@host:5432/db?sslmode=disable
# Examples:
# PostgreSQL: postgres://grimnir:password@localhost:5432/grimnir_radio?sslmode=disable
# MySQL: mysql://grimnir:password@tcp(localhost:3306)/grimnir_radio?parseTime=true
# SQLite: sqlite:///var/lib/grimnir-radio/grimnir.dbAuthentication:
GRIMNIR_JWT_SIGNING_KEY=your-secret-key-here # Required! Use strong random stringFilesystem (default):
GRIMNIR_MEDIA_ROOT=/var/lib/grimnir-radio/mediaS3-Compatible:
# AWS S3
GRIMNIR_S3_BUCKET=my-media-bucket
GRIMNIR_S3_REGION=us-east-1
AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
# MinIO
GRIMNIR_S3_BUCKET=media
GRIMNIR_S3_ENDPOINT=https://minio.example.com
GRIMNIR_S3_ACCESS_KEY_ID=minioadmin
GRIMNIR_S3_SECRET_ACCESS_KEY=minioadmin
GRIMNIR_S3_USE_PATH_STYLE=true
# DigitalOcean Spaces
GRIMNIR_S3_BUCKET=my-space
GRIMNIR_S3_ENDPOINT=https://nyc3.digitaloceanspaces.com
GRIMNIR_S3_REGION=nyc3
# CloudFront CDN
GRIMNIR_S3_PUBLIC_BASE_URL=https://d1234567890.cloudfront.netEvent Bus - Redis:
GRIMNIR_REDIS_ADDR=localhost:6379
GRIMNIR_REDIS_PASSWORD=your-redis-password
GRIMNIR_REDIS_DB=0Event Bus - NATS:
GRIMNIR_NATS_URL=nats://localhost:4222
GRIMNIR_NATS_TOKEN=your-nats-tokenLeader Election:
GRIMNIR_LEADER_ELECTION_ENABLED=true
GRIMNIR_INSTANCE_ID=instance-1 # Unique per instanceMetrics:
GRIMNIR_METRICS_BIND=0.0.0.0:9000 # Prometheus metrics endpointTracing:
GRIMNIR_TRACING_ENABLED=true
GRIMNIR_OTLP_ENDPOINT=localhost:4317 # OpenTelemetry collector
GRIMNIR_TRACING_SAMPLE_RATE=0.1 # Sample 10% of tracesGRIMNIR_SCHEDULER_LOOKAHEAD_MINUTES=2880 # 48 hours (default)MEDIAENGINE_GRPC_ADDR=localhost:9091 # Media engine gRPC address
MEDIAENGINE_GRPC_BIND=0.0.0.0 # Media engine bind address
MEDIAENGINE_GRPC_PORT=9091 # Media engine gRPC portCreate .env in the working directory:
# Copy from example
cp .env.example .env
# Edit with your settings
nano .envExample .env:
GRIMNIR_HTTP_PORT=8080
GRIMNIR_DB_BACKEND=postgres
GRIMNIR_DB_DSN=postgres://grimnir:password@localhost:5432/grimnir_radio?sslmode=disable
GRIMNIR_JWT_SIGNING_KEY=$(openssl rand -base64 32)
GRIMNIR_MEDIA_ROOT=/var/lib/grimnir-radio/media
GRIMNIR_REDIS_ADDR=localhost:6379YAML configuration support is planned for version 1.2.0.
See Docker Deployment for docker-compose.yml examples.
Grimnir Radio validates configuration on startup. Check logs for errors:
# Docker
docker-compose logs grimnirradio | grep -i error
# Systemd
journalctl -u grimnir-radio | grep -i error
# Direct
./grimnirradio serve 2>&1 | grep -i errorGenerate a strong random key:
# OpenSSL (recommended)
openssl rand -base64 32
# Or use uuidgen
uuidgen | sha256sum | cut -d' ' -f1Never use the default or example keys in production!
# Use SSL connections
GRIMNIR_DB_DSN=postgres://grimnir:password@host:5432/db?sslmode=require
# Restrict database user permissions
# - Grant only necessary permissions to grimnir user
# - Use separate users for migrations vs runtime# Set password
GRIMNIR_REDIS_PASSWORD=strong-password
# Or use TLS
GRIMNIR_REDIS_ADDR=rediss://localhost:6380 # Note: rediss://# Use IAM roles (AWS) instead of access keys when possible
# Limit S3 bucket permissions to specific prefix
# Enable encryption at rest
# Use VPC endpoints for private accessSee Performance Tuning and Database Optimization for detailed tuning guides.
GRIMNIR_ENV=development
GRIMNIR_DB_BACKEND=sqlite
GRIMNIR_DB_DSN=sqlite:///grimnir_dev.db
GRIMNIR_MEDIA_ROOT=./media
GRIMNIR_HTTP_PORT=8080
GRIMNIR_TRACING_ENABLED=falseGRIMNIR_ENV=staging
GRIMNIR_DB_BACKEND=postgres
GRIMNIR_DB_DSN=postgres://grimnir:password@staging-db:5432/grimnir_radio?sslmode=require
GRIMNIR_REDIS_ADDR=staging-redis:6379
GRIMNIR_S3_BUCKET=staging-media
GRIMNIR_TRACING_ENABLED=true
GRIMNIR_TRACING_SAMPLE_RATE=1.0GRIMNIR_ENV=production
GRIMNIR_DB_BACKEND=postgres
GRIMNIR_DB_DSN=postgres://grimnir:password@prod-db:5432/grimnir_radio?sslmode=require
GRIMNIR_REDIS_ADDR=prod-redis:6379
GRIMNIR_REDIS_PASSWORD=strong-password
GRIMNIR_S3_BUCKET=production-media
GRIMNIR_S3_REGION=us-east-1
GRIMNIR_LEADER_ELECTION_ENABLED=true
GRIMNIR_TRACING_ENABLED=true
GRIMNIR_TRACING_SAMPLE_RATE=0.1For complete reference, see:
-
.env.examplein repository - Environment Variables
- Engineering Spec - Technical details
- Check file location (must be in working directory or specify path)
- Check file permissions (must be readable)
- Check for syntax errors (no quotes around values unless needed)
# Test connection manually
psql "$GRIMNIR_DB_DSN"
# Or for MySQL
mysql --defaults-file=<(echo "[client]"; echo "url=$GRIMNIR_DB_DSN")# Verify environment variables are set
printenv | grep GRIMNIR
# Docker: Pass via docker-compose.yml
environment:
- GRIMNIR_HTTP_PORT=8080
# Or via .env file
env_file:
- .env- Production Deployment - Production configuration
- Multi-Instance Setup - Cluster configuration
- Observability - Monitoring configuration
- Troubleshooting - Common configuration issues
Getting Started
Core Concepts
Deployment
Integration
Operations
Development
Reference