Think Forward.

The nomad developer setup #1: A guide for beginners


The nomad developer setup #1: A guide for beginners

Fun fact, I first wrote this article on another platform when working on Bluwr in a train. No matter the distance, it is always nice to be able to work from anywhere you want. All you need for this setup to work is an access to a web browser. In this article I will share part of the setup that I am using. It is the first one of a series where I will be covering the whole setup I am using. This first article is about how to set up vscode to work from any device with a web browser. Visual Studio Code is a text editor by microsoft. It can be customized with an almost infinite number of plugins. We will be using vscode in a client/server mode. The vscode server will be running on a virtual machine hosted by a cloud provider, the client can be any web browser. We will use the browser to connect to the vscode server. The interface inside the web browser will be identical to the standard vscode interface, and you will be able to edit any file on the virtual machine. So first you need a host. Any cloud provider will do, the only thing you need is an IP address and a user that can ssh to the host. Side note here, I almost exclusively use ssh keys, never user/password to connect to cloud hosts as it is way more secure. Once the ssh session started, install docker if not already available on the host. the execute the following command: ;; docker run -d \ --name=code-server \ -p 8443:8443 \ -e PASSWORD=”1234” \ ghcr.io/linuxserver/code-server ;; We could basically end this article right now. However, there are a few more things I want to talk about. These points took me a bit of time figure out and I thought I’d share them with you: 1. How to make sure you don’t have to re-install all your plugins every time you start a new code server instance 2. How to make sure your settings stored, so you don’t have to manually re-enter them every time you restart your docker container 3. How to set a custom working directory where all your code will be stored These are all technically achieved using the same principle: bind mount a folder of your host to a dedicated folder in the docker container. If you look at the container folder structure, you can see that all plugins are installed in the /config/extensions folder. Vscode configuration in the container is stored in /config/data/User/settings.json. If you have been using vscode for sometime and would like to use that same configuration, you can take that existing settings file and put it somewhere on your virtual machine. Finally, to get a defined workspace, you can bind mount the folder where you usually put your code to the one that is dedicated to it in the container. The full command is : ;; docker run -d \ --name=code-server \ -p 8443:8443 \ -e PASSWORD="1234" \ -v "/home/username/vscode_extensions:/config/extensions" \ -v "/home/user/vscode_settings:/config/data/User/" \ -v "/home/user/workspace/:/config/workspace" \ ghcr.io/linuxserver/code-server ;; To save money, I only start and pay for cloud resources when I need them. Of course, I don’t repeat all these steps and re-install all the tools I need each time I start a new virtual machine. I use a packer/ansible/terraform combination to create a snapshot that I can use as a base image each time I create a new host. This will be the subject of my next article. Now, working from anywhere as a digital nomad is really nice and convenient, but does not mean you should work all the time. I made this setup originally only to be geographically free, I still make it a point to have a healthy work/life balance. I have many hobbies and would not trade them for more hours of coding.

The nomad developer setup #1: A guide for beginners

Fun fact, I first wrote this article on another platform when working on Bluwr in a train. No matter the distance, it is always nice to be able to work from anywhere you want. The primary consideration as a digital nomad is the screen size, because it defines most of what you will be carrying. Personally I use an ipad air 4 with this nomad setup and it works really well, it is small, light and powerful enough. However, It can also be a laptop or even any computer that you have access to during your travels. All you need for this setup to work is an access to a web browser. In this article I will share part of the setup that I am using. It is the first one of a series where I will be covering the whole setup I am using. This first article is about how to set up vscode to work from any device with a web browser. Visual Studio Code is a text editor by microsoft. It can be customized with an almost infinite number of plugins. We will be using vscode in a client/server mode. The vscode server will be running on a virtual machine hosted by a cloud provider, the client can be any web browser. We will use the browser to connect to the vscode server. The interface inside the web browser will be identical to the standard vscode interface, and you will be able to edit any file on the virtual machine. So first you need a host. Any cloud provider will do, the only thing you need is an IP address and a user that can ssh to the host. Side note here, I almost exclusively use ssh keys, never user/password to connect to cloud hosts as it is way more secure. Once the ssh session started, install docker if not already available on the host. the execute the following command: **docker run -d \--name=code-server -p 8443:8443 -e PASSWORD=”1234” ghcr.io/linuxserver/code-server** We could basically end this article right now. However, there are a few more things I want to talk about. These points took me a bit of time figure out and I thought I’d share them with you: 1. How to make sure you don’t have to re-install all your plugins every time you start a new code server instance 2. How to make sure your settings stored, so you don’t have to manually re-enter them every time you restart your docker container 3. How to set a custom working directory where all your code will be stored These are all technically achieved using the same principle: bind mount a folder of your host to a dedicated folder in the docker container. If you look at the container folder structure, you can see that all plugins are installed in the /config/extensions folder. Vscode configuration in the container is stored in /config/data/User/settings.json. If you have been using vscode for sometime and would like to use that same configuration, you can take that existing settings file and put it somewhere on your virtual machine. Finally, to get a defined workspace, you can bind mount the folder where you usually put your code to the one that is dedicated to it in the container. The full command is : ;; docker run -d \ --name=code-server \ -p 8443:8443 \ -e PASSWORD="1234" \ -v "/home/username/vscode_extensions:/config/extensions" \ -v "/home/user/vscode_settings:/config/data/User/" \ -v "/home/user/workspace/:/config/workspace" \ ghcr.io/linuxserver/code-server ;; To save money, I only start and pay for cloud resources when I need them. Of course, I don’t repeat all these steps and re-install all the tools I need each time I start a new virtual machine. I use a packer/ansible/terraform combination to create a snapshot that I can use as a base image each time I create a new host. This will be the subject of my next article. Now, working from anywhere as a digital nomad is really nice and convenient, but does not mean you should work all the time. I made this setup originally only to be geographically free, I still make it a point to have a healthy work/life balance. I have many hobbies and would not trade them for more hours of coding.