2016-04-06 Server set up: Caddy and Docker

Yesterday I changed my server set up to have: 1) Caddy as reverse proxy, instead of Nginx, and 2) Everything running within Docker.


Caddy is simple web server with automatic https-certificates from letsencrypt. This is hands down the easiest way to get https running.

Why: I want https, with automatic certificate renewal and this is the easy way to do it: Just configure the virtual servers, and the rest is done automatically, without you needing to worry about anything. Nginx is still most mature of the two, but with Caddy it just works, with minimal hassle. The only challenges I had was that there were no Dockerfile for Caddy with CORS support, so I had to make that myself, – and also that I manually had to add Host header when proxying, to make WordPress work properly.


Docker is a way to run / handle lightweight virtual machines. It also has a GitHub-like community for sharing images(machines), so the steps needed to have Piwik, WordPress, mysql, couchdb, … running is literally just to make a docker-compose file, like this, where you define what servers you want.

Every virtual server image is defined by a simple recipe (Dockerfile) defining how it is set up. This both makes it easy to set up, and also to read when using standard images.

Another nice part is scaleability, – while all of my 12 virtual servers run on the same server now, they are configured in a way such that they are easy to distribute across different machines.


My design of server set up, was to make it as simple as possible to handle. The choice of Caddy and Docker seems very good so far, as the set up was relatively simple / straight forward, and everything works suprisingly well.

A github repository for my configuration is at https://github.com/rasmuserik/whale/. The Dockerfiles is also there, though they should move to separate repositories, and be published as images on dockerhub.