Environment Configuration
Environment Configuration
Section titled “Environment Configuration”This guide provides a complete reference for all environment variables used in Querri deployment.
Configuration File
Section titled “Configuration File”Querri uses a .env-prod file located in the repository root (/path/to/Querri/.env-prod). This file is referenced by all services via the env_file directive in docker-compose.yml.
Required vs Optional Variables
Section titled “Required vs Optional Variables”Required Variables (Must Configure)
Section titled “Required Variables (Must Configure)”These variables must be configured for Querri to function:
MONGO_INITDB_ROOT_USERNAME- MongoDB admin usernameMONGO_INITDB_ROOT_PASSWORD- MongoDB admin passwordWORKOS_API_KEY- WorkOS API key for authenticationWORKOS_CLIENT_ID- WorkOS client identifierJWT_PRIVATE_KEY- Private key for JWT token signingAZURE_OPENAI_ENDPOINTorOPENAI_API_KEY- AI provider credentials
Optional Variables
Section titled “Optional Variables”These variables have defaults or are optional features:
SERVER_API_REPLICAS- Number of API service replicas (default: 4)STRIPE_KEY- Stripe integration for billingPRISMATIC_KEY- Prismatic integration marketplaceSENDGRID_API_KEY- Email sending via SendGrid- Storage and analytics configurations
Environment Variables Reference
Section titled “Environment Variables Reference”Application Environment
Section titled “Application Environment”ENVIRONMENT
Section titled “ENVIRONMENT”ENVIRONMENT=productionValues: production, development
Description: Determines application behavior and logging levels
Required: Yes
COOKIE_DOMAIN
Section titled “COOKIE_DOMAIN”COOKIE_DOMAIN=app.querri.comDescription: Domain for session cookies Required: Yes (production)
SDLC_ENVIRONMENT
Section titled “SDLC_ENVIRONMENT”SDLC_ENVIRONMENT=prodValues: prod, dev, staging
Description: Software development lifecycle environment identifier
Required: Yes
Web Application Configuration
Section titled “Web Application Configuration”PUBLIC_BASE_URL
Section titled “PUBLIC_BASE_URL”PUBLIC_BASE_URL="https://app.yourcompany.com"Description: Base URL for the application (used in emails, redirects) Required: Yes
PUBLIC_DOMAIN
Section titled “PUBLIC_DOMAIN”PUBLIC_DOMAIN="https://app.yourcompany.com"Description: Primary domain for the application Required: Yes
PUBLIC_API_GATEWAY_LINK
Section titled “PUBLIC_API_GATEWAY_LINK”PUBLIC_API_GATEWAY_LINK="/api"Description: API gateway path relative to base URL
Default: /api
PUBLIC_LOGOUT_URL
Section titled “PUBLIC_LOGOUT_URL”PUBLIC_LOGOUT_URL="/hub/signout"Description: Logout endpoint path
Default: /hub/signout
PUBLIC_ISDEV
Section titled “PUBLIC_ISDEV”PUBLIC_ISDEV=falseDescription: Enable development mode features
Values: true, false
Database Configuration
Section titled “Database Configuration”MongoDB Settings
Section titled “MongoDB Settings”# MongoDB HostMONGODB_HOST=mongoDescription: MongoDB hostname (use service name for Docker)
Default: mongo
# MongoDB PortMONGODB_PORT=27017Description: MongoDB port
Default: 27017
# MongoDB Root UsernameMONGO_INITDB_ROOT_USERNAME=querriDescription: MongoDB admin username Required: Yes
# MongoDB Root PasswordMONGO_INITDB_ROOT_PASSWORD=your_secure_password_hereDescription: MongoDB admin password Required: Yes Security: Use strong, randomly generated password
Alternative: MongoDB Connection String
Section titled “Alternative: MongoDB Connection String”# Full MongoDB Connection String (alternative to individual settings)MONGODB_CONNECTION_STRING=mongodb://username:password@host:27017/?authSource=adminDescription: Complete MongoDB connection URI Note: Overrides individual MONGODB_HOST, MONGODB_PORT settings if provided
Redis Configuration
Section titled “Redis Configuration”# Redis HostREDIS_HOST=redisDescription: Redis hostname (use service name for Docker)
Default: redis
# Redis PortREDIS_PORT=6379Description: Redis port
Default: 6379
# Redis Password (optional)REDIS_PASSWORD=Description: Redis password if authentication is enabled Optional: Leave empty for no authentication
Authentication (WorkOS)
Section titled “Authentication (WorkOS)”WorkOS provides SSO and authentication services.
# WorkOS API KeyWORKOS_API_KEY=sk_live_xxxxxxxxxxxxxDescription: WorkOS secret API key Required: Yes Location: WorkOS Dashboard > API Keys
# WorkOS Client IDWORKOS_CLIENT_ID=client_xxxxxxxxxxxxxDescription: WorkOS OAuth client ID Required: Yes Location: WorkOS Dashboard > Configuration
# WorkOS API EndpointWORKOS_API_ENDPOINT=https://auth.yourcompany.comDescription: Custom WorkOS authentication endpoint Default: Uses WorkOS default endpoint
# WorkOS JWKS EndpointWORKOS_JWKS_ENDPOINT=https://auth.yourcompany.com/sso/jwks/client_xxxxxDescription: JSON Web Key Set endpoint for JWT verification Required: Yes
# WorkOS Redirect URIWORKOS_REDIRECT_URI=https://app.yourcompany.com/hub/auth/callbackDescription: OAuth callback URL after authentication
Required: Yes
Format: {PUBLIC_BASE_URL}/hub/auth/callback
# WorkOS Cookie PasswordWORKOS_COOKIE_PASSWORD=generate_random_32_character_stringDescription: Secret for encrypting session cookies
Required: Yes
Security: Generate with openssl rand -base64 32
# WorkOS Code ChallengeWORKOS_CODE_CHALLENGE=random_stringDescription: PKCE code challenge for OAuth flow Required: Yes
# WorkOS Public OrganizationWORKOS_PUBLIC_ORG=org_xxxxxxxxxxxxxDescription: Default organization for public access Optional: Required for multi-tenant deployments
# WorkOS Admin OrganizationWORKOS_ADMIN_ORG=org_xxxxxxxxxxxxxDescription: Organization ID for admin users Optional: For enterprise admin segregation
AI Configuration
Section titled “AI Configuration”Querri supports both OpenAI and Azure OpenAI.
Azure OpenAI (Recommended for Enterprise)
Section titled “Azure OpenAI (Recommended for Enterprise)”# Azure OpenAI EndpointAZURE_OPENAI_ENDPOINT=https://yourcompany.openai.azure.comDescription: Azure OpenAI service endpoint Required: If using Azure OpenAI
# Azure OpenAI API KeyAZURE_OPENAI_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxDescription: Azure OpenAI API key Required: If using Azure OpenAI Location: Azure Portal > Azure OpenAI Resource > Keys
# Azure OpenAI API VersionAZURE_OPENAI_API_VERSION=2024-02-15-previewDescription: Azure OpenAI API version
Default: 2024-02-15-preview
# Model Deployment NamesSTANDARD_MODEL=gpt-4oFAST_MODEL=gpt-4o-miniSMART_MODEL=gpt-4oDescription: Azure OpenAI deployment names for different use cases Required: If using Azure OpenAI Note: These are your deployment names in Azure, not model names
OpenAI (Alternative)
Section titled “OpenAI (Alternative)”# OpenAI API KeyOPENAI_API_KEY=sk-proj-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxDescription: OpenAI API key Required: If using OpenAI (not Azure) Location: OpenAI Dashboard > API Keys
Storage Configuration
Section titled “Storage Configuration”Storage System Selection
Section titled “Storage System Selection”# Metadata StorageMETADATA_STORAGE=MONGODescription: Database for metadata
Values: MONGO
Default: MONGO
# File StorageFILE_STORAGE=S3Description: File storage backend
Values: LOCAL, S3
Default: LOCAL
# Cache StorageCACHE_STORAGE=REDISDescription: Caching backend
Values: REDIS
Note: Not fully implemented
AWS S3 Configuration (if FILE_STORAGE=S3)
Section titled “AWS S3 Configuration (if FILE_STORAGE=S3)”# AWS Access Key IDAWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLEDescription: AWS access key for S3 Required: If using S3 storage
# AWS Secret Access KeyAWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEYDescription: AWS secret access key Required: If using S3 storage
# AWS RegionAWS_REGION=us-east-1Description: AWS region for S3 bucket
Default: us-east-1
Billing (Stripe)
Section titled “Billing (Stripe)”# Stripe API KeySTRIPE_KEY=sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxDescription: Stripe secret API key Optional: Required for subscription billing Location: Stripe Dashboard > Developers > API Keys
# Stripe Trial ProductSTRIPE_TRIAL_PRODUCT=prod_xxxxxxxxxxDescription: Stripe product ID for trial subscriptions Optional
# Stripe Trial PriceSTRIPE_TRIAL_PRICE=price_xxxxxxxxxxDescription: Stripe price ID for trial subscriptions Optional
# Stripe Trial DaysSTRIPE_TRIAL_DAYS=14Description: Number of days for trial period
Default: 14
# Stripe Sync FrequencySTRIPE_SYNC_FREQUENCY=0Description: Subscription sync interval in seconds (0 = manual)
Default: 0
# Payment LinkPUBLIC_PAYMENT_LINK="https://billing.stripe.com/p/login/xxxxxxxxxx"Description: Stripe customer portal link Optional: For user self-service billing
Integration Marketplace (Prismatic)
Section titled “Integration Marketplace (Prismatic)”# Prismatic Private KeyPRISMATIC_KEY='-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----'Description: Prismatic RSA private key for API authentication Optional: Required for integration marketplace Format: Full PEM-encoded private key
# Prismatic API TokenPRISMATIC_TOKEN='eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6...'Description: Prismatic JWT token for API calls Optional: Required for integration marketplace
# Prismatic Refresh TokenPRISMATIC_REFRESH='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'Description: Prismatic refresh token Optional: For token renewal
Email Configuration (SendGrid)
Section titled “Email Configuration (SendGrid)”# SendGrid API KeySENDGRID_API_KEY=SG.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxDescription: SendGrid API key for transactional emails Optional: Required for email notifications Location: SendGrid Dashboard > Settings > API Keys
# Support EmailPUBLIC_SUPPORT_EMAIL=support@yourcompany.comDescription: Email address shown for support Optional: Used in user-facing help text
Security & Authorization
Section titled “Security & Authorization”JWT Configuration
Section titled “JWT Configuration”# JWT Private KeyJWT_PRIVATE_KEY='-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----'Description: RSA private key for signing JWT tokens Required: Yes Format: Full PEM-encoded private key Generation:
# Generate new RSA key pairopenssl genrsa -out private.pem 2048openssl rsa -in private.pem -pubout -out public.pemReverse Proxy Configuration
Section titled “Reverse Proxy Configuration”# Reverse Proxy Base URLREVERSE_PROXY_BASE_URL=http://reverse-proxy:8888Description: Internal URL for service-to-service communication
Default: http://reverse-proxy:8888
Monitoring & Analytics
Section titled “Monitoring & Analytics”Sentry (Error Tracking)
Section titled “Sentry (Error Tracking)”# Sentry Organization IDPUBLIC_SENTRY_ORG_ID="xxxxxxxxxxxxxxxxx"Description: Sentry organization identifier Optional
# Sentry Project IDPUBLIC_SENTRY_PROJECT_ID="xxxxxxxxxxxxxxxxx"Description: Sentry project identifier Optional
# Sentry KeyPUBLIC_SENTRY_KEY="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"Description: Sentry DSN key Optional
# Sentry Auth TokenSENTRY_AUTH_TOKEN="sntrys_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"Description: Sentry authentication token Optional
User Analytics
Section titled “User Analytics”# Userflow TokenPUBLIC_USERFLOW_TOKEN="ct_xxxxxxxxxxxxxxxxxxxxxxxxxx"Description: Userflow analytics token Optional: For user onboarding analytics
# Segment TokenSEGMENT_TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"Description: Segment analytics API token Optional: For usage analytics
# Enable AnalyticsPUBLIC_ENABLE_ANALYTICS=trueDescription: Enable/disable analytics tracking
Values: true, false
Default: false
Help Widget
Section titled “Help Widget”# Gleap API KeyPUBLIC_GLEAP_API_KEY="xxxxxxxxxxxxxxxx"Description: Gleap support widget API key Optional: For in-app support widget
Maps & Geolocation
Section titled “Maps & Geolocation”# Google Maps API KeyGMAPS_API_KEY=AIzaSyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxDescription: Google Maps API key for geocoding Optional: Required for location-based features
# Mapbox Access TokenMAPBOX_ACCESS_TOKEN=pk.eyJ1IjoiexxxxxxxxxxxxxxxxxxxxxxxxxDescription: Mapbox API token for mapping features Optional: Alternative to Google Maps
Scaling & Performance
Section titled “Scaling & Performance”# Server API ReplicasSERVER_API_REPLICAS=4Description: Number of server-api container replicas
Default: 4
Recommended: 4-6 for production, 1-2 for development
Configuration Templates
Section titled “Configuration Templates”Minimal Configuration
Section titled “Minimal Configuration”For basic development/testing deployment:
# EnvironmentENVIRONMENT=productionCOOKIE_DOMAIN=localhost
# DatabaseMONGO_INITDB_ROOT_USERNAME=querriMONGO_INITDB_ROOT_PASSWORD=secure_password_123MONGODB_HOST=mongoMONGODB_PORT=27017
# RedisREDIS_HOST=redisREDIS_PORT=6379
# WorkOS (get from WorkOS dashboard)WORKOS_API_KEY=sk_test_xxxxxxxxxxWORKOS_CLIENT_ID=client_xxxxxxxxxxWORKOS_JWKS_ENDPOINT=https://api.workos.com/sso/jwks/client_xxxxxxxxxxWORKOS_REDIRECT_URI=http://localhost:8080/hub/auth/callbackWORKOS_COOKIE_PASSWORD=$(openssl rand -base64 32)
# AIOPENAI_API_KEY=sk-proj-xxxxxxxxxx
# JWTJWT_PRIVATE_KEY='-----BEGIN PRIVATE KEY-----[Your generated private key]-----END PRIVATE KEY-----'
# URLsPUBLIC_BASE_URL="http://localhost:8080"PUBLIC_DOMAIN="http://localhost:8080"Production Configuration
Section titled “Production Configuration”For full production deployment:
# EnvironmentENVIRONMENT=productionSDLC_ENVIRONMENT=prodCOOKIE_DOMAIN=app.yourcompany.com
# Web AppPUBLIC_BASE_URL="https://app.yourcompany.com"PUBLIC_DOMAIN="https://app.yourcompany.com"PUBLIC_ISDEV=false
# DatabaseMONGODB_HOST=mongoMONGODB_PORT=27017MONGO_INITDB_ROOT_USERNAME=querri_adminMONGO_INITDB_ROOT_PASSWORD=[strong_password]
# RedisREDIS_HOST=redisREDIS_PORT=6379
# StorageFILE_STORAGE=S3AWS_ACCESS_KEY_ID=[your_key]AWS_SECRET_ACCESS_KEY=[your_secret]AWS_REGION=us-east-1
# WorkOSWORKOS_API_KEY=sk_live_xxxxxxxxxxWORKOS_CLIENT_ID=client_xxxxxxxxxxWORKOS_API_ENDPOINT=https://auth.yourcompany.comWORKOS_JWKS_ENDPOINT=https://auth.yourcompany.com/sso/jwks/client_xxxxxxxxxxWORKOS_REDIRECT_URI=https://app.yourcompany.com/hub/auth/callbackWORKOS_COOKIE_PASSWORD=[generated_secret]WORKOS_CODE_CHALLENGE=[generated_challenge]
# Azure OpenAIAZURE_OPENAI_ENDPOINT=https://yourcompany.openai.azure.comAZURE_OPENAI_API_KEY=[your_azure_key]AZURE_OPENAI_API_VERSION=2024-02-15-previewSTANDARD_MODEL=gpt-4oFAST_MODEL=gpt-4o-miniSMART_MODEL=gpt-4o
# ScalingSERVER_API_REPLICAS=6
# BillingSTRIPE_KEY=sk_live_xxxxxxxxxxSTRIPE_TRIAL_DAYS=14
# EmailSENDGRID_API_KEY=SG.xxxxxxxxxxPUBLIC_SUPPORT_EMAIL=support@yourcompany.com
# JWTJWT_PRIVATE_KEY='-----BEGIN PRIVATE KEY-----[Your generated private key]-----END PRIVATE KEY-----'
# Integrations (optional)PRISMATIC_KEY='[your_private_key]'PRISMATIC_TOKEN='[your_token]'Security Best Practices
Section titled “Security Best Practices”-
Never commit .env-prod to version control
Terminal window # Add to .gitignoreecho ".env-prod" >> .gitignore -
Use strong passwords
Terminal window # Generate secure passwordsopenssl rand -base64 32 -
Rotate keys regularly
- JWT private keys: Annually
- API keys: Quarterly
- Database passwords: Annually
-
Restrict file permissions
Terminal window chmod 600 .env-prod -
Use secrets management (for enterprise)
- AWS Secrets Manager
- HashiCorp Vault
- Kubernetes Secrets
Validating Configuration
Section titled “Validating Configuration”After configuration, validate your environment:
# Check required variables are setdocker compose config
# Test database connectiondocker compose exec hub python -c "from pymongo import MongoClient; client = MongoClient('mongodb://querri:password@mongo:27017/'); print('MongoDB OK')"
# Test Redis connectiondocker compose exec server-api python -c "import redis; r = redis.Redis(host='redis', port=6379); r.ping(); print('Redis OK')"
# Test WorkOS configurationcurl -H "Authorization: Bearer ${WORKOS_API_KEY}" https://api.workos.com/organizationsTroubleshooting
Section titled “Troubleshooting”Common Configuration Issues
Section titled “Common Configuration Issues”Issue: Services can’t connect to MongoDB
Solution: Verify MONGO_INITDB_ROOT_USERNAME and MONGO_INITDB_ROOT_PASSWORD match MongoDB initialization
Issue: Authentication fails
Solution: Check WorkOS credentials and ensure WORKOS_REDIRECT_URI matches your configured callback URL
Issue: AI features not working
Solution: Verify either OPENAI_API_KEY or all three Azure OpenAI variables are set correctly
Issue: File uploads failing
Solution: Check FILE_STORAGE setting and corresponding AWS credentials if using S3
Next Steps
Section titled “Next Steps”- Installation & Deployment - Deploy Querri with your configuration
- Security & Permissions - Secure your deployment
- User Management - Set up admin users