I am always stiving to be different and play with new technologies. So what is the next step? Well since Docker is the hot topic and I am keen to learn more so I decided to dive in head first.
This site BrianChrister.io is hosted with Digital Ocean on an Ubuntu droplet with NGINX and Wordpress on top. Nothing quite out of the ordinary besides making it a multi-site Wordpress with NGINX.
Build a Docker based system that is load balanced behind a NGINX Proxy. Instead of migrating Wordpress into Docker containeres I decided to also switch to Ghost CMS as it is running Node.js and it seemed like a very interesting project.
Getting from A --> B
So first we need to lay down the ground work. The great thing about Docker is the amount of pre-configured images available. Simply install them and BAM! You're running.
I'm using Digital Ocean so I spun up a new Droplet with Docker already installed. So easy! If you don't have Digital Ocean which you should then RTFM
Install the NGINX proxy by typing
docker pull jwilder/nginx-proxy
The image provided by Jwilder is an amazing peice of kit. It is an NGINX reverse proxy that monitors docker containers via the API. Once a docker container starts with the -e VIRTUAL_HOST=www.example.com variable it assigns it to the proxy automagically.
Once the image is installed fire it up.
docker run -d -p 80:80
Next I installed the Docker Ghost image
docker pull dockerfile/ghost
Time to start firing up Ghost containers.
docker run -e VIRTUAL_HOST=www.example.com
-v /localhost/directory --name container_name
-d -p 49154:2368 -v ~/blog:/ghost-override dockerfile/ghostwhich will pull the Ghost image from the registry and fire it up
I then repeated step 5 and renamed the container and incremented the port number by 1.
Check out Stack Overflow on how to configure your Ghost containter to store the data locally in a seperate Docker container.
Bam! Now you have 2 Docker containers load balanced behind a reverse proxy.