/AnalyticsPOC

Web application to provide election officials with statistics on voter outcomes

Primary LanguageJavaScript

Virginia Voter Log Analytics
============================

Requirements
------------

* Ruby 1.9.3
* Sqlite3 (development), MySQL 5+ (production)


Installation
------------

* Get the most recent source code.

* Install required gems:

        $ bundle install

* Start the application server:

        $ rails server thin


Deployment prerequisites
------------------------

* MySQL 5+
* Ruby 1.9.3-p0 (see Installing Ruby section)
* Apache 2 with Passenger 3.0.11 (see Installing Passenger section)


Deployment
----------

* (locally) Copy config/deploy.rb.sample to config/deploy.rb
  * Change "domain" to either IP or domain address of the target system
  * Change "user" / "runner" to the name of the Unix user you will be SSH'ing into the "domain" as
  * Change "branch" to the branch name (i.e. "master", "release" etc)
    or to the release tag (i.e. "1.1", see below "Release tagging" section)

* (locally) Setup the remote location:

    $ cap deploy:setup

* (locally) Verify the setup:

    $ cap deploy:check

* (remotely) Create configuration files:
  * create database for the application (i.e. va_analytics)
  * create <deploy_to>/shared/config/config.yml (see sample in config/config.yml.sample)
  * create <deploy_to>/shared/config/database.yml (see sample in config/database.yml.sample) with only the "production" environment, like this:

      production:
        adapter: mysql2
        database: va_analytics
        host: localhost
        username: <db_user>
        password: <db_password>
        socket: <path_to>/mysql.sock

* (locally) Make initial one-time deployment:

    $ cap deploy:cold

* (locally) Seed the database from db/seed.rb

    $ cap db:seed

* (remotely) Configure Apache virtual host with:

    <VirtualHost *:8888>
      ServerName    server.com
      DocumentRoot  <deploy_to>/current/public
    </VirtualHost>


Release tagging
---------------

To tag a release you:

* (locally) Mark a certain commit on "master" branch:

    $ git tag 1.1

* (locally) Push tags to remote repository:

    $ git push --tags


Installing Ruby
---------------

Detailed installation instructions can be found here:

    http://www.ruby-lang.org/en/downloads/

You can either build it from source code or use RVM.


Installing Passenger
--------------------

Once you have Ruby and Apache 2 installed, to install Passenger you run:

    $ gem install passenger
    $ passenger-install-apache2-module

The installation requires some development libraries of Apache server
and the configuration script will show which of them are missing.

Upon installation, you need to add Passenger module configuration to
your httpd.conf or a separate file in `/etc/httpd/conf.d/passenger.conf`
(recommended).