Skip to content

Simple utility meant to ease the deployment in self hosted Docker environments.

License

Notifications You must be signed in to change notification settings

by-pinja/docker-stack-deployer

This branch is 1 commit ahead of master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

f7cd42f · Aug 11, 2021

History

32 Commits
Mar 24, 2020
Jul 5, 2019
Jul 5, 2019
Jul 6, 2019
Jul 22, 2020
Feb 5, 2020
Feb 5, 2020
Feb 5, 2020
Jul 6, 2019
Jul 5, 2019
Jan 31, 2020
Aug 11, 2021
Jul 22, 2020

Repository files navigation

What is this?

Docker pulls Build Status License: MIT

Simple utility meant to ease the deployment in self hosted Docker environments.

Installation

Secrets

In swarm mode app requires storing the credentials as Docker secrets

Secrets can be for example created as external secrets beforehand and use them

cat your-docker-password.txt | docker secret create dsd-docker-password -
cat your-ssh-private-key.txt | docker secret create dsd-ssh-private-key -
cat your-gpg-private-key.txt | docker secret create dsd-gpg-private-key -

When run with docker-compose the secrets part may be "faked" using just pure volume mount.

Usage with docker-compose

docker-compose up -d

Configuration

App reads it's configuration at startup from config.json

{
  "token": "foobar",
  "envName": "Production",
  "slackWebhookUrl": "https://hooks.slack.com/services/YOURSLACKWEBHOOKTOKEN",
  "stacks": {
    "hello-world": {
      "repository": "git@github.com:/yourdomain/yourdeploymentrepository",
      "branch": "master",
      "command": "docker stack deploy -c docker-compose.yml hello-world"
    }
  }
}

token (string)

Required token to authorize requests to this tool. For example "foobar" token is required as header in format Authorization: Token foobar.

slackWebhookUrl (string)

Slack Incoming Webhook url to send notifications to. Notifications are send from both successfull and failed deployments.

stacks (string => stack)

Collection of stack configurations. Key represents the stack name.

stack.repository (string)

The deployment repository of this stack. Configuration is cloned and/or pulled from this specified repository on every deployment.

stack.branch (string)

Branch of the used deployment repository. Defaults to master.

stack.command (string)

The actual deployment command. Usually just docker stack deploy -c docker-compose.yml [stack-name].

Usage

Just call the /deploy/:stack endpoint with the stack name you want to deploy

curl -XPOST --header "Authorization: Token yourowntoken" http://localhost:3000/deploy/hello-world

License

The MIT License (MIT)