How this site operates

Here’s how this site is currently setup

– Single Linux server running in Google Compute US-East.
– The Google Compute instance started as an “n1-standard-1”.  I’ve added additional memory but have stuck with a single CPU.
– The only things installed in addition to the base OS are Git and Docker
– Dockerfiles and scripts to manage all of the containers are stored in a private git repo
– Backups consist of a snapshot in GCP and tarballs of data copied to Google Drive or downloaded locally.

This setup works pretty well and makes the whole thing pretty portable.  I had originally built all of this is US-Central but later decided to move it to US-East.  It was a pretty simple task of creating a new instance, installing git and docker, pulling the docker repo, copying the data into place, then creating the containers.

For non-web things, like my son’s minecraft server, they just run as a container and answer on their native ports.  I’ve created my own Docker container for minecraft which can be found here:  https://hub.docker.com/r/tighek/minecraft_server/

For web sites and things that need to answer on tcp/80 & 443, I’m using Nginx as an HA Proxy which is doing SSL termination.  Nginx is configured for all of the sites and serves some static content as well as proxying to the various containers.  For example, Nginx listens on tcp/80 & 443 for this site.  If it receives a tcp/80 request is redirects to tcp/443.  When the tcp/443 session is initiated, Nginx proxy’s the request to the internal IP of the NK4I web container on tcp/8080.  For another site, it might be tcp/8081.  Within the Docker container configuration, Docker handles translating the tcp/8080 back to the native tcp/80 of the container.  This way ports aren’t altered for the applications themselves.  And the mappings are easily seen when you look at your running container list.

To do an update/patch, I pull the latest container version and update by “create” script in the repo.  Stop the container, remove it, and run the create script.

So, I’m able to run a minecraft server, 3 different CMS’ for different web sites, some static HTML content, and a database to back-end the various CMS’.  All of this on a single CPU (runs about 15% continuous and about 80% when my son and his friends are playing minecraft) instance with 5.5GB of memory.