You've successfully subscribed to MyPad Blog
Great! Next, complete checkout for full access to MyPad Blog
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.

Using Visual Studio Code as a Cloud IDE for a remote Ubuntu machine

Using Visual Studio Code as a Cloud IDE for a  remote Ubuntu machine

I often have a requirement to edit files on my server running my favorite side project MyPad using a cloud IDE. Vim workes great. spf13-vim makes things even more easier. But having said that, given my comfort with using IDEs vim continues to be a PITA.

vim has a steep learning curve and, frankly, I've never really got to a point where I'm an expert at it. I use it to make and do things at times, but my productivity isn't quite as much as is the case with using an IDE.

I've experimented with various tools in the past, but latest release of Visual Studio code from Microsoft makes things really easy and very convenient. Its been my BEST experience of running a cloud IDE on my Ubuntu server. (Disclaimer ... I'm long $MSFT ;-) )

Here is a quick demonstration of how I use Visual Studio IDE to manage my remote instance.

In this demonstration, I'll use my recent service that I created for your URL shortening. I'm simply calling it l.mypad.in. l stands for link and it's as simple as that. ;-)

Now let's say I want to change the nginx config for https://l.mypad.in/. I simply fire up sshcode, which connects to my server using SSH which my local machine has already been set up for. And I can, I can access all the code using VS code.

Read more of on this cool project at microsoft/vscode: Visual Studio Code.

Install sshcode

Install the latest version of sshcode from the releases page.

sshcode is a CLI to automatically install and run code-server over SSH.

# download sshcode
wget "https://github.com/cdr/sshcode/releases/download/v0.9.0/sshcode-darwin-amd64.tar"

# extract sshcode
tar -zxvf sshcode-darwin-amd64.tar

# move sshcode into your PATH
mv sshcode /usr/local/bin

# delete the downloaded file
rm sshcode-darwin-amd64.tar

VS Code over SSH

My Mac is already configured for ssh access to my ubuntu server (its tiny! don't kill it please with DOS attacks ;-) )

# bind the local port to 2601
# going to edit my nginx conig files
sshcode ghost@santoshsrinivas.com --bind 127.0.0.1:2613 "/etc/nginx/sites-available/"

This fires up a server locally giving access to my remote files over ssh!
How cool is that! Now hack your heart way on your remote server code with a neat native experience of using the awesome Visual Studio code!