Skip to content

Daplanet/traefik-ondemand-plugin

 
 

Repository files navigation

Traefik Ondemand Plugin

Traefik middleware to start containers on demand.

Github Actions Go Report Go Version Latest Release

Features

  • Support for Docker containers
  • Support for Docker swarm mode, scale services
  • Support for Kubernetes Deployments
  • Start your container/service on the first request
  • Automatic scale to zero after configured timeout upon last request the service received
  • Dynamic loading page (cloudflare or grafana cloud style)

Demo

Usage

Plugin configuration

testData:
  serviceUrl: http://ondemand:10000
  name: TRAEFIK_HACKATHON_whoami
  timeout: 1m
Parameter Type Example Description
serviceUrl string http://ondemand:10000 The docker container name, or the swarm service name
name string TRAEFIK_HACKATHON_whoami The container/service to be stopped (docker ps
timeout time.Duration 1m30s The duration after which the container/service will be scaled down to 0

Traefik-Ondemand-Service

The traefik-ondemand-service must be used to bypass Yaegi limitations.

Yaegi is the interpreter used by Traefik to load plugin and run them at runtime.

The docker library that interacts with the docker deamon uses unsafe which must be specified when instanciating Yaegi. Traefik doesn't, and probably never will by default.

Examples

Authors

Alexis Couvreur (left) Alexandre Hiltcher (middle) Matthias Schneider (right)

Alexandre, Alexis and Matthias