mirror of
https://github.com/sablierapp/sablier.git
synced 2026-01-03 11:34:58 +01:00
This feature adds the capability to stop unregistered running instances upon startup. Previously, you had to stop running instances manually or issue an initial request that will shut down instances afterwards. With this change, all discovered instances will be shutdown. They need to be registered using labels. E.g.: sablier.enable=true Fixes #153
110 lines
5.2 KiB
YAML
110 lines
5.2 KiB
YAML
version: "3.7"
|
|
|
|
services:
|
|
traefik:
|
|
image: traefik:v3.0.4
|
|
command:
|
|
- --experimental.localPlugins.sablier.moduleName=github.com/acouvreur/sablier
|
|
- --entryPoints.http.address=:80
|
|
- --providers.swarm=true
|
|
- --providers.swarm.refreshSeconds=1 # Default is 15s
|
|
- --providers.swarm.allowemptyservices=true
|
|
ports:
|
|
- target: 80
|
|
published: 8080
|
|
protocol: tcp
|
|
mode: host # Won't work in github actions otherwise
|
|
volumes:
|
|
- '/var/run/docker.sock:/var/run/docker.sock'
|
|
- '../../../..:/plugins-local/src/github.com/acouvreur/sablier'
|
|
deploy:
|
|
labels:
|
|
- traefik.http.services.traefik.loadbalancer.server.port=8080
|
|
restart_policy:
|
|
condition: none # Do not restart on setup failure
|
|
|
|
sablier:
|
|
image: acouvreur/sablier:local
|
|
command:
|
|
- start
|
|
- --provider.name=swarm
|
|
- --logging.level=trace
|
|
volumes:
|
|
- '/var/run/docker.sock:/var/run/docker.sock'
|
|
deploy:
|
|
labels:
|
|
- traefik.enable=true
|
|
# Dynamic Middleware
|
|
- traefik.http.middlewares.dynamic.plugin.sablier.names=DOCKER_SWARM_E2E_whoami
|
|
- traefik.http.middlewares.dynamic.plugin.sablier.sablierUrl=http://tasks.sablier:10000
|
|
- traefik.http.middlewares.dynamic.plugin.sablier.sessionDuration=1m
|
|
- traefik.http.middlewares.dynamic.plugin.sablier.dynamic.displayName=Dynamic Whoami
|
|
# Blocking Middleware
|
|
- traefik.http.middlewares.blocking.plugin.sablier.names=DOCKER_SWARM_E2E_whoami
|
|
- traefik.http.middlewares.blocking.plugin.sablier.sablierUrl=http://tasks.sablier:10000
|
|
- traefik.http.middlewares.blocking.plugin.sablier.sessionDuration=1m
|
|
- traefik.http.middlewares.blocking.plugin.sablier.blocking.timeout=30s
|
|
# Multiple Dynamic Middleware
|
|
- traefik.http.middlewares.multiple.plugin.sablier.names=DOCKER_SWARM_E2E_whoami,DOCKER_SWARM_E2E_nginx
|
|
- traefik.http.middlewares.multiple.plugin.sablier.sablierUrl=http://tasks.sablier:10000
|
|
- traefik.http.middlewares.multiple.plugin.sablier.sessionDuration=1m
|
|
- traefik.http.middlewares.multiple.plugin.sablier.dynamic.displayName=Multiple Whoami
|
|
# Healthy Middleware
|
|
- traefik.http.middlewares.healthy.plugin.sablier.names=DOCKER_SWARM_E2E_nginx
|
|
- traefik.http.middlewares.healthy.plugin.sablier.sablierUrl=http://tasks.sablier:10000
|
|
- traefik.http.middlewares.healthy.plugin.sablier.sessionDuration=1m
|
|
- traefik.http.middlewares.healthy.plugin.sablier.dynamic.displayName=Healthy Nginx
|
|
# Group Middleware
|
|
- traefik.http.middlewares.group.plugin.sablier.group=E2E
|
|
- traefik.http.middlewares.group.plugin.sablier.sablierUrl=http://tasks.sablier:10000
|
|
- traefik.http.middlewares.group.plugin.sablier.sessionDuration=1m
|
|
- traefik.http.middlewares.group.plugin.sablier.dynamic.displayName=Group E2E
|
|
- traefik.http.services.sablier.loadbalancer.server.port=10000
|
|
|
|
whoami:
|
|
image: containous/whoami:v1.5.0
|
|
deploy:
|
|
replicas: 0
|
|
labels:
|
|
- sablier.enable=true
|
|
- sablier.group=E2E
|
|
- traefik.enable=true
|
|
# If you do not use the swarm load balancer, traefik will evict the service from its pool
|
|
# as soon as the service is 0/0. If you do not set that, fallback to dynamic-config.yml file usage.
|
|
- traefik.docker.lbswarm=true
|
|
- traefik.http.routers.whoami-dynamic.middlewares=dynamic@swarm
|
|
- traefik.http.routers.whoami-dynamic.rule=PathPrefix(`/dynamic/whoami`)
|
|
- traefik.http.routers.whoami-dynamic.service=whoami
|
|
- traefik.http.routers.whoami-blocking.middlewares=blocking@swarm
|
|
- traefik.http.routers.whoami-blocking.rule=PathPrefix(`/blocking/whoami`)
|
|
- traefik.http.routers.whoami-blocking.service=whoami
|
|
- traefik.http.routers.whoami-multiple.middlewares=multiple@swarm
|
|
- traefik.http.routers.whoami-multiple.rule=PathPrefix(`/multiple/whoami`)
|
|
- traefik.http.routers.whoami-multiple.service=whoami
|
|
- traefik.http.routers.whoami-group.middlewares=group@swarm
|
|
- traefik.http.routers.whoami-group.rule=PathPrefix(`/group`)
|
|
- traefik.http.routers.whoami-group.service=whoami
|
|
- traefik.http.services.whoami.loadbalancer.server.port=80
|
|
|
|
nginx:
|
|
image: nginx:1.23.1
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost"]
|
|
interval: 5s
|
|
deploy:
|
|
replicas: 0
|
|
labels:
|
|
- sablier.enable=true
|
|
- sablier.group=E2E
|
|
- traefik.enable=true
|
|
# If you do not use the swarm load balancer, traefik will evict the service from its pool
|
|
# as soon as the service is 0/0. If you do not set that, fallback to dynamic-config.yml file usage.
|
|
- traefik.docker.lbswarm=true
|
|
- traefik.http.routers.nginx-multiple.middlewares=multiple@swarm
|
|
- traefik.http.routers.nginx-multiple.rule=PathPrefix(`/multiple/nginx`)
|
|
- traefik.http.routers.nginx-multiple.service=nginx
|
|
- traefik.http.routers.nginx-healthy.middlewares=healthy@swarm
|
|
- traefik.http.routers.nginx-healthy.rule=PathPrefix(`/healthy/nginx`)
|
|
- traefik.http.routers.nginx-healthy.service=nginx
|
|
- traefik.http.services.nginx.loadbalancer.server.port=80
|