docker: add initial docker host playbook and dockerfiles #992
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Moving on from #989 which is trying to use the Infrastructure Containers on Joyent to run Alpine. This sets up a "Docker host" similar to the initial work started in #437 (that PR shows how we're running our Alpine 3.4 test host(s) right now in CI).
Configuring a Docker host means first setting up a machine that can handle the number of containers we need, then using
host_vars
to configure the containers. At the moment I have 2 DIgitalOcean 4 VCPU, 8G machines running and have them set up with this type ofhost_vars
:So we have 2 x Alpine 3.4, 2 x Alpine 3.5, 2 x Alpine 3.6 and 2 x Ubuntu 16.04. The Alpine machines are labelled in CI like this:
alpine36-container-x64
and the 3 of them are included now in node-test-commit-linux. The Ubuntu containers have the labeljenkins-beta
as @refack suggested we have some floating workers that can be used to test new jobs. They're not assigned to anything so feel free to use them in CI as you like, just don't attach them permanently to anything I suppose.Dockerfile templates are in
ansible/roles/docker/templates/
and we can add extra types of images in here as required. I could imagine falling back to Docker to run our CentOS5 instances if we lost our current hosts and got desperate for example.On the host, the containers mount their
/home/iojs/
directories inside the host/home/iojs/
directory under a subdirectory that has the worker's name. So on test-digitalocean-ubuntu1604-docker-x64-1 we have:Each of those directories looks like a standard
/home/iojs
, complete withslave.jar
,.ccache
andtmp
.The containers are managed by systemd and have the worker name in them, e.g.:
So you could
systemctl restart jenkins-test-digitalocean-ubuntu1604_container-x64-1
for example.The two hosts included in the inventory here are the Docker hosts and build/test have access to them to do all of this stuff. Jenkins doesn't know about the hosts, only the workers, but you don't have ssh access to the workers. In Jenkins, I've added descriptions for these to make it clear where the host is if you ever needed to "manage" it. e.g. https://ci.nodejs.org/computer/test-digitalocean-alpine36_container-x64-1/ says "Docker container running on test-digitalocean-ubuntu1604_docker-x64-1 in /home/iojs/test-digitalocean-alpine36_container-x64-1".