Image 01

Transneptune

beyond the Kuiper Belt, over the sea

Archive for October, 2012

Forward

Sunday, October 21st, 2012

So, John recently showed me this cool service, Foward. They are useful for two main things: showing off your development on localhost to people on the other side of the NAT, and developing on localhost with calls to external services that need to then call you back.

Basically, it’s just a reverse proxy.

So, without intending to steal their thunder (they really are very full-featured—take a look), here’s how to make a bare-bones version of this yourself.

What you’ll need:

  • A domain name. I’m using transneptune.net, of course.
  • A webserver, with proxying capability. I’m using Apache, with mod_proxy.
  • SSH keys (not strictly necessary, but it makes it all much more convenient).

So, there are two components to this: the reverse proxy on your webserver, and the script that makes an SSH tunnel from your computer to the webserver, which the proxy then forwards to.

Both are really super simple.

Here’s the Apache config:

<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName forward.example.com

ProxyPass / http://localhost:8001/
ProxyPassReverse / http://localhost:8001/
</VirtualHost>

The port (8001) is arbitrary; I chose a high-numbered port that I was unlikely to use for anything else. The ServerName is also just an example.

Here’s the script to run locally to connect:

#!/bin/bash

PORT=$1
ssh -N -R 8001:localhost:$PORT example.com

The important part of this is the -R 8001:localhost:$PORT, which handles creation of the tunnel. The -N just keeps it from making a shell on the server when you run it.

So, an example of use:

Start your Django local development server:

$ ./manage.py runserver

This is running on port 8000.

Run the forwarding script, with the local port you’d like to make externally visible:

$ forward 8000

Wait a moment for it to connect.

Go to forward.example.com in a browser, or better yet, direct someone elsewhere to do so.

Celebrate.

Metablogging

Sunday, October 21st, 2012

Wow, so it turns out I do write a lot, about thoughts and analyses and impressions and responses, but that’s all going on over on G+ lately.

Something about the medium works. Less metadata, better commenting community. No expectations that posts are fully developed, so they end up being, well, fully developed, because I can launch into an idea without feeling pressure.

Obviously, I can still blog here, but WordPress is just feeling too heavyweight, too scary, right now.

I’m going to be a rebel and not put any tags or categories on this page. Off the hook!

Wind and Things Unspoken

Thursday, October 18th, 2012

Here I am, sitting in a mostly dark room, processing thoughts on class and drama and just not talking about it inspired by watching the beginning of Downton Abbey, and the wind outside is howling.

Yeah, I love fall.