In response of: I want to ditch my computer

How to setup a remote development server from scratch

Felippe Nardi
5 min readSep 8, 2015

During QConRio, I had the pleasure to meet Andrés Galante, UX Designer at Red Hat, in a quick chat in-between our talks. I got surprised when he recognized me by an article I wrote a long time ago. It was an article about my experience on moving the development environment to the cloud and working from an iPad for a year. He mentioned wanting to do that a long time ago.

Today I’m flattered to see that Andrés decided to try setting up a remote development environment again!

So, Andrés, to help you and all developer friends willing to ditch their computers, I’ll share with you how I create a remote server from zero. This is a short compilation of what I learned in the last 3 years.

Why doing that at first place?

The three main reasons for moving your development environment to the cloud are:

Reason 1: Use the Linux command line

If you are not on a Linux, you’ll have some friction using the command line. No matter if it’s Mac or Windows. Your command line is OS oriented. And nothing feels better than working on a Linux.

I love Mac. But I prefer working on Linux command line. With a remote server, I can use both.

Reason 2: Work anywhere (even from an Ipad)

Your life as a developer depends on your computer. You devoted hours of your life crafting a development environment that would work for all your projects. You might have no idea of what you’ve installed on it already. You just know that it works. Let anything happen to that computer and you will spend at least a week to properly setup another one.

If you setup a remote server, your development environment is safe on the cloud.

Now looking from a less tragic point of view: imagine your computer is just out of battery and no one has a compatible charger to lend you. But there is a spare computer you can use. Can you work just for one day on a different computer? A few developers will, but not without some discomfort.

Reason 3: Have a public localhost

What do you do when you want to show your localhost to others?

Usually, it is no easy task. You have to commit everything you’ve done, stash any leftover code, push it to a server, and wait a minute to see changes applying.

With a remote server, you can just share your public address: your server’s IP or a custom sub-domain.

So let’s dive into it and see how we can setup a remote server.

How do I setup a remote development environment?

Choosing a cloud provider

I’ve used an Amazon EC2 instance for one year, but I ended up switching to a Digital Ocean droplet. Although more expensive, I like the simplicity of Digital Ocean. Today I use a $20/mo instance because I’m running Selenium server for real browsers e2e tests. But for a long time the $5/mo droplet worked reasonably well for my needs.

There is no right answer here. Your goal is to get a Linux server where you can SSH as root. I have never been disappointed with Digital Ocean, so I do recommend it.

Create a non-root user

Whenever I configure a machine from zero, I follow this golden rule: create a non-root user for you. That is the user you are going to use.

Whenever you need to install any programs, you will have to switch to your root user. I know it sounds like too many steps, but trust me. You don’t want to mess up your newly created environment.

Install the base applications

These are the only applications I install on the newly created machine. For everything else, I use Docker:

Mosh: it is a replacement to the SSH. It gives you a zero-latency experience when you are connected to your remote server. It opens a encrypted UPD connection between your server and your computer, and doesn’t wait to a packet to reach the server to print a character on the terminal.

Tmux: it is a window manager that allows you to divide your screen into different terminals. But the best thing about Tmux is that it keeps your session even if you log off. So you can leave a time-consuming processes running on Tmux, close your computer, and come back later to see the results.

Git: for obvious reasons.

Tmate: a fork of Tmux that allows you to instantly share your terminal with others.

Docker: for running everything else I need to install on my machine.

Vim: Don’t use Vi, use Vim. It is way better for many reasons. If your machine doesn’t come up with Vim, you can install it yourself. The installation depends on the type of Linux you choose. I recommend checking for how to compile Vim with these two features enabled: python and clipboard.

Use docker for project specific dependencies

I don’t have Ruby on my cloud machine. And neither do I have Node installed. I keep my cloud computer as pristine as possible, by I only install the base applications I talked about above.

Whenever a need to run Yeoman which depends on node, or SASS compiler wich depends on Ruby or Selenium server which depends on Java, I use this Docker image: https://hub.docker.com/r/felippenardi/yo/

To try it, you just have to have Docker installed. A single command and you’ll instantly be inside a machine that can do all these stuff as a non-root user:

docker run -it --rm --net="host" -v `pwd`:/src felippenardi/yo

This command creates an interactive bash shell (-it) that will be deleted when you exit it ( — rm) to save space. The network interface used will be the same of your host OS ( — net=”host”), which means if you run a server inside it, it will be accessible via localhost. And it will attach the current directory as a volume (-v `pwd`:/src). All that using the image felippenardi/yo, which contains ruby, node, java and a bunch of front-end development tools.

I strongly recommend looking at the source and coming up with your own development Docker file.

Give the server a cool name

This is the most seriously funny part: give your machine a name. I usually give mines name of foods. I’ve already used sushi, sashimi, cheesecake and peanut butter. Don’t ask why.

If you have a domain, you can even create a sub-domain to make it more convenient. You just have to setup an “A” type DNS record pointing to your server IP.

Setup your dotfiles

Look for a script that will install your dotfiles automatically, while you keep than saved on Github. You can check my dotfiles for inspiration.

Begin the fun

So here you have the steps I take to create a remote machine from scratch. I hope this helps you get started.

If you have any tips that would fit here, or any questions I could help with, let me know! You can reach me on the comments or at twitter on @felippenardi

Good luck on your new adventure!

P.S. Bonus

If you manage to successfully move to the cloud, allow yourself a prize by using this retro terminal emulator while showing off your new feat to your friends :)

--

--

Felippe Nardi

I help you create super interactive and unique live experiences for online audiences that you can run entirely by yourself 🚀 http://instagram.com/felippenardi