Go to file
Alexis Couvreur ebd24562b1 feat: add healthcheck lookup before redirect (#12)
Docker classic IsUp will return false when the container defines a healthcheck and is not healthy, otherwise as soon as it's started it's up.
Docker swarm will check that the number of required tasks is higher than 1, and that the number of running tasks matches the number of desired tasks.
A task is not running when it defines a healthcheck and is not healthy.
2021-09-28 12:44:27 +02:00
2020-10-21 23:04:33 +02:00
2021-09-26 14:32:33 +00:00

Traefik on demand service

Build Latest version

Description

This is a service that can scale up or down a docker swarm service on demand. It basically starts a service when it's needed and then shut it down when it's no longer needed.

Usage

CLI

./traefik-ondemand-service --swarmMode=true

Argument Value Description
swarmMode true,false (default true) Enable/Disable swarm mode. Used to determine the scaler implementation.

Docker

docker run -v /var/run/docker.sock:/var/run/docker.sock -p 10000:10000 ghcr.io/acouvreur/traefik-ondemand-service:latest --swarmode=true

API

GET <service_url>:10000/?name=<service_name>&timeout=<timeout>
Query param Type Description
name string The docker container name, or the swarm service name
timeout time.Duration The duration after which the container/service will be scaled down to 0
Body Status code Description
started 202 Created The container/service is available
starting 201 Accepted The container/service has been scheduled for starting but is not yet available
Description
Start your containers on demand, shut them down automatically when there's no activity. Docker, Docker Swarm Mode and Kubernetes compatible.
Readme AGPL-3.0 60 MiB
Languages
Go 89.4%
HTML 9.9%
Makefile 0.6%
Dockerfile 0.1%