While browsing Friday night, I came across Visual Studio Code's Insider edition with the SSH Development feature, billed as a simple solution to develop on remote machines (eg. LXC containers, VMs, VPSes, etc) from any supported device running VSCode. I decided to give it a try first-hand, while developing my customer management platform.
It was super simple to install, it took a bit of reading to figure out which extensions I needed (Development Pack), and was smooth sailing from there.
I'm running it on both my Ubuntu + Mac development environments. In order to connect, I click on the little computer icon (left sidebar), and the REMOTE-SSH tab comes up. I see help & feedback, and a list of my known connections.
Click the cogs icon next to "CONNECTIONS", and select your .ssh/config file on Mac + Linux.
It should populate with locations (eg, /Users/username/.ssh/config/, /etc/ssh/ssh_config, etc).
You should be able to add configuration that looks similar to this, substituting as necessary:
Next, hit the little connect button for new-tab connect, or, double click your host on the left sidebar. It will begin to connect to your desired host. Once you have your UI open, open your desired folder (in my case, /opt/ispmngr/connect), here's how your editor should look:
Next, you can select files / install extensions, and even use the built-in VSCode terminal to run commands over SSH. One thing I've found, is that some extensions can be installed on the remote host (not local machine), so you can just install once, and pickup anywhere, on any device you want and not need to re-install the extensions. It's really made development a lot easier for remote machines, even debugging applications.
Overall, the experience is great. I love the ability to manage git, ssh terminal, do files in real time, debug, and all the conveniences I have locally. However, I found some actions I had to take redundant:
- I had to install an extension for SSH to work, I'd much prefer this be already baked in, and possibly a setting to enable it?
- Doing anything with sudo is challenging, you need to ensure you have the right file permissions, or VSCode will not like it. I've found if you make a new usergroup, own the files by said usergroup, and give your development users access to the group it's fine. I'd like the ability in VSCode to enter a sudoer credential, so I don't have to give everyone sudo. Some things I'd prefer no one but X touch
- I found that if your program has iterative loops (eg, python for loop with > 100,000 records it has to iterate over), and you print data to the terminal, VSCode will start hogging lots of resources - it may be worth batching these up. In any case, this fix is simple as you can pipe to a log file + view inside VSCode (or, wherever you view your logs already)
Overall, this is great news - for anything like Python, JS/TS I have a perfect IDE. However, right now due to PHP support, I'll have to stick with my messy Jetbrains PHPStorm setup. One step at a time, I suppose!
Subscribe to Kuby
Get the latest posts delivered right to your inbox