Configuration
Configure Pillow to meet your specific requirements and environment needs.
Environment Configuration
Section titled “Environment Configuration”Environment Variables
Section titled “Environment Variables”The primary configuration method uses environment variables. Copy the example file:
cp .env.example .envCore Settings
Section titled “Core Settings”Database Configuration
Section titled “Database Configuration”# Apache Doris connection (remote at db.voltdata.io)DATABASE_HOST=db.voltdata.ioDATABASE_PORT=9030DATABASE_NAME=millDATABASE_USER=your_userDATABASE_PASSWORD=your_secure_password
# Connection poolingDATABASE_MAX_CONNECTIONS=25DATABASE_MAX_IDLE=5DATABASE_CONN_LIFETIME=300s
# Alternative: Connection string formatDATABASE_URL=doris://user:password@db.voltdata.io:9030/millRedis Configuration
Section titled “Redis Configuration”# Redis for caching and sessionsREDIS_URL=redis://localhost:6379REDIS_HOST=localhostREDIS_PORT=6379REDIS_PASSWORD=REDIS_DB=0
# Cache settingsCACHE_TTL=3600CACHE_ENABLED=trueAPI Configuration
Section titled “API Configuration”# Server settingsAPI_HOST=0.0.0.0API_PORT=4000API_BASE_URL=http://localhost:4000
# SecurityJWT_SECRET=your-super-secret-jwt-key-change-thisAPI_KEY_HEADER=X-API-KeyCORS_ALLOWED_ORIGINS=http://localhost:3000,https://yourdomain.com
# Rate limitingRATE_LIMIT_ENABLED=trueRATE_LIMIT_REQUESTS=1000RATE_LIMIT_WINDOW=3600Advanced Configuration
Section titled “Advanced Configuration”Logging
Section titled “Logging”# Log levels: debug, info, warn, errorLOG_LEVEL=infoLOG_FORMAT=jsonLOG_OUTPUT=stdout
# File logging (optional)LOG_FILE=/var/log/pillow/mill.logLOG_ROTATE=trueLOG_MAX_SIZE=100LOG_MAX_BACKUPS=3Performance
Section titled “Performance”# Worker settingsWORKER_POOL_SIZE=10WORKER_QUEUE_SIZE=1000WORKER_TIMEOUT=30s
# Background jobsENABLE_BACKGROUND_JOBS=trueJOB_CLEANUP_INTERVAL=1hMAX_RETRY_ATTEMPTS=3External Services
Section titled “External Services”# Third-party integrationsMLS_API_ENDPOINT=https://api.mls-provider.comMLS_API_KEY=your_mls_api_key
# Geocoding serviceGEOCODING_PROVIDER=googleGEOCODING_API_KEY=your_geocoding_key
# Email notificationsSMTP_HOST=smtp.example.comSMTP_PORT=587SMTP_USER=notifications@yourdomain.comSMTP_PASSWORD=your_smtp_passwordEMAIL_FROM=pillow@yourdomain.comConfiguration Files
Section titled “Configuration Files”Mill Configuration
Section titled “Mill Configuration”Create mill/config/config.yaml for detailed Mill settings:
server: host: "0.0.0.0" port: 4000 read_timeout: 30s write_timeout: 30s idle_timeout: 120s
database: driver: "doris" # Apache Doris (MySQL-compatible) host: "db.voltdata.io" port: 9030 name: "mill" max_connections: 25 max_idle: 5 conn_lifetime: "5m"
security: jwt_expiry: "24h" password_min_length: 8 require_2fa: false
features: enable_analytics: true enable_ml_insights: true enable_property_matching: truePillow App Configuration
Section titled “Pillow App Configuration”Create pillow-app/.env.local for frontend settings:
# Mill API ConfigurationNEXT_PUBLIC_MILL_API=http://localhost:4000MILL_API=http://localhost:4000MILL_API_TIMEOUT=10000
# Optional: Mapbox for mapsNEXT_PUBLIC_MAPBOX_TOKEN=your-mapbox-token
# Optional: AnalyticsNEXT_PUBLIC_GA_TRACKING_ID=your-ga-tracking-idOr configure via pillow-app/next.config.js:
module.exports = { env: { NEXT_PUBLIC_MILL_API: process.env.NEXT_PUBLIC_MILL_API || "http://localhost:4000", MILL_API_TIMEOUT: process.env.MILL_API_TIMEOUT || "10000", },};Docker Configuration
Section titled “Docker Configuration”Docker Compose Override
Section titled “Docker Compose Override”Create docker-compose.override.yml for local customizations:
version: "3.8"
services: mill: environment: - LOG_LEVEL=debug - ENABLE_PROFILING=true ports: - "6060:6060" # pprof profiling volumes: - ./logs:/app/logs
postgres: ports: - "5432:5432" # Expose for local tools volumes: - postgres_data:/var/lib/postgresql/data - ./backups:/backups
redis: ports: - "6379:6379" # Expose for local tools
volumes: postgres_data:Environment-Specific Configs
Section titled “Environment-Specific Configs”Development
Section titled “Development”NODE_ENV=developmentLOG_LEVEL=debugENABLE_HOT_RELOAD=trueSKIP_AUTHENTICATION=falseMOCK_EXTERNAL_APIS=trueProduction
Section titled “Production”NODE_ENV=productionLOG_LEVEL=infoENABLE_METRICS=trueHEALTH_CHECK_INTERVAL=30sAUTO_BACKUP=trueBACKUP_RETENTION_DAYS=30Testing
Section titled “Testing”NODE_ENV=testDATABASE_URL=postgresql://test:test@localhost:5433/pillow_testLOG_LEVEL=errorPARALLEL_TESTS=trueSecurity Configuration
Section titled “Security Configuration”SSL/TLS Setup
Section titled “SSL/TLS Setup”For production deployments:
# SSL certificatesSSL_CERT_FILE=/etc/ssl/certs/pillow.crtSSL_KEY_FILE=/etc/ssl/private/pillow.keySSL_ENABLED=true
# Security headersENABLE_HSTS=trueENABLE_CSP=trueENABLE_XSS_PROTECTION=trueAuthentication & Authorization
Section titled “Authentication & Authorization”# OAuth providersOAUTH_GOOGLE_CLIENT_ID=your_google_client_idOAUTH_GOOGLE_CLIENT_SECRET=your_google_secret
OAUTH_GITHUB_CLIENT_ID=your_github_client_idOAUTH_GITHUB_CLIENT_SECRET=your_github_secret
# Session settingsSESSION_TIMEOUT=86400SESSION_COOKIE_SECURE=trueSESSION_COOKIE_HTTPONLY=trueValidation & Testing
Section titled “Validation & Testing”Validate Configuration
Section titled “Validate Configuration”Use the built-in configuration validator:
# Check Mill configuration./mill validate-config
# Check environment variablesdocker-compose configHealth Checks
Section titled “Health Checks”Configure health check endpoints:
# Basic health checkcurl http://localhost:4000/health
# Detailed system checkcurl http://localhost:4000/health/detailed
# Database connectivitycurl http://localhost:4000/health/databaseStarting Fresh or Upgrading
Section titled “Starting Fresh or Upgrading”Database Setup
Section titled “Database Setup”The database is hosted remotely at db.voltdata.io. For local development or testing:
# Connect to remote databasemysql -h db.voltdata.io -P 9030 -u your_user -p
# Create the comprehensive properties schema (if needed)mysql -h db.voltdata.io -P 9030 -u your_user -p < mill/scripts/create_comprehensive_properties_table.sql
# Verify table creationmysql -h db.voltdata.io -P 9030 -u your_user -p -e "USE mill; SHOW TABLES;"Note: Database credentials should be configured in mill/config/.env and never committed to version control.
Configuration Updates
Section titled “Configuration Updates”# Convert old config format./scripts/migrate-config.sh old-config.yml
# Validate migrated config./mill validate-config --config new-config.ymlBest Practices
Section titled “Best Practices”:::note[Performance Optimization] 4. Backups: Configure automated database backups 5. Logging: Use structured logging for better debugging 6. Performance: Tune connection pools based on load :::
Next Steps
Section titled “Next Steps”With configuration complete:
- API Documentation - Explore available endpoints
- Mill Guide - Understand the core API service
- Connectors - Learn about data collection
- Views - Build custom user interfaces