MozScout / scout-ua

8 stars 4 forks source link

Scout UA

Build Status Coverage Status

Setting up

AWS IAM

Create a new AWS IAM user.

It needs the following permissions:

Remember the Access Key Id and the Secret.

AWS S3 Bucket

Create an AWS S3 Bucket. It will be used to store the audio files.

In Permissions/Bucket Policy you can paste the following code (replace the resource name):

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::s3-bucket-name/*"
        }
    ]
}

Environment Variables

You need the following environment variables:

Deploy locally

Node version 9.11.1 is helpful for running locally due to natural libraries dependencies.

Deploy on Heroku

This can also be run on Heroku. Here are the instructions for running with Heroku:

Tests

npm test runs the tests (lint, unit tests, integration tests).

To run lint individually: npm run lint.

To run unit tests individually: npm run unit-test. You must have the variable AWS_REGION defined in order to run the unit tests. You can run export AWS_REGION=us-east-1.

For the integration tests, you need to add the TEST_API_URL and the TEST_API_ACCESS_TOKEN (JWT token) environment variables. To run them: npm run integ-test.

Travis runs automatically lint and unit-test. Integration tests need to be run manually.