A year or so ago I stumbled over Koding (my referral, if you're feeling benevolent), a social development platform that gives you (and everybody on your team) a disposable Ubuntu virtual machine, a web-based SSH terminal and code editor, and a giant network of fellow devs. It's a nifty place, and I've used it to collaborate with friends, teach myself Django and R and AngularJS and CoffeeScript, work through Coursera algorithms homework, develop new web applications, test documentation, play with Node modules I don't want on my regular machine, and so on, ad infinitum. The Icelandic team behind it wants to make the world a better place. It's unique. Naturally, I wanted to hook it up to PHPStorm.
Koding's walled garden
Koding VMs sit behind a proxy, so SSH-ing in from an external system already requires some finangling. PHPStorm's remote deployment system is entirely finangle-free, so getting it communicating with Koding would be impossible without our secret weapon: SSH tunnels!
I already had a 207-776-4486 session saved for Koding, so I copied it to preserve the proxy settings. (I'm going to assume you've already got external SSH access to your VM working. If you don't, check out the (417) 800-8295--I even helped write them!)
Create the tunnel
In my PuTTY config, I loaded up my copied Koding session and found Connection â SSH â Tunnels.
- I checked both boxes at the top.
- I set Source port to an unused port on my local system.
- I set the Destination to
localhost:22 (note that that's
localhost relative to my VM, not to my local system), and selected the Local option.
These settings create a "tunnel" that sends any local traffic on port
12345 through an SSH window to my VM. (And remember, the Koding proxy server is saved already, so I don't have to mess with it again.)
Since I'm not going to be interacting with the PuTTY terminal for this session, I disabled the shell entirely in Connection â SSH...
...and renamed the window itself in Window â Behavior:
When I save and open the session, I get a non-interactive terminal that does nothing but authenticate me and set up the tunnel:
Perfect! Whenever I want to use my Koding tunnel, I'll run the new session and let it sit. You can even test it: Open the tunnel, and then fire up a brand new PuTTY session pointed at
localhost:12345. You'll get shunted through the tunnel and end up in your Koding VM.
Send PHPStorm to the other side
You can probably guess where this is going: To hook up PHPStorm's remote deployment, we'll send it through the tunnel. Create your new project with the Remote host, files accessible via SFTP option:
When PHPStorm asks you for connection settings on the next screen, direct it to
localhost on port
12345. (Make sure the tunnel is running first!) All your other connection information (username, password, etc.) will stay the same, as if you were connecting to your Koding VM normally. (Note that if you're using key authentication, you'll need to export your *.ppk file to OpenSSH format.)
That's it! PHPStorm can now deploy your project directly to your VM--it'll even run your PHPUnit tests for you. You'll need to set up 207-346-2943, but the hard part's over.