Skip to content

nemerosa/do-swarm

Repository files navigation

Generation of a Docker Swarm in Digital Ocean

Work in progress - still experimental.

Overview

The goal is to create a Digital Ocean Docker Swarm.

Prerequisites

Generate a Digital Ocean API key and expose it as a TF_VAR_do_token environment variable.

Generate a SSH key pair - your can use the do-key.sh script. The key pair will be generated with do-key and do-key.pub names in the current directory.

Docker Droplet image

At the time of writing, Digital Ocean does not provide yet a ready-to-go image for Docker 1.13, only for Docker 1.12.

See the appendixes below to build your custom image with Packer.

Configuration

All configuration items are exposed as Terraform variables in the variables.tf file. Read their description to get their meaning. Most of them have default values.

Creating the swarm

In the local directory, just run:

terraform apply

Remaining actions

  • Storage - planning to use REX-Ray, waiting for issue 197 to be closed.

Appendixes

Building the Digital Ocean image

Export your Digital Ocean token:

export DIGITALOCEAN_API_TOKEN=[...]

and run:

packer build -machine-readable \
   packer-ubuntu-docker.json \
   | tee packer-ubuntu-docker.log

The region to create the image into is set to fra1 by default, but you can change it by adding the following command line option:

-var 'do_region=...'

The packer-ubuntu-docker.log file contains the snapshot ID at the end, for example:

1485200429,,ui,say,--> digitalocean: A snapshot was created: 'docker-13' (ID: 22364942) in region 'fra1'

Export it using:

export TF_VAR_do_image=[...]

SSH to the Docker swarm

Run the ./do-swarm.sh script to open a SSH session on the Docker Swarm master.

You can also append some commands to run them directy. For example:

./connect.sh docker service ls

About

Creation of Docker Swarm in Digital Ocean

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published