Reverse proxy for hosting websites in a homelab and exposing them via a cloud provider's public IP
912
Simple docker container used to reverse-proxy other (website) containers to an upstream ssh server. This is useful for hosting a website (or other service on a TCP port) in a private homelab environment, and 'projecting' it to up to a cloud VM which will host it using it's public facing IP address.

The docker image uses a handful of environment variables to configure the local container it should be proxying data to, as well as information about the upstream server. You'll need to create a certificate used to log into the upstream ssh server which will be attached to our reverse proxy container as well. I'll defer to this great article for getting the overall ssh reverse proxying in place.
This example assumes an ssh key named id_rsa has been created on the host in the /mnt/website/ssh_creds folder.
docker run -d -v /mnt/website/ssh_creds:/ssh -e PATH_TO_SSH_KEY=/ssh/id_rsa -e SSH_HOST=129.91.122.201 -e SSH_PORT=20001 -e CONTAINER_HOST=wordpress -e CONTAINER_PORT=80
In the root of this repository I've included a sample docker-compose.yml that shows a simple configuration of a wordpress website, the ssh reverse proxy, and an autohealer that watches for the correct operation of the website and restarts the ssh proxy if the site stops working. In Kubernetes we have real health checks, but in the Docker environment I was using before moving to Kubernetes I used this to catch when the SSH tunnel jameed up. It wasn't often, but it happened a few times.
To build this image, on a machine with Docker installed simply run the following command from within the downloaded repository directory:
docker build -t sshReverseProxy:latest .
Content type
Image
Digest
sha256:e122a2097…
Size
56.3 MB
Last updated
about 4 years ago
docker pull dsmithson/sshreverseproxy