Michael Crosby


Remote Development

In the past I have not been a huge fan of "the cloud" for all of the work that I need to do. I still prefer native over web apps but I also like the convenience of having my data accessible everywhere. However, over the past few months I have been doing more work in web apps and doing development over ssh on my own server. This post will go over some of the necessary tools that is needed to make remote development awesome.

Cloud9

I used cloud9 ide for over a week. I was able to get the app running on my server with a lot of pain and dependencies. All of the nodejs app that I have tried to setup have 100's of dependencies and any one of them can fail on install. Anyways, I was able to get the app running and was able to do small development tasks on it. It is mostly geared towards web development but has syntax support for many other languages. It ran fine for a while but it would always throw a few errors and I had an issue with data loss when I encountered an error on save. After that I felt like I was tying a paper for college where I was paranoid about data loss and saving the Word doc ever few minutes.

I wanted to install cloud9 on a LXC container so that it is properly sandboxed but the dependencies kept failing to install until I gave up. I think a web ide is still premature for the type of development that I need to do and the responsivneness that I am used to.

Remote Stack

So if I am not using a web ide what am I using? I am running an Ubuntu 12.04 64bit server that I ssh into. Ssh is secure, fast, and just works. It provides the exact same shell that is on my local machine via my .dotfiles. Here is a quick list of my setup:

Setup Zsh ( oh-my-zsh ) tmux vim git vagrant docker rdiff-backup irssi python 2.7 Go 1.1 * compilers, libs, etc...

With these tools I have a consistent and persistent development environment from any location. The one thing that I do not like to do on the cmd prompt is managing sql databases. I like to have a gui when working with a sql db.

Shell Zsh plus oh-my-zsh is very powerful and fast. It provides everything that I need and works the same on linux and osx. The plugins for many of the apps that I already use and tab completion make my workflow very efficient.

Editor An ssh workflow is not going to work if you use a heavy ide to write code. Working as a .NET dev by day I couldn't imaging working with C# and .NET without Visual Studio because the framework is so large and the namespaces and inheritance chains can be very deep. Being able to remember not only the large, OO and pattern heavy applications that are written in .NET along with the entire .NET frameworks (+ ASP stack) it is nearly impossible to navigate the projects without Visual Studio doing it for you. However, the code that I write for open source, freelancing, and myself is Python, Go, and your standard web shit (html, css, js) I prefer a text editor over an ide.

My editor of choice is vim. I have used vim for a long time. I took a small six month break from vim and used Sublime Text 2 but it started to slow down after a while and I will still using vim when I ssh'd into a server. So my editing skills were split between two editors and it was just time for me to come back home to hjkl. Plus Sublime Text 2 does not work over ssh. It has good code completion for the languages that I work in so with my setup it is basically a very lightweight ide.

Vim

Tmux When working over ssh the biggest issue is persisting your state when you need to logout. It is no fun when you have a few vim tabs, splits, and other processes running while coding then after you logout, then log back in you have to recreate everything to get back where you were. I used to use screen for this but I have recently switched to tmux because of the added features. Tmux allows you to persist your sessions, have multiple windows ( ssh sessions) and terminal splits to provide an entire workspace on one ssh connection. You can logout and back in and start coding right away.

You can even have an irc client running in your terminal while working and easily switch back and forth with a keystroke. Tmux (or screen) is a must have when working over ssh, it is what makes a productive workflow possible.

Tmux

Virtualization Installing dependencies on your development boxes is not a wise idea when virtualization is so easy. I use both vagrant with puppet and docker for running additional boxes on my machine. This allows me to install and run postgres, redis, etc and take these resources down when not in use without having to junk my box up with all the dependencies that are required for modern development.

Backup Even though you are "developing in the cloud" that does not mean you do not need to backup your workspace. Backups are really simple with rdiff-backup. It does incremental backups and is fast and efficient. I do daily backups of my development folder to another hard drive via a cron job to fire rdiff-backup and a weekly backup to S3 of the files.

That's about it. Any computer with a terminal allows me to securely connect to my workspace and resume on whatever I was working on. This setup also allows me to have a smaller and more portable computer because all the processing is done on my server that has fast cpus, ssd, and lots of ram. It has taken me a while to get used to working on the server and not on my local file system. I had to delete my development folder on my laptop (initially) so that I wouldn't be tempted to change files locally.

I do run the risk of not having internet access and not being able to access my files so I sill sync my development folder to my laptop. Hopefully more people will be able to look at hardware as a keyboard and a screen to connect to an always online workspace that is where ever you are.

comments powered by Disqus