Testing with vagrant
Clone this wiki locally
Vagrant is a tool to manage virtual machines for testing and development. It makes it easy to make, share and use virtual machines for testing.
vagrant instances are called boxes, and the box used in this howto was made in the beginning of October 2012, and is as such out of date. The Ubuntu server is beta, and the OSM database is from old and limited to Norway, and so you will need to zoom in on Norway to see any data. It also has a fair amount of cruft and redundant software because it was made by first updating a precise32 box to quantal, and then installing Waymarked Trails wasn't as straight-forward as it should have been. A leaner box based on Debian Wheezy would be much appreciated.
If you still want to have a go using it, it comes complete with all necessary software (at the time) installed and setup, and to have your own Waymarked Trails server up and running all you need to do is:
- Install vagrant.
Add the Waymarked Trails box:
vagrant box add wt http://dl.dropbox.com/u/234927/quantal32-wt.box
At the moment the box is 2 GB in boxed form.
Make and start your own box:
mkdir wt-test cd wt-test vagrant init wt vagrant up
Your box is now up and running, and with the default port forwarding you can access your own personal Waymarked Trails installation with your web browser at http://localhost:4567
To tweak it you simply log in to the server with:
To update we suggest you use keep a repository in the
vagrant directory which is shared among the host and guest machine and available at
/vagrant on the guest machine. Then you can work on the files in the host machine, and push them to the bare repository inside the guest machine, emulating a production environment as close as possible. You could also host your website in the vagrant directory and have your changes immediately available.
git push setup
ssh to your waymarkedtrails machine:
Setup your repository to work on:
cd /vagrant git clone ~/waymarked-trails-site.git
You can now work on the code either on your host machine or in the virtual machine, and every time you want to make your changes active, you commit and push to the bare repository in the vagrant home directory:
git push origin
Serve from vagrant directory
To commit and push every time you want to see your changes can be quite time consuming and redundant and uneccesary, but serving directly from your repository in
/vagrant is easy. To test with the Django development server simply follow the "Test your setup" section of Installation (remember to change the paths), and to test with apache you can enable the wt-test-vagrant apache virtual host settings:
cd /vagrant/waymarked-trails-site cp /srv/www/wt-test/last_update . sudo a2dissite wt-test sudo a2ensite wt-test-vagrant sudo service apache2 restart