Over a million developers have joined DZone.

How to Set Up Your Own Continuous Delivery Stack

DZone's Guide to

How to Set Up Your Own Continuous Delivery Stack

Using Nexus as a Maven repository, GitLab to host the sources of your Java projects, and Jenkins for using pipeline as code, you can set up your own CD stack.

· DevOps Zone ·
Free Resource

DevOps involves integrating development, testing, deployment and release cycles into a collaborative process. Learn more about the 4 steps to an effective DevSecOps infrastructure.

Last week, I wanted to try new things with pipeline as code with Jenkins. The best way to try new things is running it as Docker containers. This way, I can keep my MacBook clean and don’t mess up existing stuff I am working on (also see this article about what Docker can offer for a developer).

Another big advantage of using Docker is that there is already a complete stack of Dockers available to set up the necessary tools. However, for some unclear reason, this stack didn’t work on my MacBook (see this issue), so I took this opportunity to build my own stack with some Dockers of my own choice!

The tools in my stack are:

  • Nexus (as a Maven repository).
  • GitLab (to host the sources of my Java projects).
  • Jenkins (of course to make use of pipeline as code).

In this post, I describe how I set up each container and make them work together as one stack. I'll start with the easiest one.


Actually, I prefer Artifactory since I am more used to use that — but as you can read here, I also had some trouble to get my Artifactory up and running as a Docker container. How different this was with Nexus. Just simply get a publicly available Docker image, set some port, and off you go! Here is how I used it in my docker-compose.yml file:

image: clearent/nexus
– /opt/data/nexus:/nexus-data
– 8081:8081


This one was somewhat harder to set it up. I ended up using the following Docker containers:

  • Redis.
  • PostgreSql.
  • GitLab.

All of these containers are based on the work from Sameer Naik.

  • redis:latest. This one uses the Ubuntu image from the same guy as a base and installs Redis on it. For more details, see the sources of this image. The image itself can be found here.

  • postgresql:9.6-1. Also based on the Ubuntu image, its sources (and detailed description) can be found here and the Docker image can be found here.

  • gitlab:8.15.4. Finally, the GitLab image, also based on the sources (here) and Docker image (here) of Sameer Naik.

To combine these images to one working GitLab, I use the following docker-compose snippet:

image: sameersbn/redis:latest
– /opt/data/gitlab/redis:/var/lib/redis

image: sameersbn/postgresql:9.6-1
– DEBUG=true
– DB_USER=gitlab
– DB_PASS=password
– DB_NAME=gitlabhq_production
– DB_EXTENSION=pg_trgm
– /opt/data/gitlab/postgresql:/var/lib/postgresql
– “15432:5432”

image: sameersbn/gitlab:8.15.4
– redis
– postgresql
– “8082:80”
– “8022:22”
– DEBUG=true
– TZ=Europe/Berlin
– GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alphanumeric-string
– GITLAB_SECRETS_SECRET_KEY_BASE=long-and-random-alphanumeric-string
– GITLAB_SECRETS_OTP_KEY_BASE=long-and-random-alpha-numeric-string
– GITLAB_HOST=localhost

– DB_ADAPTER=postgresql
– DB_HOST=postgresql
– DB_PORT=5432
– DB_USER=gitlab
– DB_PASS=password
– DB_NAME=gitlabhq_production

– REDIS_HOST=redis
– /opt/data/gitlab/gitlab:/home/git/data

See my GitLab repo here for the full docker-compose file.


Finally, there is Jenkins itself. I started out with the official Jenkins image, but that missed some options for me, so I created my own image, which can be found here. The things that I changed were adding an httping package to the OS. I have the GitLab plugin installed as default since I need it in my setup. The Dockerfile looks like this:

FROM jenkins:2.32.1
USER root
RUN apt-get update && apt-get install -y httping

COPY plugins.txt /usr/share/jenkins/plugins.txt
RUN /usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt

Now, I have all components complete for the stack. The complete Docker Compose file can be found here. As you might notice, I use some directories on the host to store the data. You can read more about that here. To set this up in Docker on the Mac OS, go to Docker Preferences and the File Sharing pane and add the directories you want to store the data in:

pascal alma 2

This way, I can easily play around with the stack, remove it, and create a new one without loosing the configuration and setup I had already added.

To start the stack I simply perform a docker-compose up and the different Docker containers are started:

pascal alma 3

Now, I can enter Jenkins via the browser:

Image title

And we're done! 

Read the 4-part DevOps testing eBook to learn how to detect problems earlier in your DevOps testing processes.

devops ,continuous delivery ,stack ,tutorial

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}