Cover image for Self-hosted Continuous Delivery that doesn't cost a fortune 💰 - Part 1

Self-hosted Continuous Delivery that doesn't cost a fortune 💰 - Part 1

limal profile image Łukasz Wolnik ・3 min read


In this series I want to demonstrate how to set up an open-sourced, self-managed continuous delivery solution that can be run on a private server for free thanks to Drone and Traefik.

The goal is to update a web app on a live website by just running:

git push origin master

Alt Text

on your dev machine.

Alt Text

That's it! After a couple of minutes a website should be automatically updated with changes that have just been pushed to a Git repo.

Below image depicts this process from pushing a commit to serving an HTTPS website.

Alt Text


You need to have a Linux server to host and run the required software. You can buy one for example from OVH.

Tech stack

The presented continuous delivery's pipeline contains:

1. GitHub

A hosted Git repo with hooks that notifies a build server about a new commit.

2. Drone

A build server that will listen to new commits, build images and push them to a Docker repo.

3. Traefik

A load balancer and a reverse proxy, that runs a Docker's image of a web app and routes a web domain foo.bar.com to a container that runs a Docker image build with Drone.

Installing Docker

To start we need a Docker running on a server.

sudo apt-get update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
apt-cache policy docker-ce
sudo apt install docker-ce
sudo systemctl status docker

Press Ctrl-C to quit.

Below will allow your non-root user to access Docker.

sudo usermod -aG docker yourusername

Installing docker-compose

sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Installing Traefik

For more detailed installation refer to the article I based this one on [1]

Go to your home directory and create a folder:

cd ~
mkdir traefik
cd traefik

Set up a password for your Traefik dashboard using apache2-utils.

sudo apt-get install apache2-utils
htpasswd -Bc password.txt yourusername

Open password.txt and copy your password hash from there. You will need it in the next step.

Create a traefik.toml file and paste below content into it:

vim traefik.toml
defaultEntryPoints = ["http", "https"]

    address = ":8080"
        users = ["$output_of_password.txt_file_created_above"] # ***** EDIT HERE *****
    address = ":80"
        entryPoint = "https"
    address = ":443"


email = "youremail@email.com" # ***** EDIT HERE *****
storage = "acme.json"
entryPoint = "https"
onHostRule = true
  entryPoint = "http"

domain = "docker.yourdomain.com" # ***** EDIT HERE *****
watch = true
network = "web"
sudo docker network create web
touch acme.json
chmod 600 acme.json

Run Traefik:

vim docker-compose.yml

And paste below:

version: '3'

    image: traefik:1.7.6-alpine
    restart: always
      - "80:80"
      - "443:443"
      - traefik.frontend.rule=Host:traefik.foo.bar.com # ***** EDIT HERE *****
      - traefik.port=8080
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./traefik.toml:/traefik.toml
      - ./acme.json:/acme.json
      - web

    external: true

Run Traefik

docker-compose up -d

Traefik Dashboard

To confirm that your Traefik installation was successful you should be able to access traefik.foo.bar.com URL that you specified in above docker-compose.yml file.

You should see a website like below:

Alt Text


Well done! You've got half of your continuous delivery pipeline set up. In the next article I will show how to install Drone build server and how to connect the trio: GitHub, Drone and Traefik.

[1] https://www.digitalocean.com/community/tutorials/how-to-use-traefik-as-a-reverse-proxy-for-docker-containers-on-ubuntu-18-04

Posted on by:

limal profile

Łukasz Wolnik


React / React Native / JavaScript / IoT developer


Editor guide

To get the best web hosting solutions, approach HostSailor as it is the perfect platform for innovative hosting solutions, with 24/7 hosting support. This makes it possible to run your website with confidence.