/Slagora

Mirror of the Agora-Android Project

Primary LanguageScalaGNU General Public License v3.0GPL-3.0

Slagora

Readme

Slack Application (Slagora) that uses Agora: An Electronic Voting Library implemented in Scala

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

build status

Scala Play Updated
August 08, 2018

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

Table of contents

Installation

To install the backend, please do the following:

  1. Install Git.
  2. Clone this repo with https://gitlab.com/aossie/slagora
  • 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 Slagora fork and make your contributions via a branch on your fork.
  1. Install and run MongoDB

  2. Configure Silhouette to allow Slagora to do Oauth2 authentication:

    1. Make a copy of silhouette.conf and rename it to silhouetteLocal.conf.

    2. Create new applications in Slack

    3. Download Ngrok and run ngrok http 9000 copy the link (secured one example https://25ecd5c1.ngrok.io) and save for later use

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

        # Slack user provider
              slack_team.clientID = "Your Slack Client ID"
              slack_team.clientSecret = "Your Slack Client Secret"
              slack_user.authorizationURL = "https://slack.com/oauth/authorize"
              slack_user.accessTokenURL = "https://slack.com/api/oauth.access"
              slack_user.redirectURL = "(your ngrok link you obtained in step 4)/authenticate-user"
              slack_user.apiURL = "https://slack.com/api/users.identity"
              slack_user.scope = "chat:write:bot chat:write:user identity.basic identity.email identity.team identity.avatar"
      
          # Slack team provider
              slack_team.clientID = "Your Slack Client ID"
              slack_team.clientSecret = "Your Slack Client Secret"
              slack_team.authorizationURL = "https://slack.com/oauth/authorize"
              slack_team.accessTokenURL = "https://slack.com/api/oauth.access"
              slack_team.redirectURL = "(your ngrok link you obtained in step 4)/authenticate-user"
              slack_team.scope = "incoming-webhook commands bot"
      
    5. Delete the line include "silhouetteLocal.conf" from silhouetteLocal.conf.

  3. As above, make a copy of application.conf and rename it to applicationLocal.conf.

    1. 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")
    2. Delete the lines include "silhouette.conf" and include "applicationLocal" from applicationLocal.conf.

Running the application

To start the API, please do the following:

  • Make sure you have java 8 installed and not java 9. For some reasons the build fails with java 9
  • Start the server by running sbt run in the root folder.
  • Go to http://localhost:9000/ in a browser. Where you will see the API documentation hosted using swagger UI.
    • Note: Changing any source code while the server is running will automatically recompile and reload the application on the next HTTP request.

Application

The application will be served: Slagora or using the link generated by Ngrock

Deployment

The current development branch is deployed on Heroku and is available at https://slagora.com

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.

Further Reading / Useful Links