/agora

Primary LanguageScala

Agora-Web

Readme

Frontend for Agora: An Electronic Voting Library implemented in Scala

This project is created using the play framework 2.5 seeds template.

build status

Scala Play Updated
August 22, 2017

To run the development environment for this frontend, you need Git, Sbt and MongoDB installed.

Table of contents

Installation

To install the frontend, please do the following:

  1. Install Git.
  2. Clone this repo with https://gitlab.com/aossie/Agora-Web
  • Note: If you just want to use the project, cloning is the best option. However, if you wish to contribute to the project, you will need to fork the project first, and then clone your Agora-Web fork and make your contributions via a branch on your fork.
  1. Install and run MongoDB
  2. Configure Silhouette to allow Agora's frontend to do Oauth2 authentication:
    1. Make a copy of silhouette.conf and rename it to silhouetteLocal.conf.

    2. Create new applications in Facebook, Twitter and Google

    3. Fill the following fields in silhouetteLocal.conf with the ids, keys and secrets from your created applications.

      facebook.clientID=${?FACEBOOK_CLIENT_ID}
      facebook.clientSecret=${?FACEBOOK_CLIENT_SECRET}
      google.clientID = ${?GOOGLE_CLIENT_ID}
      google.clientSecret = ${?GOOGLE_CLIENT_SECRET}
      twitter.consumerKey=${?TWITTER_CONSUMER_KEY}
      twitter.consumerSecret=${?TWITTER_CONSUMER_SECRET}
      
    4. Change the redirect URL in silhouetteLocal.conf to your localhost localhost:9000.

    5. include the silhouetteLocal.conf into the silhouette.conf.

      include "silhouetteLocal.conf"
      
  3. As above, make a copy of application.conf and rename it to applicationLocal.conf. Assign your MongoDB URI (e.g. mongodb://localhost, if you are connecting to a MongoDB server running in your local computer) to the mongodb.default.uri field (e.g mongodb.default.uri = "mongodb://localhost"), set your SendGrid username and password, and include applicationLocal.conf into application.conf.

Running the application

To start the frontend, please do the following:

  • Start the server by running sbt run in the frontend's root folder.
  • Go to http://localhost:9000/ in a browser. Use one of your social accounts to login to the system.
    • Note: Changing any source code while the server is running will automatically recompile and reload the application on the next HTTP request.

Troubleshooting your local environment

Always git pull and get the latest from master. Google and Stackoverflow are your friends. You can find answers for most technical problems there. If you run into problems you can't resolve, feel free to open an issue.

Running Tests

To run the test suite locally while developing, just run sbt test from the project root.

Tests will also run automatically via Gitlab CI when you push commits to a branch in the repository. You can view the output of the tests in GitLab's pipeline tab or in a Merge Request's acceptance box in its discussion tab. For this, you have to configure .gitlab-ci.yml and add your HEROKU-API-KEY as a secret variable in the Gitlab.

Further Reading / Useful Links

Demo

There are two working versions deployed to heroku:

  1. Development Version : https://fathomless-taiga-85734.herokuapp.com/

  2. Production Version: https://agora-web-aossie.herokuapp.com

The deployed version is also accessible through http://agoravote.org .