Public | Automated Build

Last pushed: 3 years ago
Short Description
Short description is empty for this repo.
Full Description


Getting Started Quickly

Ubuntu Server 12.04 & 14.04

First, make sure Mercurial is installed so that you can clone the repo, and then clone it. If you already have a copy of the repo, use that.

    ~$ sudo apt-get install mercurial
    ~$ hg clone

Set environment variables. Make sure to adjust these to your situation if needed. Make sure to use an absolute path for the code directory.

    ~$ export PACTVOTE_CODEDIR="/home/ubuntu/pact-vote"
    ~$ export PACTVOTE_USER="ubuntu"
    ~$ export PACTVOTE_GROUP="ubuntu"

Then, run the Ubuntu deployment scripts.

    ~$ cd $PACTVOTE_CODEDIR/deployment
    ~/pact-vote/deployment/$ sudo sh
    ~$ cd $PACTVOTE_CODEDIR/deployment
    ~/pact-vote/deployment/$ sh

You may have to say "yes" to a few prompts, such as if Bower asks you if you would like to report anonymous usage data. Just accept all of them. If the system ever tells you there is a package conflict and asks you to choose the package, choose the latest version of the package in question.

Also note that there is a "sudo" command in the script, so you may get asked for your password.

Now, to run the server, use:

    ~/pact-vote/pact-vote$ node server.js

Then, open a browser and go to http://localhost:3000/#/

Your all set with your deployment.

Apple OSX using a virtual machine (Vagrant)

First, you will need to install MacPorts. Please go to and follow the instructions to install.

Then, you will need to install Mercurial and clone the repo.

    ~$ sudo port install mercurial
    ~$ hg clone

Then you will need to install Vagrant

Now set up your Vagrant boxes if you have not already done so.

    ~$ vagrant box add hashicorp/precise32

Run vagrant up. This can take a long time. Particularly, the compilation and installation of NodeJS can take a while. Allocate 45 minutes to an hour for this step unless you have a really fast machine.

    ~$ vagrant up

Enter your newly virtual machine, and run the server

    ~$ vagrant ssh
    ~$ cd /vagrant/pact-vote
    ~$ node server

Congradulations! You have PACT-Vote set up on your machine. You can visit it by going to http://localhost:3000/#!/

If you have any issues, you may need to do bower install:

    ~$ vagrant ssh
    ~$ cd /vagrant/pact-vote
    ~$ bower install


Installing Dependencies (Ubuntu Server 14.04)

These instructions are from a totally clean installation of Ubuntu server 14.04.

First step is to install a set of basic tools that you will need

    ~$ sudo apt-get install wget curl fakeroot checkinstall tar mercurial git python gcc g++

Now install NodeJS. Note! Do not install using apt-get, as the version of Node on the Ubuntu repository is too out of date.

    ~$ cd ~
    ~$ wget -N
    ~$ tar xzvf node-latest.tar.gz && cd node-v*
    ~$ ./configure
    ~$ fakeroot checkinstall -y --install=no --pkgversion $(echo $(pwd) | sed -n -re's/.+node-v(.+)$/\1/p') make -j8 install
    ~$ sudo dpkg -i node_*

Install NPM in a similar fashion

    ~$ cd ~
    ~$ curl | sudo sh

Install MongoDB. Again don't install using the Ubuntu repository, as the version of MongoDB will be too out of date.

    ~$ sudo apt-key adv --keyserver hkp:// --recv 7F0CEB10
    ~$ echo 'deb dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
    ~$ sudo apt-get update
    ~$ sudo apt-get install -y mongodb-org
    ~$ sudo mkdir /data
    ~$ sudo mkdir /data/db
    -$ sudo reboot

You can check that MongoDB is running by executing:

    ~$ sudo service mongodb status

Lastly, install Bower globally

    ~/pact-vote/pact-vote$ sudo npm install -g bower

Installing Depedendencies (Generic)

This provides a list of tools that are required for PACT-Vote. You will have to figure out how to install them on your own system.

Tools Prerequisites

  • MongoDB - The very powerful Mongo Database.
  • Mercurial - PACT-Vote uses the simple and powerful Mercurial as its version control system.
  • NPM - Node.js package manage; should be installed when you install node.js.
  • Bower - Web package manager. Installing Bower is simple when you have npm:
  • Pyhton 2.7
  • .NET Framework 2.0 SDK
  • MS Visual C++ Studio 2005
    ~/pact-vote/pact-vote$ sudo npm install -g bower


  • Grunt - Download and Install Grunt.
      ~/pact-vote/pact-vote$ sudo npm install -g grunt-cli

Node & Bower Packages

  • Express - Defined as npm module in the package.json file.
  • Mongoose - Defined as npm module in the package.json file.
  • Passport - Defined as npm module in the package.json file.
  • AngularJS - Defined as bower module in the bower.json file.
  • Twitter Bootstrap - Defined as bower module in the bower.json file.
  • UI Bootstrap - Defined as bower module in the bower.json file.

Setting up the application itself

Clone the repository and enter the pact-vote sub-directory of the pact-vote repository root:

    ~$ hg clone
    ~$ cd pact-vote/pact-vote

Install Bower and Node packages

    ~/pact-vote/pact-vote$ sudo npm install
    ~/pact-vote/pact-vote$ bower install  

You may have to say "yes" to a few prompts, such as if Bower asks you if you would like to report anonymous usage data. Just accept all of them. If the system ever tells you there is a package conflict and asks you to choose the package, choose the latest version of the package in question.

You will also need to install modules for each of the sub-packages:

    ~/pact-vote/pact-vote$ cd packages/pact_issue
    ~/pact-vote/pact-vote$ npm install
    ~/pact-vote/pact-vote$ cd ../../packages/pact_content
    ~/pact-vote/pact-vote$ npm install
    ~/pact-vote/pact-vote$ cd ../../packages/pact_profile
    ~/pact-vote/pact-vote$ npm install
    ~/pact-vote/pact-vote$ cd ../../packages/pact_secure_vote
    ~/pact-vote/pact-vote$ npm install
    ~/pact-vote/pact-vote$ cd ../../packages/pact_groups
    ~/pact-vote/pact-vote$ npm install
    ~/pact-vote/pact-vote$ cd ../../packages/pact_theme
    ~/pact-vote/pact-vote$ npm install

If you install grunt (reccomended), using grunt to start the server:

    ~/pact-vote/pact-vote$ grunt

If grunt aborts because of JSHINT errors, these can be overridden with the force flag:

    ~/pact-vote/pact-vote$ grunt -f

Alternatively, when not using grunt you can run:

    ~/pact-vote/pact-vote$ node server

Then, open a browser and go to http://localhost:3000/#/


During install some of you may encounter some issues.

Make sure you run the instance of MongoDB database server (by-default will listen for connections on the port 27017). For that locate the mongod.exe file (usually \bin directory in C:\Program Files\MongoDB[version]\bin\ or C:\Program Files\MongoDB[version]\Server\bin), locate the path to the actual database or just create a \data\ empty directory and run

    ~$ sudo mongod --dbpath=/[db path]/data

If you getting the error, try

    ~$ sudo mongod --dbpath=/[db path]/data --smallfiles

If you wish to change the port for database connections, change the config settings in the app and run

    ~$ sudo mongod --dbpath=/[db path]/data --port [port#]

Most issues can be solved by one of the following tips, but if are unable to find a solution feel free to contact us via the repository issue tracker or the links provided below.

Update NPM, Bower or Grunt

Sometimes you may find there is a weird error during install like npm's Error: ENOENT. Usually updating those tools to the latest version solves the issue.

  • Updating NPM:

      ~$ npm update -g npm
  • Updating Grunt:

      ~$ npm update -g grunt-cli
  • Updating Bower:

      ~$ npm update -g bower

Cleaning NPM and Bower cache

NPM and Bower has a caching system for holding packages that you already installed.
We found that often cleaning the cache solves some troubles this system creates.

  • NPM Clean Cache:

      ~$ npm cache clean
  • Bower Clean Cache:

      ~$ bower cache clean


All configuration is specified in the server/config folder, particularly the config.js file and the env files.

Environmental Settings

There are three environments provided by default: development, test, and production.

Each of these environments has the following configuration options:

  • db - This is the name of the MongoDB database to use, and is set by default to mean-dev for the development environment.
    • - This is the name of your app or website, and can be different for each environment. You can tell which environment you are running by looking at the TITLE attribute that your app generates.
    • Social OAuth Keys - Facebook, GitHub, Google, Twitter. You can specify your own social application keys here for each platform:
    • clientID
    • clientSecret
    • callbackURL

To run with a different environment, just specify NODE_ENV as you call grunt:

    $ NODE_ENV=test grunt

If you are using node instead of grunt, it is very similar:

    $ NODE_ENV=test node server

NOTE: Running Node.js applications in the production environment enables caching, which is disabled by default in all other environments.

Important Directories

  • Models - pact-vote/server/models/ - Where we define our object schema.
  • Controllers - pact-vote/server/controllers/ - Where we take care of our backend logic.
  • NodeJS Routes - pact-vote/server/routes/ - Where we define our REST service routes.
  • AngularJs Routes - pact-vote/public/routes/ - Where we define our CRUD routes.
  • The AngularJs Service - pact-vote/public/services/ - Where we connect to our REST service.
  • The AngularJs Controller - pact-vote/public/controllers/ - Where we take care of our frontend logic.
  • The AngularJs Views Folder - pact-vote/public/views/ - Where we keep our CRUD views.

Heroku Quick Deployment

Before you start make sure you have the Heroku toolbelt
installed and an accessible MongoDB instance - you can try MongoHQ
which has an easy setup).

Add the db string to the production env in server/config/env/production.js.

    git init
    git add .
    git commit -m "initial version"
    heroku apps:create
    heroku config:add NODE_ENV=production
    heroku config:add BUILDPACK_URL=
    git push heroku master
    heroku config:set NODE_ENV=production

Docker Deployment

We use Docker to create prebuilt LXC images based on Ubuntu 14.04. These images are then uploaded to Docker Hub, facilitating very easy installation and booting of PACT-Vote instances.

    ~$ docker deployments/Dockerfile

Who do I talk to? (Contacts)

This mailing list should be your go-to for any programming related questions on PACT-Vote:

For any deployment questions, contact here:


This file is part of PACT-Vote.

PACT-Vote is the PACT Party of Canada's official online voting and democracy facilitation system. It may eventually become the worlds.

Copyright (C) PACT. AUTHORS listed in AUTHORS file.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see

You can contact the PACT party online at, or via paper mail at:


Or by email:

Docker Pull Command
Source Repository