spate

command module
v0.0.0-...-33ac69c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2017 License: Apache-2.0 Imports: 1 Imported by: 0

README

🌊 spate

GoDoc Build Status codecov Docker Image Version Docker Image Layers

spate /speɪt/
noun

  1. freshet, flood
  2. a) a large number or amount
    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.

Installation

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' \
    mtneug/spate

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 "de.mtneug.spate.metric.load.prometheus.name=jobs_total" \
    --label "de.mtneug.spate.metric.load.target=3" \
    my/worker

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.

Example

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

License

Apache 2.0 (c) Matthias Neugebauer

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package api contains code for the spate API.
Package api contains code for the spate API.
Package autoscaler contains the autoscaler implementation.
Package autoscaler contains the autoscaler implementation.
Package cmd contains code for the command line interface.
Package cmd contains code for the command line interface.
Package controller contains code for the spate controller.
Package controller contains code for the spate controller.
Package docker contains code for integrating with Docker.
Package docker contains code for integrating with Docker.
Package event contains spate events.
Package event contains spate events.
Package integration contains integration tests.
Package integration contains integration tests.
Package label contains code for parsing spate service labels and constructing objects out of them.
Package label contains code for parsing spate service labels and constructing objects out of them.
Package metric contains code related to service metrics.
Package metric contains code related to service metrics.
Package version contains (version) information about spate.
Package version contains (version) information about spate.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL