Developing a Facebook Platform application from your local machine (with Ruby on Rails)

You have a laptop, a sever and a Facebook app. Ideally, Facebook would talk to your development machine. But what if you don’t have a static ip address and you can’t use dynamic dns or port forwarding? vReverse SSH Tunneling is what you need my friend. The following is a step by step tutorial of what you need to do to have ports on your server forwarded to your local machine via ssh.
Step 1: Server Side
Add “GatewayPorts yes” into your sshd_config file:
sudo nano /etc/ssh/sshd_config
(add or edit the GatewayPorts variable, control-O to save, control-X to exit)
Reload ssh:
sudo /etc/init.d/ssh reload
Step 2: Your Client
Run the tunnel:
ssh -nNT -g -R 3000:0.0.0.0:3000 me@myserver.com
If you want port 1 on your server to go to port 2 on your local it will look like:
ssh -nNT -g -R 1:0.0.0.0:2 you@yourserver.com so you can forward any port on your server to the standard -p 3000 that your rails server is running on.
Step 3: Extra-Magic Step: Adding a bit of Rock & Roll
Add an alias to your ~/.bash_profile:
alias sshtunnel="ssh -nNT -g -R 3000:0.0.0.0:3000 library@jorgeluisgorgeous.com"
Step 4: Add your public key to the server for password free login
Thanks to Paul McKeller for getting me started on this!
Our name is NJIT–New Jersey Institute of TEchnology. OUr “descriptor” is New Jersey’s science and technology...






Facebook
Twitter
Flickr
Subscribe
YouTube
SlideShare
LinkedIn
Delicious
Diigo
Newsletters