Docker nginx-proxy round robin…

nginx + docker
docker + nginx

So we use docker for container services at work. One container that is part of our ‘dev’ tools is an nginx reverse proxy tied to port 80. IT allows us to run many projects at once using hostnames and port 80; just like in production.

So we are chugging along and I start an applications http service. Hit the service in the browser, all good, reload: broken, reload: good, reload: broken. I am all like wait a minute, thats not cool. After about 5 minutes of debugged we make a realization: I have two instances of the http service running.

Turns out the nginx reverse proxy round robins requests when more than one service is running.

*Note: This was all done w/o docker swarm enabled. Just plain docker-compose and docker run where used.

Lets Encrypt on Amazon Linux,

 So after switching some domain names around I wanted to add a Lets Encrypt SSL cert. to the blog here. Simple enough right? Log into the box, follow the instructions (https://coderwall.com/p/e7gzbq/https-with-certbot-for-nginx-on-amazon-linux) and that should be it? Nope, as alway an error occurred, when running the

certbot-auto certonly --standalone -d davidjeddy.com

 command. Turns out Amazon linux does NOT add `/usr/local/bin` to the $PATH. So I instead moved the binary to `/usr/sbin` and all was well with the world.

Couple minutes later I'm in the nginx config adding the cert, a quick restart and away we went into the great beyond of encrypted awesomeness.