Sign inSign up

placidina/swctl

By placidina

Updated over 6 years ago

A Docker swarm automations

Image
0

1.1K

placidina/swctl repository overview

swctl

A Docker swarm automations.

Usage

docker service create --name swctl \
  --constraint "node.role==manager" \
  --mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock,readonly \
  placidina/swctl:latest
With docker-compose
version: "3.7"

services:
  ...
  swctl:
    image: placidina/swctl:latest
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    deploy:
      placement:
        constraints:
        - node.role == manager
Configuration

SWTools will try to cicles every 5 minutes by default. You can adjust this value using the SLEEP_TIME variable.

You can prevent services from being updated by appending them to the BLACKLIST_SERVICES variable. This should be a space-separated list of service names.

Alternatively you can specify a filter for the services you want updated using the FILTER_SERVICES variable. This can be anything accepted by the filtering flag in docker service ls.

You can enable private registry authentication by setting the WITH_REGISTRY_AUTH variable.

You can enable connection to insecure private registry by setting the WITH_INSECURE_REGISTRY variable.

You can enable notifications on service update with Slack, using the SLACK_WEBHOOK variable.

MAXIMUM_DEAD_CONTAINERS variable, maximum number of old instances of containers to retain globally. Default is 1.

IMAGE_GC_HIGH_THRESHOLD variable, the percent of disk usage which triggers image garbage collection. Default is 85.

Example:

  docker service create --name swctl \
    --constraint "node.role==manager" \
    --env SLEEP_TIME="5m" \
    --env BLACKLIST_SERVICES="swctl my-other-service" \
    --env WITH_REGISTRY_AUTH="true" \
    --env WITH_INSECURE_REGISTRY="true" \
    --env FILTER_SERVICES="label=com.mydomain.autodeploy" \
    --env SLACK_WEBHOOK="https://hooks.slack.com/services/TOKEN/TOKEN/TOKEN" \
    --mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock,readonly \
    --mount type=bind,source=/root/.docker/config.json,target=/root/.docker/config.json,readonly \
    placidina/swctl:latest

Tag summary

Content type

Image

Digest

Size

67.1 MB

Last updated

over 6 years ago

docker pull placidina/swctl