Componentix logo

Componentix blog

Here we write some random thoughts and articles about software development: Java, Grails, Node.js, iPhone, iPad and more.

Making your development webserver publicly accessible using localtunnel

Sometimes when testing web applications it is needed to have them available from outside (i.e. in public Internet). For example some APIs you use may need to send callbacks.

A solution that helps in such case is creating SSH reverse tunnel to make your local server publicly acessible. However to do this you’ll need publicly acessible box which you can control, with SSH on it and needed ports opened on firewall.

Sometimes you just don’t have one and would like to avoid hassle with purchasing some VPS, etc. In such case localtunnel utility comes in help.

localtunnel is a tool built with specific purpose to temporarily expose local web servers to public Internet. It acts as a client for a public and open source reverse tunneling service. It’s usage is simple:

localtunnel 8080

This command makes local service at port 8080 acessible on the port 80 on the domain it outputs.

Note that of course at first you need to install and configure it.
Installation (for all users) goes like:

sudo gem install localtunnel

Then also on the first run you have to specify your SSH public key to use for authentication, like:

localtunnel -k ~/.ssh/id_rsa.pub 8080

If you don’t have SSH keypair, you can generate the keys using ssh-keygen:

ssh-keygen -t rsa

See more info and source code on Github: http://github.com/progrium/localtunnel

Tags: console ssh

Setup Vim to work with Terminator terminal emulator

When I tried to use excellent terminal emulator Terminator to edit a file with Vim on remote server, I got strange errors.
Vim wouldn’t use syntax highlighting, had other glitches and output warning message at start-up:


E558: Terminal entry not found in terminfo
'terminator' not known. Available builtin terminals are:
    builtin_riscos
    builtin_amiga
    builtin_beos-ansi
    builtin_ansi
    builtin_pcansi
    builtin_win32
    builtin_vt320
    builtin_vt52
    builtin_xterm
    builtin_iris-ansi
    builtin_debug
    builtin_dumb
defaulting to 'ansi'

After googling a bit I found a solution in the FAQ of Terminator.

To cut a long story short, here’s how to fix it (just copy your .terminfo to remote machine):


scp -r ~/.terminfo remote_username@remote_hostname:~/
 

After doing that, all the problems should be gone.

Tags: console vim
Following e-mail is only for robots (never send anything to it, or you would be blacklisted): botsonly@componentix.com