Skip to end of metadata
Go to start of metadata

This page is a work in progress. It will be updated as new advice becomes available.

At the IDRC, we develop with OER Commons running in a vagrant virtual machine.

When we update the OER Commons codebase, it is often necessary to rebuild the database and run various scripts to bring the environment up-to-date with the latest code. This page attempts to summarize the steps necessary for this, describing various shell commands that need to be run.

Setting up the code to work in your environment

Make sure 'development.py' has the following things properly pointing at your personal instance:

SESSION_COOKIE_DOMAIN = "<your machine>" # May be your IP, or 'localhost'
DEFAULT_SITE_DOMAIN = "<your machine>:8000"

MICROSITES = {"arabic": {"domain": "arabic.<your machine>:8000"}}

Make sure 'settings.py' has the following things paths set properly (our local environment is different than what's specified in github):

SCSS_EXECUTABLE = "/opt/ruby/bin/sass"
COFFESCRIPT_EXECUTABLE = "/usr/bin/coffee"
SCSS_USE_COMPASS = True

Installing PostGIS

In mid-April 2013, OER Commons added some map features. This requires the installation of PostGIS on your local system.

To install PostGIS on your VM follow the instructions at Installing PostGIS in your OER Commons VM.

Note: You will only have to install PostGIS once!

To completely rebuild the database

These instructions assume your database is called oercommons_db. If you are using a different name, you must adjust these instructions accordingly.

Log in to the vagrant VM:

vagrant ssh

Become superuser, drop the database and recreate it:

sudo -i
su - postgres
dropdb oercommons_db
createdb -O oercommons_user -E UTF-8 --locale=en_US.UTF-8 -T template_postgis oercommons_db
exit
exit

Activate the virtual environment:

cd /vagrant/oercommons
source ./virtualenv/bin/activate

Remove django and run the buildout config:

rm -rf src/django
./bin/buildout -c buildout-dev.cfg

Creates any database tables that have not already been created. (NO NOT create a django admin account when prompted):

./bin/django syncdb

Run the migration scripts:

./bin/django migrate

Note: Sometimes this fails. If so, check the output to see which table seems to be missing (try ./bin/django migrate --list). Run the migration specific to that table, then try re-running the entire thing again:

./bin/django migrate <whatever's missing>
./bin/django migrate

You may have to repeat this process a few times.

Load the microsite data, then create the superuser:

./bin/django loaddata apps/materials/fixtures/microsites.json
./bin/django createsuperuser

Remove the compiled python files:

find . -name '*.pyc' -delete

Restart Jetty:

sudo invoke-rc.d jetty stop
sudo invoke-rc.d jetty start

Exit the vagrant VM and restart it.

  • No labels