Configuration Guide

November 23, 2025 ยท View on GitHub

This guide covers all configuration options for Monoscope.

Configuration Methods

Monoscope can be configured through:

  1. Environment variables (recommended)
  2. .env file
  3. Docker Compose environment section

Core Configuration

Server Settings

VariableDescriptionDefaultRequired
PORTHTTP server port8080No
GRPC_PORTgRPC server port for OpenTelemetry4317No
ENVIRONMENTEnvironment (DEV/STAGING/PROD)DEVNo
HOST_URLPublic URL of your Monoscope instancehttp://localhost:8080No

Database Configuration

VariableDescriptionDefaultRequired
DATABASE_URLPostgreSQL connection string-Yes
MIGRATE_AND_INITIALIZE_ON_STARTRun migrations on startupTrueNo
MIGRATIONS_DIRPath to migration files/app/static/migrations/No

Example DATABASE_URL:

postgresql://user:password@localhost:5432/monoscope?sslmode=disable

Authentication

Basic Authentication

VariableDescriptionDefault
BASIC_AUTH_ENABLEDEnable basic authTrue
BASIC_AUTH_USERNAMEUsernameadmin
BASIC_AUTH_PASSWORDPasswordchangeme

Auth0 Configuration

VariableDescriptionRequired
AUTH0_DOMAINAuth0 domainYes (if using Auth0)
AUTH0_CLIENT_IDAuth0 client IDYes (if using Auth0)
AUTH0_SECRETAuth0 client secretYes (if using Auth0)
AUTH0_CALLBACKCallback URLYes (if using Auth0)
AUTH0_LOGOUT_REDIRECTLogout redirect URLYes (if using Auth0)

Storage & Data Processing

VariableDescriptionDefault
API_KEY_ENCRYPTION_SECRET_KEYSecret for API key encryption (min 32 chars)-
MESSAGES_PER_PUBSUB_PULL_BATCHBatch size for message processing100
ENABLE_BACKGROUND_JOBSEnable background job processingTrue
MAX_CONCURRENT_JOBSMaximum concurrent background jobs4
ENABLE_DAILY_JOB_SCHEDULINGEnable daily scheduled jobsTrue

OpenTelemetry & Ingestion

VariableDescriptionDefault
TELEMETRY_PROJECT_IDProject ID for telemetry data-
TELEMETRY_SERVICE_NAMEService name for telemetrymonoscope
ENABLE_EVENTS_TABLE_UPDATESEnable events table updatesTrue

Notification Services

Email Configuration (SendGrid)

VariableDescription
SENDGRIDAPIKEYSendGrid API key

Email Configuration (SMTP)

VariableDescription
SMTP_HOSTSMTP server hostname
SMTP_PORTSMTP server port
SMTP_USERNAMESMTP username
SMTP_PASSWORDSMTP password
SMTP_SENDERFrom email address

Slack Integration

VariableDescription
SLACK_CLIENT_IDSlack app client ID
SLACK_CLIENT_SECRETSlack app client secret
SLACK_REDIRECT_URISlack OAuth redirect URI
SLACK_BOT_TOKENSlack bot token

Discord Integration

VariableDescription
DISCORD_CLIENT_IDDiscord app client ID
DISCORD_CLIENT_SECRETDiscord app client secret
DISCORD_REDIRECT_URIDiscord OAuth redirect URI
DISCORD_BOT_TOKENDiscord bot token
DISCORD_WEBHOOK_URLDiscord webhook URL

AI & LLM Configuration

VariableDescriptionDefault
OPENAI_API_KEYOpenAI API key for AI features-
OPENAI_BASE_URLCustom OpenAI API endpointhttps://api.openai.com

Feature Flags

VariableDescriptionDefault
SHOW_DEMO_PROJECTShow demo project in UIFalse
ENABLE_BROWSER_MONITORINGEnable browser monitoringTrue
ENABLE_FREETIEREnable free tier limitationsFalse
ENABLE_REPLAY_SERVICEEnable session replayFalse

Logging

VariableDescriptionDefaultOptions
LOGGING_DESTINATIONWhere to send logsStdOutStdOut, GCP
LOG_LEVELLogging levelinfotrace, info, attention

Example Configurations

Minimal Development Setup

DATABASE_URL=postgresql://postgres:postgres@localhost:5432/monoscope
BASIC_AUTH_ENABLED=True
BASIC_AUTH_USERNAME=admin
BASIC_AUTH_PASSWORD=changeme
API_KEY_ENCRYPTION_SECRET_KEY=monoscope123456monoscope1234567

Production with Auth0

DATABASE_URL=postgresql://prod_user:secure_pass@db.example.com:5432/monoscope?sslmode=require
ENVIRONMENT=PROD
HOST_URL=https://monoscope.example.com

# Disable basic auth
BASIC_AUTH_ENABLED=False

# Auth0 configuration
AUTH0_DOMAIN=example.auth0.com
AUTH0_CLIENT_ID=your-client-id
AUTH0_SECRET=your-secret
AUTH0_CALLBACK=https://monoscope.example.com/auth_callback
AUTH0_LOGOUT_REDIRECT=https://monoscope.example.com

# Security
API_KEY_ENCRYPTION_SECRET_KEY=your-32-character-or-longer-secret-key

# Email notifications
SENDGRIDAPIKEY=your-sendgrid-key

High-Performance Configuration

# Increase batch processing
MESSAGES_PER_PUBSUB_PULL_BATCH=500
MAX_CONCURRENT_JOBS=16

# Optimize database connections
DATABASE_URL=postgresql://user:pass@localhost:5432/monoscope?pool_size=50

# Enable all performance features
ENABLE_BACKGROUND_JOBS=True
ENABLE_EVENTS_TABLE_UPDATES=True

Configuration Best Practices

  1. Use strong secrets: Generate random strings for API_KEY_ENCRYPTION_SECRET_KEY

    openssl rand -hex 32
    
  2. Secure database connections: Always use SSL in production

    DATABASE_URL=postgresql://...?sslmode=require
    
  3. Use .env files: Keep secrets out of docker-compose.yml

    # .env file
    SENSITIVE_KEY=secret_value
    
    # docker-compose.yml
    environment:
      - SENSITIVE_KEY=${SENSITIVE_KEY}
    
  4. Set appropriate resource limits: Configure MAX_CONCURRENT_JOBS based on available CPU cores

  5. Enable only needed integrations: Don't configure unused notification services

Troubleshooting Configuration

Verify configuration is loaded

docker-compose exec monoscope env | grep MONOSCOPE

Check for configuration errors

docker-compose logs monoscope | grep -i error

Test database connection

docker-compose exec monoscope psql $DATABASE_URL -c "SELECT 1"