Files
EZ-Homelab/docker-compose/sablier
kelin 013bdb969d 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
2026-02-10 18:43:56 -05:00
..

Sablier Stack

This stack deploys Sablier, a service that provides lazy loading (on-demand startup) for Docker containers.

Overview

Sablier monitors Docker containers and can automatically start them when they receive traffic through Traefik, then stop them after a period of inactivity. This is useful for:

  • Reducing resource usage on servers with limited RAM/CPU
  • Managing seasonal or infrequently-used services
  • Extending the capacity of small servers (like Raspberry Pi)

Multi-Server Architecture

Each server in your homelab should have its own Sablier instance:

  • Core Server: Manages lazy loading for core services
  • Remote Servers: Each runs Sablier to control local containers

Sablier only connects to the local Docker socket (/var/run/docker.sock) on its own server.

Features

  • Web Dashboard: Access at https://sablier.yourdomain.duckdns.org
  • Protected by Authelia: SSO authentication required
  • Local Control: Only manages containers on the same server
  • Traefik Integration: Uses Traefik middlewares for automatic container startup

Usage

Enable Lazy Loading on a Container

Add these labels to any service in your docker-compose files:

services:
  myservice:
    image: myapp:latest
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.myservice.rule=Host(`myservice.yourdomain.duckdns.org`)"
      - "traefik.http.routers.myservice.entrypoints=websecure"
      - "traefik.http.routers.myservice.tls=true"
      - "traefik.http.routers.myservice.middlewares=sablier-myservice@docker"
      
      # Sablier middleware configuration
      - "traefik.http.middlewares.sablier-myservice.plugin.sablier.names=myservice"
      - "traefik.http.middlewares.sablier-myservice.plugin.sablier.sablierUrl=http://sablier:10000"
      - "traefik.http.middlewares.sablier-myservice.plugin.sablier.sessionDuration=5m"

Configuration Options

  • names: Container name(s) to manage (comma-separated for multiple)
  • sablierUrl: URL of the Sablier service (use http://sablier:10000 for local)
  • sessionDuration: How long to keep the container running after last request (e.g., 5m, 1h)

Deployment

This stack is automatically deployed:

  • On the core server after core infrastructure deployment
  • On remote servers during remote server setup

Manual deployment:

cd /opt/stacks/sablier
docker compose up -d

Resources

  • CPU: ~10-20 MB RAM per instance
  • Storage: Minimal (~50 MB)
  • Network: Internal Docker network only

Documentation