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 following prerequisites are unchanged: git, Virtualbox
  • Install the following prerequisites: Ruby, rubygems, Vagrant
  • Download the Less Wrong source code as follows: git clone git@github.com:Morendil/lesswrong.git
  • Enter the "lesswrong" directory, then build the VM with: vagrant up (may take a while)
  • Log into the virtual box with: vagrant ssh
  • Go to the "/vagrant/r2" directory, and copy example.ini to development.ini
  • Change all instances of "password" in development.ini to "reddit"
  • You can now start the LW server with: paster serve --reload development.ini port=8080
  • Browse the URL http://localhost:8080/
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.

 

New Comment
4 comments, sorted by Click to highlight new comments since:

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.

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

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).

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