Hacking Less Wrong made easy: Vagrant edition

post by Morendil · 2012-01-30T18:51:05.377Z · LW · GW · Legacy · 4 comments

The Less Wrong Public Goods Team has already brought you an easy-to use virtual machine for hacking Less Wrong.

But virtual boxes can cut both ways: on the one hand, you don't have to worry about setting things up yourself; on the other hand, not knowing how things were put together, having to deal with a "black box" that doesn't let you use your own source code editor or pick an OS - these can be offputting. To me at least, these were trivial inconveniences that might stand in the way of updating my copy of the source and making some useful tweaks.

Enter Vagrant - and a little work I've done today for LW hackers and would-be hackers. Vagrant is a recent tool that allows you to treat virtual machine configurations as source code.

Instead of being something that someone possessed of arcane knowledge has put together, a virtual machine under Vagrant results from executing a series of source code instructions - and this source code is available for you to read, review, understand or change. (Software development should be a process of knowledge capture, not some hermetic discipline where you rely on the intransmissible wisdom of remote elders.)

Preliminary (but tested) results are up on my Github repo - it's a fork of the offiical LW code base, not the real thing. (One this is tested by someone else, and if it works well, I intend to submit a pull request so that these improvements end up in the main codebase.) The following assumes you have a Unix or Mac system, or if you're using Windows, that you're command-line competent.

Hacking on LW is now done as follows (compared to using the VM):

The cool part is that the "/vagrant" directory on the VM is mapped to where you checked out the LW source code on your own machine: it's a shared directory, which means you can use your own code editor, run grep searches and so on. You've broken out of the black box!
If you try it, please report your experience in the thread below.

 

4 comments

Comments sorted by top scores.

comment by Emile · 2012-01-30T22:33:09.548Z · LW(p) · GW(p)

Talk about trivial inconveniences - when I try to get vagrant with gem I get

ERROR: While executing gem ... (Gem::RemoteSourceException)

HTTP Response 302 fetching http://gems.rubyforge.org/yaml

... and looking up explanations it seems I don't have the right version of ruby, and most explanations on how to do that seem to be about installing a new ruby and not upgrading the one on my system, and when I try to use my mac's "Mac OS X Software" option to try to update the system ruby it takes me to a webpage that wants to sell dashboard widgets.

At this point I have too many tabs open and it's bedtime.

Replies from: Morendil
comment by Morendil · 2012-01-31T07:40:32.132Z · LW(p) · GW(p)

Which version of Ruby do you have? Macs ship with 1.8.2 (Tiger), 1.8.6 (Leopard) or 1.8.7 (Snow Leopard).

The advice I've seen for this error is to get the latest version of Rubygems, not Ruby: http://rubygems.org/pages/download

Replies from: Emile
comment by Emile · 2012-01-31T11:12:03.589Z · LW(p) · GW(p)

Right, it's more likely a problem of the version of gems and not of ruby (I think I have Leopard - I'm not on my home machine now).

When running

gem update --system

... I got the same error as above, so I guess I'll have to manually download it and install it and hope that the new one will become the default version (I'm somewhat wary of doing that, I don't like having several versions of the same software on one machine).

comment by Morendil · 2012-01-30T21:09:54.249Z · LW(p) · GW(p)

Edited: add a step I'd forgotten (change password in development.ini)