Subtitle:
Configuration settings for customizing and securing self-hosted AI services
Core Idea:
Environment variables in a Local AI stack provide a centralized, secure method to configure authentication, connectivity, resource allocation, and feature enablement across multiple AI services.
Key Principles:
- Centralized Configuration:
- Define all service parameters in a single .env file for consistency and simplified management.
- Sensitive Data Protection:
- Store passwords, keys, and tokens as environment variables rather than in code or configuration files.
- Service Interconnection:
- Use environment variables to define how services discover and connect to each other.
Why It Matters:
- Security Enhancement:
- Prevents hardcoded credentials in scripts or configuration files.
- Deployment Flexibility:
- Enables the same code base to run in different environments with different configurations.
- Simplified Management:
- Provides a single location to update settings that affect multiple services.
How to Implement:
- Create Base Environment File:
cp .env.example .env
nano .env
- Configure Essential Services:
# N8N Configuration
N8N_ENCRYPTION_KEY=your-long-random-string
N8N_HOST=n8n.yourdomain.com
# Supabase Configuration
POSTGRES_PASSWORD=strong-database-password
SUPABASE_ADMIN_PASSWORD=strong-admin-password
JWT_SECRET=your-long-random-string
ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
- Set Network Configuration:
# Caddy Configuration
CADDY_N8N_HOSTNAME=n8n.yourdomain.com
CADDY_SUPABASE_HOSTNAME=supabase.yourdomain.com
CADDY_OPENWEBUI_HOSTNAME=openwebui.yourdomain.com
CADDY_FLOWISE_HOSTNAME=flowise.yourdomain.com
CADDY_EMAIL=your-email@example.com
Example:
- Scenario:
- Configuring a secure Local AI Package deployment with custom settings.
- Application:
Complete .env file with comprehensive settings:
# N8N Configuration
N8N_ENCRYPTION_KEY=24a89f01cb8d43e39ec307492d572911
N8N_PORT=5678
# Supabase Configuration
POSTGRES_PASSWORD=db_password_example123
SUPABASE_ADMIN_PASSWORD=admin_password_example456
JWT_SECRET=jwt_secret_example789
ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
SUPABASE_PORT=3001
# OpenWebUI Configuration
OPENWEBUI_PORT=3002
OLLAMA_API_BASE_URL=http://ollama:11434/api
# Flowise Configuration
FLOWISE_PORT=3003
FLOWISE_USERNAME=admin
FLOWISE_PASSWORD=strongpassword123
# Caddy Configuration
CADDY_N8N_HOSTNAME=n8n.yourdomain.com
CADDY_SUPABASE_HOSTNAME=supabase.yourdomain.com
CADDY_OPENWEBUI_HOSTNAME=openwebui.yourdomain.com
CADDY_FLOWISE_HOSTNAME=flowise.yourdomain.com
CADDY_EMAIL=your-email@example.com
- Result:
- All services are properly configured with secure credentials, correct port assignments, and proper interconnections, enabling the entire stack to work together seamlessly.
Connections:
- Related Concepts:
- Docker Containerization: Uses these variables for container configuration
- Caddy Server Configuration: Consumes hostname variables for subdomain setup
- Broader Concepts:
- Configuration Management: General approach to managing application settings
- Secrets Management: Security practices for handling sensitive data
References:
- Primary Source:
- Local AI Package .env.example File
- Additional Resources:
- Docker Environment Variables Documentation
- 12-Factor App Methodology for Configuration
Tags:
#environment-variables #configuration #security #secrets-management #docker #deployment #infrastructure
Connections:
Sources: