Hacking Less Wrong made easy: Vagrant edition

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.