How to Reverse Proxy Outside Rancher / Manage Non-Rancher Services With Rancher
The problem with ARM, HAProxy, and me as a person.
So if you haven't noticed, I really like Rancher. In fact, everything I run is configured in my Rancher instance (see below). One of the speedbumps I hit over the weekend was configuring my garage and camera (both run on pi-zeros) to work with this setup, since docker and ARM are still just "good friends".
Luckily, Hypriot (Docker Pirates ARMed with explosive stuff) has some amazing guides, tutorials, and even entire operating systems up for grabs that turn ARM based machines into docker champions. This solves 95% of the "how do I get Rancher to manage this sh*t" issue, but the most critical part is still left unsolved: the rancher agent. This sucker is the key to making the magic happen, but as of this post it's implementation is far from being ready.
Alright, no sweat. I'll still build the services to run in docker containers, but I'll have to manually deploy with compose, swarm, etc. Oh shi-...
Literally all of my certs, dns, etc are managed with Rancher!
So I figured the best I can do for now is reverse-proxy my pi-stuff into an nginx container which takes care of recieving ssl-terminated requests and can be routed to, since (as far as I know) HAProxy won't do that without a bunch of custom configs which still don't give me healthchecks, visibility into the service, etc). If I wanted to manage things with a large config file I'd do it all in nginx on the host, or even worse... with a VirtualHosts setup via Apache HTTPD ;)
Here's a quick view of my local rancher instance's Public environment. I'd prefer to keep service management at this screen.

Enter Nginx Reverse Proxy
There are probably a ton of these out there, but whatever - that's not how we learn new stuff now is it? (actually, usually it is)
Check out the Dockerhub image and the Github repo, or just deploy it like so. This will reverse-proxy http://192.168.0.100:3000 on the container's port 8080:
version: '2'
services:
nginx:
image: james9074/nginx-reverse-proxy
environment:
NGINX_PORT: '8080'
NGINX_HOST: http://192.168.0.100:3000
stdin_open: true
tty: true
The config considerations::
- Env
NGINX_PORT- The host listening port - Env
NGINX_HOST- The target service you want to reverse-proxy to
In Summary:
- I want a website on my Pi to live in a container, which is orchestrated in my main Rancher instance
- There's no working ARM build of the rancher-agent, so I can't even connect a Pi host to Rancher
- Whatever, I'll use Hypriot's debian-fork with Docker support to run the sites on the ARM-based Pis
- To keep SSL and DNS working well, I'll use my shiny new Reverse Nginx Proxy service to make it appear as though everything went my way