Automatically start containers on demand and shut them down during periods of inactivity using Traefik.
This plugin is available in the Traefik Plugin Catalog.
Add the following snippet to your Traefik static configuration:
experimental:plugins:sablier:moduleName: "github.com/sablierapp/sablier-traefik-plugin"version: "v1.0.0"
Or using CLI arguments:
--experimental.plugins.sablier.moduleName=github.com/sablierapp/sablier-traefik-plugin--experimental.plugins.sablier.version=v1.0.0
[!IMPORTANT] You must have a reachable instance of Sablier from Traefik.
The plugin supports various configuration options to customize its behavior. All options are configured at the middleware level.
Complete Configuration Example:
http:middlewares:my-sablier:plugin:sablier:sablierUrl: http://sablier:10000group: my-app-groupsessionDuration: 1mignoreUserAgent: curldynamic:displayName: My ServicesshowDetails: truetheme: hacker-terminalrefreshFrequency: 5s
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
sablierUrl | string | Yes | http://sablier:10000 | URL of the Sablier server API (must be reachable from Traefik) |
group | string | Yes | - | Group name for managing multiple instances collectively > |
sessionDuration | duration | No | - | Duration to keep instances running after the last request (e.g., 1m, 30s, 2h) |
dynamic.displayName | string | No | Middleware name | Display name shown on the waiting page |
dynamic.showDetails | boolean | No | Server default | Show detailed information on the waiting page |
dynamic.theme | string | No | Server default | Theme for the waiting page (e.g., hacker-terminal, ghost, matrix) |
dynamic.refreshFrequency | duration | No | Server default | How often the waiting page checks if instances are ready |
blocking.timeout | duration | No | - | Maximum time to wait for instances to become ready |
ignoreUserAgent | string | No | - | User Agent that should be ignored (middleware sends HTTP 200 to not wake up the container) |
The plugin can be configured in different ways depending on your deployment context:
Choose the section that matches your deployment environment below.
[!NOTE] This configuration method works with all Traefik providers (Docker, Swarm, Kubernetes, File, etc.).
Configure the plugin in your Traefik dynamic configuration:
http:middlewares:my-sablier:plugin:sablier:sablierUrl: http://sablier:10000 # Sablier service URL (must be reachable from Traefik)group: my-app-group # Group name for managing instances collectivelysessionDuration: 1m # Session duration before shutting down instances# Only one strategy can be used at a time# Declare either `dynamic` or `blocking`, not bothignoreUserAgent: curl # (Optional) Ignore requests with User Agent header curl to not wake up container# Dynamic strategy: displays a waiting pagedynamic:displayName: My Title # (Optional) Display name (defaults to middleware name)showDetails: true # (Optional) Show details for this middleware (defaults to Sablier server settings)theme: hacker-terminal # (Optional) Theme for the waiting pagerefreshFrequency: 5s # (Optional) Refresh frequency for the waiting page# Blocking strategy: waits for services to start (up to the timeout limit)# blocking:# timeout: 1m
[!IMPORTANT] Label-based configuration requires Traefik v3.6.0 or higher. This version introduced support for non-running containers (PR #10645), which is essential for Traefik to register your configuration while scaled to zero.
[!TIP] For a complete working example, see the docker example.
Add the following labels to the service you want to scale on demand:
whoami:image: traefik/whoami:latestlabels:# Enable Sablier for this container- sablier.enable=true- sablier.group=whoami# Configure the Sablier middleware- traefik.http.middlewares.whoami-sablier.plugin.sablier.group=whoami- traefik.http.middlewares.whoami-sablier.plugin.sablier.sablierUrl=http://sablier:10000- traefik.http.middlewares.whoami-sablier.plugin.sablier.sessionDuration=1m- traefik.http.middlewares.whoami-sablier.plugin.sablier.dynamic.displayName=Whoami Service# Allow Traefik to route to non-running containers- traefik.docker.allownonrunning=true# Define Traefik routing- traefik.http.routers.whoami.rule=Host(`whoami.localhost`)- traefik.http.routers.whoami.middlewares=whoami-sablier
[!CAUTION] When using Docker Swarm, the middleware configuration must be defined on a service scanned by Traefik that is not scaled to zero.
This is because Traefik evicts services from its pool when scaled to 0/0, making service-level labels unavailable.
Enabling
AllowEmptyServicesis supposed to cover this use case but this is a known issue: AllowEmptyServices option does not work with the Swarm provider #12196
[!TIP] For a complete working example, see the Docker Swarm E2E test.
1. Deploy Sablier with Middleware Configuration
Deploy Sablier as a service and define all middleware configurations on it:
sablier:image: sablierapp/sablier:1.10.1command:- start- --provider.name=swarmvolumes:- '/var/run/docker.sock:/var/run/docker.sock'deploy:labels:- traefik.enable=true# Define the Sablier middleware here- traefik.http.middlewares.whoami-sablier.plugin.sablier.group=my-group- traefik.http.middlewares.whoami-sablier.plugin.sablier.sablierUrl=http://tasks.sablier:10000- traefik.http.middlewares.whoami-sablier.plugin.sablier.sessionDuration=1m- traefik.http.middlewares.whoami-sablier.plugin.sablier.dynamic.displayName=Whoami Service- traefik.http.services.sablier.loadbalancer.server.port=10000
2. Configure Traefik with Swarm Provider
Enable the Swarm provider with empty services support:
traefik:image: traefik:v3.0.4command:- --experimental.plugins.sablier.modulename=github.com/sablierapp/sablier-traefik-plugin- --experimental.plugins.sablier.version=v1.0.0- --entryPoints.http.address=:80- --providers.swarm=true- --providers.swarm.refreshSeconds=1ports:- target: 80published: 8080volumes:- '/var/run/docker.sock:/var/run/docker.sock'
3. Configure Your Service Labels
Add labels to the service you want to scale on demand:
whoami:image: acouvreur/whoami:v1.10.2deploy:replicas: 0labels:# Enable Sablier for this service- sablier.enable=true- sablier.group=my-group# Enable Traefik routing- traefik.enable=true# Use Swarm load balancer to prevent service eviction- traefik.docker.lbswarm=true# Define routing and attach the middleware- traefik.http.routers.whoami.rule=Host(`whoami.localhost`)- traefik.http.routers.whoami.middlewares=whoami-sablier@swarm- traefik.http.routers.whoami.service=whoami- traefik.http.services.whoami.loadbalancer.server.port=80
ā ļø Limitations
ā ļø Limitations
allowEmptyServices to prevent this.Refer to the Kubernetes E2E test script for a working example.
Sablier integrates with Apache APISIX through a Proxy-WASM plugin, enabling dynamic scaling for your services.
Quick Start:
š Full Documentation | š» Plugin Repository
Sablier provides a native Caddy module for seamless integration with Caddy v2.
Quick Start:
xcaddyš Full Documentation | š» Plugin Repository
Sablier integrates with Envoy Proxy through a Proxy-WASM plugin for high-performance dynamic scaling.
Quick Start:
š Full Documentation | š» Plugin Repository
Sablier works with Istio service mesh using the Proxy-WASM plugin for intelligent traffic management.
Quick Start:
š Full Documentation | š» Plugin Repository
Sablier integrates with Nginx through a WASM module, bringing dynamic scaling to your Nginx deployments.
Quick Start:
š Full Documentation | š» Plugin Repository
If you find Sablier valuable and want to support its development, please consider sponsoring the project:
š Sponsor on GitHub - Your sponsorship helps keep this project maintained and actively developed
Your support helps:
Every contribution, no matter the size, makes a real difference. Thank you for considering! š
Join our Discord server for discussions and support:
This project is maintained by a single developer in their free time. If you find Sablier useful, here are some ways you can show your support:
ā Star the repository - It helps others discover the project and motivates continued development
š¤ Contribute - Pull requests are always welcome! Whether it's:
š Share your usage - We'd love to see how you're using Sablier! Consider:
š¬ Engage with the community - Ask questions, report issues, or help others in discussions
Every contribution, no matter how small, makes a difference and is greatly appreciated! š
For detailed support options, see SUPPORT.md.