Public | Automated Build

Last pushed: 7 days ago
Short Description
🌊 Horizontal service autoscaler for Docker Swarm mode
Full Description

:ocean: spate

spate /speɪt/<br>

  1. freshet, flood
  2. a) a large number or amount<br>
    b) a sudden or strong outburst rush

Merriam-Webster Dictionary

spate is a horizontal service autoscaler for Docker Swarm mode inspired by Kubernetes' Horizontal Pod Autoscaler.

Currently spate can scale services based on exposed Prometheus metrics. However, the foundations already have been layed for different types. Future versions will, for instance, be able to scale based on the CPU or memory usage.


For every release static Linux binaries can be downloaded from the release page in GitHub. But the easiest way to run spate is, of course, as a Docker Swarm service with the mtneug/spate image:

$ docker service create \
    --constraint 'node.role == manager' \
    --mount 'type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock' \

spate sets the replica count via the Docker API and needs therefore access to the Unix socket of a manager node. Also, make sure to put spate in the necessary networks so that it can poll data from the running containers is should scale. Prometheus metrics are exposed on port 8080.

Quick Start

After spate is running a reconciliation loop constantly looks for changes in the Docker Swarm cluster. Autoscaling is entirely controlled through service labels. In this way users and scripts only have to directly interact with the Docker CLI client.

$ docker service create \
    --name my-worker \
    --network spate-demo \
    --label "de.mtneug.spate=enable" \
    --label "de.mtneug.spate.metric.load.type=prometheus" \
    --label "de.mtneug.spate.metric.load.kind=replica" \
    --label "de.mtneug.spate.metric.load.prometheus.endpoint=http://localhost:8080/metrics" \
    --label "" \
    --label "" \

In this example a my-worker service is created. Each replica exposes the jobs_total Prometheus metric on port 8080, which should count the number of jobs currently processed. It is the aim, that each replica, in average, processes three jobs. A metric is therefore added with the de.mtneug.spate.metric.load labels. This way, if too many jobs are in the system, spate automatically increase the replica count and vice versa.

spate is highly configurable. Have a look at the documentation for a complete list of options.


An example application is provided with spate-demo. Consult this repository's README for more information.


Apache 2.0 (c) Matthias Neugebauer

Docker Pull Command
Source Repository