#atom

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:

  1. Centralized Configuration:
    • Define all service parameters in a single .env file for consistency and simplified management.
  2. Sensitive Data Protection:
    • Store passwords, keys, and tokens as environment variables rather than in code or configuration files.
  3. Service Interconnection:
    • Use environment variables to define how services discover and connect to each other.

Why It Matters:


How to Implement:

  1. Create Base Environment File:
cp .env.example .env
nano .env
  1. 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...
  1. 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:

# 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

Connections:


References:

  1. Primary Source:
    • Local AI Package .env.example File
  2. Additional Resources:
    • Docker Environment Variables Documentation
    • 12-Factor App Methodology for Configuration

Tags:

#environment-variables #configuration #security #secrets-management #docker #deployment #infrastructure


Connections:


Sources: