Creating a LocalTunnel on dotCloud


tl;dr

If you want to install LocalTunnel on dotCloud, use this repo: https://github.com/cyounkins/tunnel-on-dotcloud

If you participate in a lot of hackathons or just want to expose a certain port on a development box to theInterwebs™, there’s a really useful app that performs all the ssh magic from one of the Twilio engineers, http://progrium.com/localtunnel/ . Installing this rubygem magically assigns an unused proxied subdomain from localtunnel.com so you can show off your wares.

While extremely useful in the one-off hackathon world, it’s a bit problematic if your app connects to a number of external services. Each time you’re assigned a different proxied subdomain from localtunnel, you’ll have to log into aforementioned services and change the callback urls or update a mystical dns redirect entry - both undesirable behaviors… especially having done this several umpteen times. :)

Having stumbled upon this dotCloud blog entry, http://blog.dotcloud.com/open-your-local-webapp-to-the-web-with-dotclo and walked the tutorial, the repo referenced didn’t actually have a working nginx.conf file to do the proxying - looks to be commented out and missing a few other directives. In any case, thank you Interwebs, here’s a working repo: https://github.com/cyounkins/tunnel-on-dotcloud

As a note, make sure you kill any open ssh sessions in dotCloud. If you’re careless like me with a lot of tmux sessions open, you’ll often get “Warning: remote port forwarding failed for listen port 8042” which generally translates to “Close your other open ssh sessions”