Skip to content

Configuration

Configure Pillow to meet your specific requirements and environment needs.

The primary configuration method uses environment variables. Copy the example file:

Terminal window
cp .env.example .env
Terminal window
# Apache Doris connection (remote at db.voltdata.io)
DATABASE_HOST=db.voltdata.io
DATABASE_PORT=9030
DATABASE_NAME=mill
DATABASE_USER=your_user
DATABASE_PASSWORD=your_secure_password
# Connection pooling
DATABASE_MAX_CONNECTIONS=25
DATABASE_MAX_IDLE=5
DATABASE_CONN_LIFETIME=300s
# Alternative: Connection string format
DATABASE_URL=doris://user:password@db.voltdata.io:9030/mill
Terminal window
# Redis for caching and sessions
REDIS_URL=redis://localhost:6379
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=
REDIS_DB=0
# Cache settings
CACHE_TTL=3600
CACHE_ENABLED=true
Terminal window
# Server settings
API_HOST=0.0.0.0
API_PORT=4000
API_BASE_URL=http://localhost:4000
# Security
JWT_SECRET=your-super-secret-jwt-key-change-this
API_KEY_HEADER=X-API-Key
CORS_ALLOWED_ORIGINS=http://localhost:3000,https://yourdomain.com
# Rate limiting
RATE_LIMIT_ENABLED=true
RATE_LIMIT_REQUESTS=1000
RATE_LIMIT_WINDOW=3600
Terminal window
# Log levels: debug, info, warn, error
LOG_LEVEL=info
LOG_FORMAT=json
LOG_OUTPUT=stdout
# File logging (optional)
LOG_FILE=/var/log/pillow/mill.log
LOG_ROTATE=true
LOG_MAX_SIZE=100
LOG_MAX_BACKUPS=3
Terminal window
# Worker settings
WORKER_POOL_SIZE=10
WORKER_QUEUE_SIZE=1000
WORKER_TIMEOUT=30s
# Background jobs
ENABLE_BACKGROUND_JOBS=true
JOB_CLEANUP_INTERVAL=1h
MAX_RETRY_ATTEMPTS=3
Terminal window
# Third-party integrations
MLS_API_ENDPOINT=https://api.mls-provider.com
MLS_API_KEY=your_mls_api_key
# Geocoding service
GEOCODING_PROVIDER=google
GEOCODING_API_KEY=your_geocoding_key
# Email notifications
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_USER=notifications@yourdomain.com
SMTP_PASSWORD=your_smtp_password
EMAIL_FROM=pillow@yourdomain.com

Create mill/config/config.yaml for detailed Mill settings:

mill/config/config.yaml
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: true

Create pillow-app/.env.local for frontend settings:

pillow-app/.env.local
# Mill API Configuration
NEXT_PUBLIC_MILL_API=http://localhost:4000
MILL_API=http://localhost:4000
MILL_API_TIMEOUT=10000
# Optional: Mapbox for maps
NEXT_PUBLIC_MAPBOX_TOKEN=your-mapbox-token
# Optional: Analytics
NEXT_PUBLIC_GA_TRACKING_ID=your-ga-tracking-id

Or configure via pillow-app/next.config.js:

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",
},
};

Create docker-compose.override.yml for local customizations:

docker-compose.override.yml
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:
.env.development
NODE_ENV=development
LOG_LEVEL=debug
ENABLE_HOT_RELOAD=true
SKIP_AUTHENTICATION=false
MOCK_EXTERNAL_APIS=true
.env.production
NODE_ENV=production
LOG_LEVEL=info
ENABLE_METRICS=true
HEALTH_CHECK_INTERVAL=30s
AUTO_BACKUP=true
BACKUP_RETENTION_DAYS=30
.env.test
NODE_ENV=test
DATABASE_URL=postgresql://test:test@localhost:5433/pillow_test
LOG_LEVEL=error
PARALLEL_TESTS=true

For production deployments:

Terminal window
# SSL certificates
SSL_CERT_FILE=/etc/ssl/certs/pillow.crt
SSL_KEY_FILE=/etc/ssl/private/pillow.key
SSL_ENABLED=true
# Security headers
ENABLE_HSTS=true
ENABLE_CSP=true
ENABLE_XSS_PROTECTION=true
Terminal window
# OAuth providers
OAUTH_GOOGLE_CLIENT_ID=your_google_client_id
OAUTH_GOOGLE_CLIENT_SECRET=your_google_secret
OAUTH_GITHUB_CLIENT_ID=your_github_client_id
OAUTH_GITHUB_CLIENT_SECRET=your_github_secret
# Session settings
SESSION_TIMEOUT=86400
SESSION_COOKIE_SECURE=true
SESSION_COOKIE_HTTPONLY=true

Use the built-in configuration validator:

Terminal window
# Check Mill configuration
./mill validate-config
# Check environment variables
docker-compose config

Configure health check endpoints:

Terminal window
# Basic health check
curl http://localhost:4000/health
# Detailed system check
curl http://localhost:4000/health/detailed
# Database connectivity
curl http://localhost:4000/health/database

The database is hosted remotely at db.voltdata.io. For local development or testing:

Terminal window
# Connect to remote database
mysql -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 creation
mysql -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.

Terminal window
# Convert old config format
./scripts/migrate-config.sh old-config.yml
# Validate migrated config
./mill validate-config --config new-config.yml

:::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 :::

With configuration complete:

  1. API Documentation - Explore available endpoints
  2. Mill Guide - Understand the core API service
  3. Connectors - Learn about data collection
  4. Views - Build custom user interfaces