Skip to content

Development VM Image

johnsoft edited this page Aug 25, 2012 · 3 revisions

In the interest of making it easier to contribute code to LessWrong, the Public Goods Team has commissioned the creation of a virtual machine image configured to host the site. Now, all you have to do is download the image, set it up in VirtualBox, link the code to your github account, and you're all set up to use the site.

Getting Started

Downloading the Image:

TrikeApps has been nice enough to host the image here. Start by downloading http://files.trikeapps.com/lesswrong/LessWrong_Clone-disk1.vdi.7z, it takes a while.

Downloading VirtualBox:

Get the appropriate version of the VirtualBox installation software from their site: http://www.virtualbox.org/wiki/Downloads

Installing VirtualBox:

It pretty much installs the same way as most other software, and if you run into any issues you should troubleshoot from their site and Google. The following links might be helpful: http://www.virtualbox.org/wiki/User_HOWTOS, http://www.virtualbox.org/manual/ch12.html, http://dlc.sun.com.edgesuite.net/virtualbox/4.1.2/UserManual.pdf.

Checkpoint:

You should now have a zipped version of the image, and an installed version of VirtualBox.

Setting up the Image

Unzip the Image:

It's a 7zip file, unzip it in the manner appropriate to your operating system.

Make a Virtual Machine:

Follow these instructions to set up and use the image: http://www.virtualbox.org/manual/ch01.html#idp7594992

The VM is ubuntu-based, and you're using an "existing hard disk", look for where the image was unzipped to and tell it to use that. You'll need 5 GB in order to use the image.

Checkpoint:

You should now have a virtual machine hosting the LessWrong code installed in VirtualBox. The password is swordfish.

Linking to GitHub

Connect it to your account:

Make a new key and add it to your account as per this site: http://help.github.com/linux-set-up-git/

Put it on your account:

Go on github and fork the lesswrong repo: https://github.com/tricycle/lesswrong

cd into /home/lesswrong/lesswrong and run the command git push --mirror git@github.com:<your account name>/lesswrong

Initial Setup

There are a few things missing from the VM image, which cause a handful of errors and inconsistencies from production. These can be solved by opening a terminal and running:

# The VM defaults to Python 2.7, but Python 2.6 is used in production
cd ~/lesswrong/r2
sudo python2.6 setup.py install

# LW runs a patched version of memcached that handles negative numbers better
# see http://code.reddit.com/wiki/MemcachedChanges
# `make install` copied the binary to `/usr/local/bin/`, but the service runs the copy in `/usr/bin/`
sudo install ~/Downloads/memcached-1.2.5/memcached /usr/bin
sudo /etc/init.d/memcached restart

# The sidebar needs this file to display wiki data
cd ~/lesswrong/public/files
curl -O http://wiki.lesswrong.com/wiki.lesswrong.xml.gz
gunzip wiki.lesswrong.xml.gz

Using the Image

Running Tests:

In order to run the automated selenium tests, go to /home/lesswrong/lesswrong run bundle exec rake test:run

NOTE: If this does not work, and you've checked that the line export PATH=$PATH:/var/lib/gems/1.8/bin is already added to .bashrc in the home directory, you can get it to work by giving the command export PATH=$PATH:/var/lib/gems/1.8/bin directly in the terminal before running bundle exec rake test:run.

Starting up the Server:

To run the site for use inside the VM, run

cd ~/lesswrong/r2
python2.6 paster serve --reload development.ini port=8080

and then point a browser to http://lesswrong.local:8080/. Don't forget, if you share port 8080 with the host in the VM settings and add 127.0.0.1 lesswrong.local to your hosts file, you can also view the site using browsers on the host.

Contributing Code

Documentation

As you acquaint yourself with the Less Wrong source, consider summarizing your insights in this wiki to lower the barrier to contribution from others.

Bugs

Bugs/Issues are tracked here: http://code.google.com/p/lesswrong/issues/list

Using your Code

TrikeApps updates the site based on pull requests through github. Make sure that you notify wezm, and not just the tricycle user.

Quirks/Info

  • The password is swordfish
  • The keyboard is occassionally mapped to Italian. Click on the little keyboard icon in the upper right hand corner, hopefully this will be fixed in future versions
  • If bundle doesn't work, add the line export PATH=$PATH:/var/lib/gems/1.8/bin to .bashrc in the home directory

Additional Resources

Clone this wiki locally