Coding in the Cloud [practical fact or developer fiction]
Why I moved my primary coding environment to a cloud VPS in 2014: Vim, tmux and mosh over SSH, Dropbox as a safety net, and what it meant for working on poor connections at customer sites.
Written in 2014 while I was experimenting with doing my day-to-day development away from a laptop. Kept here as originally published.
For the last 12 months I have been intrigued with the idea of a development environment in the cloud. There are some great posts out there detailing methodologies and the experiences of engineers who have gone down this road. The following is a short list of ones I have read and found useful:
- swapped-my-macbook-for-an-ipad
- ipad-coding-for-web-development
- one-year-later-the-ipad-is-still-my-favorite-computer
I am somewhat of a polyglot engineer who started with a Sinclair ZX81 and BASIC over 34 years ago, C/C++ at university then moved into enterprise development (integrating heterogeneous systems) with Visual Basic, ASP and SQL through to Java, .Net, JavaScript, Lisp, R, Ruby, Go Lang, Objective C for enterprise, mobile and SaaS solutions. Now my general day-to-day tool-chain is Ruby (web/general development) and recently Go Lang (system development). Gone are the days of building platform native GUI applications, replaced by platform agnostic APIs used through JavaScript client applications; nothing new here.
For the last 20+ years I have been lugging a laptop around, starting with an Olivetti Echos P120c then, a beast of a Dell (4 KG), Apple TiBook, IBM ThinkPad, 17” MBP … finally ending up with a 2013 13” MacBook Air which is my current daily driver. This IMHO, is almost the perfect developer laptop, lasts all day and the i7 with 8GB RAM chews up and spits out any tasks I throw at it. The downside is hunting for WIFI hotspots (or tethering) while on the move
A little over a year ago I dumped my existing development editor (Sublime Text 3 Beta) which was/is a superb editor and moved to MacVim primarily after reading a blog post by the famous Yehuda Katz detailing how he approached the switch. Vim is all about muscle memory, which sometimes drives me nuts, particularly when it comes to using other content creation apps, all I seem to end up with is ‘hjklhjkl…’, anyway let’s not digress.
12 months later and I have my Vim environment finely tuned, using essential plug-ins such as ‘Unite, Vundle, NerdTree’ to name but a few. When setting up Linux servers I generally deploy my Vim configuration allowing me to transition between local and server machines for editing configuration and deployment settings.
At home and the office, the coding-test-deployment cycle is a joy, as fast, always-on internet connections allow me to be super productive and responsive. I have gotten into the habit of closing OS X Mail, ignoring Skype and just getting on with the task at hand.
Recently work has required me to be on-site at key customer locations, where the WIFI connection is poor/unavailable hence I have been depending on mobile data connections. In these circumstances, development on my MBA is fine, but deploying updates to UAT and production environments over a mobile connection can prove challenging and long-winded, particularly with large assets that have to be copied to multiple servers, and don’t forget the data costs once you go over your monthly allowance.
Last week, after much deployment pain and data cost, I decided to purchase a VPS subscription from OVH to use as my primary coding environment. Having recommended OVH to clients in the past (as they provide an excellent service with cost savings over the competition - BTW I am not on commission), I selected the VPS Classic 1 2GB RAM 2x virtual cores, a consistent 100 MBits connection would mean no more issues with deployments and @£5.09/month this becomes a cost no-brainer.
The VPS was configured with a standard 14.04 LTS image, 1 hour later after installing VIM, Postgres, RVM/Ruby, GIT, Dropbox (sync files between my MBA and VPS) I was up and running - well almost. Next I needed a terminal multiplexer to replace my local use of iTerm, I settled on Tmux and tmuxinator which allows per project tmux session configuration. Done or so I thought!
One wrinkle was the reliability of SSH connections when changing networks (i.e. switching from a Wifi hotspot to mobile connection and back again). Constantly killing SSH client sessions is a waste of keystrokes. After some further research I found mosh, a client/server terminal application that initiates a connection over SSH which spawns a server instance of the application, the client then connects to the server over UDP 6001 - 6100 and the SSH connection is closed. Mosh handles all aspects of maintaining the server connection (including client network address changes) while optimising data transmission (i.e. only transmitting screen deltas between server and client). Now I close my laptop, no need to worry about the SSH client hanging when I open the lid, it just works; but … alas I have not found an iOS compatible application, thus I am relying on SSH when using an iPad/iPhone (but this is where tmux really shines).
I am only a week into my new setup, roaming around with my MBA rather than only an iPad, but all work is done on my VPS. Dropbox automatically syncs changes back to my MBA in case of network loss, although I have to remember not to edit code in both places otherwise the local git branch indexes & change lists conflict and require manually editing.
Unlike the gradual move to Vim a year or so ago, my move to the cloud for a full-blown development environment has been immediate (although I have a safety net with Dropbox syncing all changes between my VPS and MBA).
My next stage is to leave the MBA at home, although I am not convinced of the advantages of going iPad only as you still need to lug a keyboard around (mine is the Filco Bluetooth Minila Air). But the new iPhone 6 Plus hooked up to an external 1920x1080 monitor with a Bluetooth keyboard is an interesting proposition I am keen to explore.
Setup of the VPS development environment was manual, which I plan to automate in the future by using Docker in combination with the OVH provisioning API making for a slick way to provision per-project development environments.
Continued in Coding In the Cloud [practical fact or developer fiction] part 2, where I try coding from an iPhone 6 Plus and then an iPad Air 2.