The goal is to update a web app on a live website by just running:
git push origin master
on your dev machine.
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.
You need to have a Linux server to host and run the required software. You can buy one for example from OVH.
The presented continuous delivery's pipeline contains:
A hosted Git repo with hooks that notifies a build server about a new commit.
A build server that will listen to new commits, build images and push them to a Docker repo.
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.
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
Ctrl-C to quit.
Below will allow your non-root user to access Docker.
sudo usermod -aG docker yourusername
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
For more detailed installation refer to the article I based this one on 
Go to your home directory and create a folder:
cd ~ mkdir traefik cd traefik
Set up a password for your Traefik dashboard using
sudo apt-get install apache2-utils htpasswd -Bc password.txt yourusername
password.txt and copy your password hash from there. You will need it in the next step.
traefik.toml file and paste below content into it:
defaultEntryPoints = ["http", "https"] [entryPoints] [entryPoints.dashboard] address = ":8080" [entryPoints.dashboard.auth] [entryPoints.dashboard.auth.basic] users = ["$output_of_password.txt_file_created_above"] # ***** EDIT HERE ***** [entryPoints.http] address = ":80" [entryPoints.http.redirect] entryPoint = "https" [entryPoints.https] address = ":443" [entryPoints.https.tls] [api] entrypoint="dashboard" [acme] email = "firstname.lastname@example.org" # ***** EDIT HERE ***** storage = "acme.json" entryPoint = "https" onHostRule = true [acme.httpChallenge] entryPoint = "http" [docker] domain = "docker.yourdomain.com" # ***** EDIT HERE ***** watch = true network = "web"
sudo docker network create web touch acme.json chmod 600 acme.json
And paste below:
version: '3' services: traefik: image: traefik:1.7.6-alpine restart: always ports: - "80:80" - "443:443" labels: - traefik.frontend.rule=Host:traefik.foo.bar.com # ***** EDIT HERE ***** - traefik.port=8080 volumes: - /var/run/docker.sock:/var/run/docker.sock:ro - ./traefik.toml:/traefik.toml - ./acme.json:/acme.json networks: - web networks: web: external: true
docker-compose up -d
To confirm that your Traefik installation was successful you should be able to access
traefik.foo.bar.com URL that you specified in above
You should see a website like below:
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.