Codebuddies.de now running on Docker in the cloud

von tobonaut

On Friday I started a small project and moved this blog from a static website generated by Octopress and hosted on GitHub back into a own WordPress installation.

My reasons for this were:

  1. Octopress is nerdy and super cool BUT when it comes to a scenario with a shared blog like we have in this case it’s not really optimal. You always need a computer with a quite complex ruby-setup (for a not-ruby-dev) and WordPress is still the de facto standard and to be honest although it’s written in PHP it’s a very good pice of software if you don’t bloat it with a ton of plugins.
  2. I wanted to play around with Docker and needed a real-world usecase.
  3. I registered for a 12 month free tier at AWS (Amazon Web Services) and had no usecase for my running instance.

So I went through a few iterations and the setup now looks like the following:

+------------------------------------------------------+
| Docker                                               |
|                                                      |
|   +--------------+              +-------------+      |
|   | 172.17.0.3   |     Link     | 172.17.0.2  |      |
|   | Apache/PHP   +--------------+ MySQL       |      |
|   | WordPress    |     3306     | Database    |      |
|   +------+-------+              +-------------+      |
|          | Link                                      |
|          | 80                                        |
|   +------+-------+                                   |
|   | 172.17.0.4   | SITE1_DOMAINS=www.codebuddies.de  |
|   | NGiNX        | SITE1_BACKEND=172.17.0.3:80       |
|   | Proxy        |                                   |
|   +------+-------+                                   |
|          | Port forwarding                           |
|          | 80                                        |
+----------+-------------------------------------------+
| AWS t2.micro instance running Ubuntu 14.04           |
+----------+-------------------------------------------+
           |
           |  HTTP/1.1
           |  GET /
           |  Host: www.codebuddies.de
           |
           +
       Internet    

The three containers have the following roles:

MySQL: This container is used for serving all databases for my docker setup. Currently it’s just this blog but this could change in future.

WordPress: This container is running Apache and PHP to host this blog. It’s storing files in a volume so they will be persisted even after stopping the container.

NGiNX: This container is the internet-facing one (through port-forwarding from the host) and accepts HTTP traffic which it routes to other containers (running backend-servers) based on the „Host“ header. It’s managed by environment-variables and creates dynamic config files on startup. This enables the extension of my docker setup with further applications.

I know this setup isn’t very professional and would need a lot of improvement but it’s currently just enough to fit my needs and I only see it as a kind of playground to experiment with cloud technologies.

Update: The files for my custom proxy-server instance can be found at GitHub.

Advertisements