Sunday, January 3, 2010

Building a portable dev environment

I started a little coding side-project, and came to the idea of putting the whole dev environment on a usb drive.  That way, I could plug it in wherever I am, on any computer, and have all the tools I needed without any additional setup.

An additional benefit: to bring another developer onto the project, I could just drop the contents of the drive on their computer.  They'd be instantly ready to roll, with close to zero start-up effort.

I have a 8GB drive, but so far the environment uses only about 500MB.  Here's what I installed:

* JRuby.  The project calls for Ruby, and I went with JRuby because it's extremely portable: just extract the binary zip to wherever you need it.  You might be able to setup Ruby on a flash drive, but the options sounded more experimental. 

* Java SDK.  Turns out you can direct the java installer to point right at your USB drive.  Here's more detailed instructions.  Very easy, ran across only one bug -- closed by Sun though not fixed -- that didn't have any effect on performance / function.

* Eventually, I'll need a j2ee container, but I feel pretty confident I could get resin or tomcat or glassfish working on a drive.  Installing webapps on a j2ee container involve nothing more than just a .war file drop, of course, so dropping in Rails should be a snap.  I don't need Rails just yet, but I'll post an update when I try that.

* Git.  Git offers a portable version, and is more appropriate for distributed source control than something like subversion.  If I used subversion, that would mess up the whole goal of keeping it on a flash drive.  I wouldn't be able to drop the env to a friend at a moment's notice, and then we'd need a central server stored somewhere.  Git might need some additional config if others join, but for now it's just me.

Of course, using Git might seem like overkill to some.  I like to save versions frequently, and I quickly get tired of and confused by all the .old and .dated files and directories lying around.  Git will eliminate all that clutter.

* Firefox.  While coding, you always end up with a ton of reference and investigation links.  I thought taking my browser with me would be better than storing links on a 3rd party site, which I've never really liked.  IE is not a possibility, and I prefer Firefox for the add-ins anyway.  This ended up working very well (as long as you bump up the cache, which defaults at 0), except for one problem, which might be considered serious.  If you run the portable version, with all your dev-related links, and then you try to run your local version, Firefox just runs another instance of the portable version.  So, you can't get to any locally-installed links without closing the portable version.  One workaround would be to store all links on all your Firefox installations, but I wasn't really looking to store, for example, my company's HR website on my dev env, especially if I want to drop the whole thing to another developer at some point.  Will have to think about this one a bit more.

* gVim.  I want to use the same code / text editor on any computer; your productivity increases as your expertise increases.  Yes, going to gVim feels a little like using WordPerfect on the dawn of Word's impending domination, but gVim is much more robust than Notepad++, which might be the only other possible contender meeting these two criteria: free and portable.  Frankly, I found very few features that gVim didn't have or couldn't be added to the default configuration.  A robust text editor decreases the likelihood of needing to fall back to a full-blown IDE, which I'm not sure would run well on a flash drive (though some say it works).

That's where I am so far.  Other than the remaining Firefox issue, the results have exceeded what I thought was possible.  I'll provide updates as my env requirements grow or unexpected issues pop up.

No comments:

Post a Comment