Skip to content
Generate each Docker constraint label in random nodes in the cluster.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
docker_auto_labels
docs
tests
.editorconfig
.gitignore
.travis.yml
AUTHORS.rst
CONTRIBUTING.rst
HISTORY.rst
LICENSE
MANIFEST.in
Makefile
Pipfile
README.md
setup.cfg
setup.py
test-docker-stack.yml
tox.ini
travis_pypi_setup.py

README.md

Docker Auto Labels

Automatically generate Docker Swarm mode node labels for each constraint label in each service in a Docker Compose / Docker Stack file.

Description

This command line package is made to be used with a Docker Swarm mode cluster.

It will:

  • Read a Docker Compose / Docker Stack file.
  • Extract the node label constraints for each service.
  • Check that all the labels exist in the Docker Swarm mode cluster.
  • For each label that doesn't exist, create it in a random node in the cluster.

Adding label constraints helps you ensure that all the "stateful" Docker services (like databases) are always deployed to the same node (specially useful in a multi-node cluster).

This program will ensure that those labels exist in one node in the cluster, if they don't exist, they are created in one node chosen randomly.

That way, the first time you deploy a stack, a random node will be assigned to each stateful service (by this command, right before the deployment).

And for all subsequent deployments, the stateful services will go to the same nodes that they were using.

For examples on how to use it, check: https://github.com/tiangolo/full-stack

Credits

This package was created with Cookiecutter_ and the elgertam/cookiecutter-pipenv_ project template, based on audreyr/cookiecutter-pypackage_.

Cookiecutter elgertam/cookiecutter-pipenv audreyr/cookiecutter-pypackage

License

MIT License

You can’t perform that action at this time.