Improve .env file handling and variable replacement in deployment
Major improvements to environment variable management: 1. Added .env.example files for ALL stacks - Each stack now has its own .env.example with only required variables - Variables include comments explaining their purpose - Examples: core, dockge, infrastructure, dashboards, arcane, media, media-management, transcoders, monitoring, sablier, utilities, productivity, wikis, vpn, homeassistant, alternatives 2. Created .env.global generation - Generates /opt/stacks/.env.global with all variables - Strips comments and blank lines for clean output - Available to all stacks for reference 3. Improved variable replacement strategy - Variable replacement now ONLY targets labels and x-dockge sections in docker-compose files - Configuration files (traefik, authelia) still get full variable replacement - Uses Python script for precise section detection - Preserves environment variables and volume mounts as-is 4. New deployment approach - Each stack copies .env.example to .env - Values populated from main ~/EZ-Homelab/.env file - No more manual sed commands to remove unused variables - Consistent approach across all deployment functions 5. Updated deployment functions - deploy_dockge, deploy_core, deploy_infrastructure, deploy_dashboards, deploy_arcane, deploy_sablier_stack - All now use process_stack_env() for clean .env handling - All use updated localize_yml_file() for targeted variable replacement Benefits: - Clean, minimal .env files for each stack - No unnecessary variables or comments in deployed .env files - Variables in compose files preserved for Docker Compose to handle - Easier to understand what each stack needs - Uniform deployment approach across all stacks
This commit is contained in:
11
docker-compose/alternatives/.env.example
Normal file
11
docker-compose/alternatives/.env.example
Normal file
@@ -0,0 +1,11 @@
|
||||
# Alternatives Stack Environment Variables
|
||||
# These variables are used for alternative services (Plex, Authentik, etc.)
|
||||
|
||||
# Base Configuration
|
||||
DOMAIN=example.duckdns.org
|
||||
SERVER_HOSTNAME=myserver
|
||||
TZ=America/New_York
|
||||
|
||||
# Directory Configuration
|
||||
STACKS_DIR=/opt/stacks
|
||||
MEDIA_DIR=/mnt/media
|
||||
11
docker-compose/arcane/.env.example
Normal file
11
docker-compose/arcane/.env.example
Normal file
@@ -0,0 +1,11 @@
|
||||
# Arcane Stack Environment Variables
|
||||
# These variables are used for Arcane Docker Management UI
|
||||
|
||||
# Base Configuration
|
||||
DOMAIN=example.duckdns.org
|
||||
SERVER_HOSTNAME=myserver
|
||||
TZ=America/New_York
|
||||
|
||||
# Directory Configuration
|
||||
STACKS_DIR=/opt/stacks
|
||||
PROJECTS_DIR=/opt/stacks
|
||||
32
docker-compose/core/.env.example
Normal file
32
docker-compose/core/.env.example
Normal file
@@ -0,0 +1,32 @@
|
||||
# Core Stack Environment Variables
|
||||
# These variables are used for Traefik, Authelia, and DuckDNS
|
||||
|
||||
# Base Configuration
|
||||
DOMAIN=example.duckdns.org
|
||||
SERVER_HOSTNAME=myserver
|
||||
TZ=America/New_York
|
||||
|
||||
# DuckDNS Configuration
|
||||
DUCKDNS_SUBDOMAINS=yourdomain
|
||||
DUCKDNS_TOKEN=your-token-here
|
||||
|
||||
# Directory Configuration
|
||||
STACKS_DIR=/opt/stacks
|
||||
|
||||
# Admin Configuration
|
||||
DEFAULT_USER=admin
|
||||
DEFAULT_PASSWORD=changeme
|
||||
DEFAULT_EMAIL=admin@example.com
|
||||
|
||||
# Authelia Configuration
|
||||
AUTHELIA_JWT_SECRET=
|
||||
AUTHELIA_SESSION_SECRET=
|
||||
AUTHELIA_STORAGE_ENCRYPTION_KEY=
|
||||
AUTHELIA_ADMIN_PASSWORD_HASH=
|
||||
|
||||
# SMTP Configuration (Optional)
|
||||
SMTP_HOST=smtp.gmail.com
|
||||
SMTP_PORT=587
|
||||
SMTP_USERNAME=
|
||||
SMTP_PASSWORD=
|
||||
SMTP_SENDER=noreply@example.com
|
||||
18
docker-compose/dashboards/.env.example
Normal file
18
docker-compose/dashboards/.env.example
Normal file
@@ -0,0 +1,18 @@
|
||||
# Dashboards Stack Environment Variables
|
||||
# These variables are used for Homepage and Homarr
|
||||
|
||||
# Base Configuration
|
||||
DOMAIN=example.duckdns.org
|
||||
SERVER_HOSTNAME=myserver
|
||||
TZ=America/New_York
|
||||
|
||||
# Server Configuration
|
||||
SERVER_IP=192.168.1.100
|
||||
|
||||
# Homepage Configuration
|
||||
HOMEPAGE_VAR_TITLE=My Homelab
|
||||
HOMEPAGE_VAR_SEARCH_PROVIDER=google
|
||||
HOMEPAGE_VAR_HEADER_STYLE=clean
|
||||
|
||||
# Grafana Configuration (if used)
|
||||
GRAFANA_ADMIN_PASSWORD=changeme
|
||||
10
docker-compose/dockge/.env.example
Normal file
10
docker-compose/dockge/.env.example
Normal file
@@ -0,0 +1,10 @@
|
||||
# Dockge Stack Environment Variables
|
||||
# These variables are used in docker-compose labels and configuration
|
||||
|
||||
# Base Configuration
|
||||
DOMAIN=example.duckdns.org
|
||||
SERVER_HOSTNAME=myserver
|
||||
TZ=America/New_York
|
||||
|
||||
# Directory Configuration
|
||||
STACKS_DIR=/opt/stacks
|
||||
10
docker-compose/homeassistant/.env.example
Normal file
10
docker-compose/homeassistant/.env.example
Normal file
@@ -0,0 +1,10 @@
|
||||
# Home Assistant Stack Environment Variables
|
||||
# These variables are used for Home Assistant and related services
|
||||
|
||||
# Base Configuration
|
||||
DOMAIN=example.duckdns.org
|
||||
SERVER_HOSTNAME=myserver
|
||||
TZ=America/New_York
|
||||
|
||||
# Directory Configuration
|
||||
STACKS_DIR=/opt/stacks
|
||||
13
docker-compose/infrastructure/.env.example
Normal file
13
docker-compose/infrastructure/.env.example
Normal file
@@ -0,0 +1,13 @@
|
||||
# Infrastructure Stack Environment Variables
|
||||
# These variables are used for Pi-hole, Watchtower, Dozzle, Glances
|
||||
|
||||
# Base Configuration
|
||||
DOMAIN=example.duckdns.org
|
||||
SERVER_HOSTNAME=myserver
|
||||
TZ=America/New_York
|
||||
|
||||
# Pi-hole Configuration
|
||||
PIHOLE_WEBPASSWORD=changeme
|
||||
|
||||
# Directory Configuration
|
||||
STACKS_DIR=/opt/stacks
|
||||
11
docker-compose/media-management/.env.example
Normal file
11
docker-compose/media-management/.env.example
Normal file
@@ -0,0 +1,11 @@
|
||||
# Media Management Stack Environment Variables
|
||||
# These variables are used for Sonarr, Radarr, Prowlarr, etc.
|
||||
|
||||
# Base Configuration
|
||||
DOMAIN=example.duckdns.org
|
||||
SERVER_HOSTNAME=myserver
|
||||
TZ=America/New_York
|
||||
|
||||
# Directory Configuration
|
||||
MEDIA_DIR=/mnt/media
|
||||
DOWNLOAD_DIR=/mnt/downloads
|
||||
10
docker-compose/media/.env.example
Normal file
10
docker-compose/media/.env.example
Normal file
@@ -0,0 +1,10 @@
|
||||
# Media Stack Environment Variables
|
||||
# These variables are used for Jellyfin, Calibre-web, etc.
|
||||
|
||||
# Base Configuration
|
||||
DOMAIN=example.duckdns.org
|
||||
SERVER_HOSTNAME=myserver
|
||||
TZ=America/New_York
|
||||
|
||||
# Directory Configuration
|
||||
MEDIA_DIR=/mnt/media
|
||||
13
docker-compose/monitoring/.env.example
Normal file
13
docker-compose/monitoring/.env.example
Normal file
@@ -0,0 +1,13 @@
|
||||
# Monitoring Stack Environment Variables
|
||||
# These variables are used for Prometheus, Grafana, Uptime Kuma, etc.
|
||||
|
||||
# Base Configuration
|
||||
DOMAIN=example.duckdns.org
|
||||
SERVER_HOSTNAME=myserver
|
||||
TZ=America/New_York
|
||||
|
||||
# Grafana Configuration
|
||||
GRAFANA_ADMIN_PASSWORD=changeme
|
||||
|
||||
# Directory Configuration
|
||||
STACKS_DIR=/opt/stacks
|
||||
16
docker-compose/productivity/.env.example
Normal file
16
docker-compose/productivity/.env.example
Normal file
@@ -0,0 +1,16 @@
|
||||
# Productivity Stack Environment Variables
|
||||
# These variables are used for productivity and collaboration tools
|
||||
|
||||
# Base Configuration
|
||||
DOMAIN=example.duckdns.org
|
||||
SERVER_HOSTNAME=myserver
|
||||
TZ=America/New_York
|
||||
|
||||
# Code Server Configuration
|
||||
CODE_SERVER_PASSWORD=changeme
|
||||
|
||||
# Jupyter Configuration
|
||||
JUPYTER_TOKEN=changeme
|
||||
|
||||
# Directory Configuration
|
||||
STACKS_DIR=/opt/stacks
|
||||
7
docker-compose/sablier/.env.example
Normal file
7
docker-compose/sablier/.env.example
Normal file
@@ -0,0 +1,7 @@
|
||||
# Sablier Stack Environment Variables
|
||||
# These variables are used for Sablier lazy loading service
|
||||
|
||||
# Base Configuration
|
||||
DOMAIN=example.duckdns.org
|
||||
SERVER_HOSTNAME=myserver
|
||||
TZ=America/New_York
|
||||
10
docker-compose/transcoders/.env.example
Normal file
10
docker-compose/transcoders/.env.example
Normal file
@@ -0,0 +1,10 @@
|
||||
# Transcoders Stack Environment Variables
|
||||
# These variables are used for Tdarr, Unmanic
|
||||
|
||||
# Base Configuration
|
||||
DOMAIN=example.duckdns.org
|
||||
SERVER_HOSTNAME=myserver
|
||||
TZ=America/New_York
|
||||
|
||||
# Directory Configuration
|
||||
MEDIA_DIR=/mnt/media
|
||||
10
docker-compose/utilities/.env.example
Normal file
10
docker-compose/utilities/.env.example
Normal file
@@ -0,0 +1,10 @@
|
||||
# Utilities Stack Environment Variables
|
||||
# These variables are used for backup and utility services
|
||||
|
||||
# Base Configuration
|
||||
DOMAIN=example.duckdns.org
|
||||
SERVER_HOSTNAME=myserver
|
||||
TZ=America/New_York
|
||||
|
||||
# Directory Configuration
|
||||
STACKS_DIR=/opt/stacks
|
||||
13
docker-compose/vpn/.env.example
Normal file
13
docker-compose/vpn/.env.example
Normal file
@@ -0,0 +1,13 @@
|
||||
# VPN Stack Environment Variables
|
||||
# These variables are used for VPN services
|
||||
|
||||
# Base Configuration
|
||||
DOMAIN=example.duckdns.org
|
||||
SERVER_HOSTNAME=myserver
|
||||
TZ=America/New_York
|
||||
|
||||
# qBittorrent Configuration
|
||||
QBITTORRENT_WEBUI_PASSWORD=changeme
|
||||
|
||||
# Directory Configuration
|
||||
DOWNLOAD_DIR=/mnt/downloads
|
||||
15
docker-compose/wikis/.env.example
Normal file
15
docker-compose/wikis/.env.example
Normal file
@@ -0,0 +1,15 @@
|
||||
# Wikis Stack Environment Variables
|
||||
# These variables are used for wiki and documentation platforms
|
||||
|
||||
# Base Configuration
|
||||
DOMAIN=example.duckdns.org
|
||||
SERVER_HOSTNAME=myserver
|
||||
TZ=America/New_York
|
||||
|
||||
# Wiki Database Configuration
|
||||
POSTGRES_PASSWORD=changeme
|
||||
MEDIAWIKI_DB_PASSWORD=changeme
|
||||
BOOKSTACK_DB_PASSWORD=changeme
|
||||
|
||||
# Directory Configuration
|
||||
STACKS_DIR=/opt/stacks
|
||||
Reference in New Issue
Block a user