Coding on my RPI3B from my regular machine over ssh

This weekend I've set up my rpi3B. My main goal is to see if I can use it for CI/CD, I hope it'll survive Jenkins.

To do any ops work I want to be able to edit code on the rpi. Though the pi desktop environment is fine for regular browsing, but the pi is not exactly fast enough to code comfortably (vim's not my thing). There's a solution for this; just code on your regular machine (mac/laptop etc.) onto your rpi (set up as a remote environment).

I remembered an ops guy at my previous job to use VS Code to edit code on a server, I've wanted to do this for a while. Turns out that VS Code makes this really easy.

Follow these steps (not dummy proof):
-Set up an ssh connection between your machine and your rpi
-Install VS Code Insiders on your regular machine (this version offers experimental support for the rpi3B (arm7I)
-Install the Remote SSH plugin
-Restart VS Code (before restart the plugin only spat errors in my face)
-Create a ~/.ssh/config file
-Fill the file with the raspberry host configuration

example:
Host raspberry
    Hostname {ip-of-the-pi}
    User {user-on-the-pi: "pi" is the default user}
    Identityfile ~/.ssh/id_rsa

From the VS Code command palette select "Remote SSH: Connect to Host" and select the desired host. It will now connect to the rpi as host (I had to click retry the connection once). A new Editor window should now open connected to the rpi. I also installed other plugins into VS Code, like a terminal, so I don't even need to leave the IDE for navigating through the file system.

Comments

Popular posts from this blog

Deep fakes, fake news, it's old news!

Thinking about tech: Technological Determinism

Software development as a growing profession - Present