Friday, October 4, 2013

The longest route

I found myself in need today to share my local installation with a co-worker so that he can test a massive memory optimization I made.

Unfortunately me working from office and a ton of infrastructure with firewalls and what not between us I was forced to come up with a kind of non-standard solution to make it work. Here's what I've done:

1. The application runs locally on Tomcat (using Maven's tomcat6 plugin so mvn tomcat6:run)
2. Local Apache installation forwards requests from port 81 to 8080
3. An ssh tunnel is made that forwards my local port 81 to a remote port 8080 on a machine in Amazon
4. That remote machine has haproxy installed with a certificate that forwards local ports 80 and 443 to 8080 effectively allowing the user to login to my local installation

To test this I've used another Linux machine at home to login to with X forwarding enabled to locally view a remote Google Chrome running and accessing my local installation.

How can you not love Linux for that?