Installation

This document concerns only the latest Helios v3.1 code, last updated on June 8th, 2011.

As of v3 beta (due in July 2010), Helios is no longer based on Google App Engine, but instead on a standard Django/Python + PostgreSQL stack. This document explains how to install Helios on a standard Linux machine, preferably Ubuntu 10.04.

Contributors: Ben Adida, Rodrigo Germán Fernández Gaete.

Components

  • Ubuntu Linux 10.04 (for these instructions, should be adaptable to other Linux distributions.)
  • PostgreSQL 8.3+ (may work with other databases, uses Django modeling, but not tested yet.)
  • Python 2.5+, Python 2.6 preferred
  • Django 1.2 (1.1 is no longer supported, 1.3 has not yet been tested)

Steps

These steps assume a modern Ubuntu Linux installation.
  • install PostgreSQL
    apt-get install postgresql
  • install Python packages to connect to PostgreSQL
    apt-get install python-psycopg2
  • install Django 1.2
    apt-get install python-django
  • set up PostgreSQL database
    • for simplicity, these instructions assume that you keep PostgreSQL in "ident" authentication mode, where Unix users are automatically Postgres users. This is not a great idea for production, but we'll document that later.
    • create a PostgreSQL user where <USERNAME> is your Linux username:
      su - postgres
      createuser --superuser <USERNAME>
  • get the Helios code from source, switch to the pure-django branch, and check out submodules:

    If you have a recent version of git, you can use a single command:

    git clone --recursive git://github.com/benadida/helios-server.git
    
    If not, you need to do a little bit more work:
    git clone git://github.com/benadida/helios-server.git
    cd helios-server
    git submodule init
    git submodule update

    cd heliosbooth
    git submodule init
    git submodule update

    cd ../heliosverifier
    git submodule init
    git submodule update
  • Install Python OpenID support (for Google and Yahoo logins):
    git clone http://github.com/openid/python-openid
    cd python-openid
    sudo python setup.py install
  • Install a few more Python packages:
    apt-get install python-setuptools
    easy_install south

  • copy settings.py.sample to settings.py

  • update the following parameters in settings.py:

    DATABASE_NAME = 'helios'
    DATABASE_USER = ''
    DATABASE_PASSWORD = ''

    DEFAULT_FROM_EMAIL = 'Ben Adida for Helios <ben@adida.net>'

    # these three hosts should all be the same for dev
    # e.g. http://localhost:8000
    URL_HOST = "http://...."
    SECURE_URL_HOST = "https://..."
    SOCIALBUTTONS_URL_HOST = "http://..."

    # FOOTER links
    FOOTER_LINKS = [{'url':'http://usg.princeton.edu/elections', 'text':'USG Elections Center'}

    WELCOME_MESSAGE = "welcome"
  • load the data model, which will create a user "benadida" with password "test" (You may need to edit reset.sh with your db passwords.)
    sh ./reset.sh
  • run the development server on port 8000:
    python manage.py runserver 8000
  • if you'd like this running on all IP addresses (not just 127.0.0.1), use the following command:
    python manage.py runserver 0.0.0.0:8000


Jobs to Run Regularly

Some jobs needs to be run regularly, and for this Helios uses RabbitMQ, Celery, and Django Celery. RabbitMQ is the queue, while Celery and Django-Celery are the Python components that provide simple programming constructs for queueing and dequeuing jobs.
RabbitMQ 1.8 - follow instructions given at http://www.rabbitmq.com/debian.html
  • After updating the deb source, as per the instructions,
apt-get install rabbitmq-server
  • Install celery and django celery. More info at http://celeryq.org
    Celery and Django Celery both v2.0.2
easy_install celery
easy_install django-celery
Then you'll need to make sure that:
  • RabbitMQ Server s running (it should happen automatically if you followed the above install instructions)
  • The Django Celery Daemon server is running:

    python manage.py celeryd

Comments