Create a new AWS IAM user.
It needs the following permissions:
AmazonS3FullAccess
AmazonDynamoDBFullAccess
AmazonPollyFullAccess
Remember the Access Key Id and the Secret.
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/*"
}
]
}
You need the following environment variables:
PORT
: Defaults to 3000 if not set.AWS_ACCESS_KEY_ID
: AWS Credentials (see AWS IAM)AWS_SECRET_ACCESS_KEY
: AWS CredentialsAWS_REGION
: AWS Region (us-east-1)DYNAMODB_USE_LOCAL
: falseJWT_SECRET
: secret used for JWTPOCKET_KEY
: Pocket Consumer Key. See Pocket Developer AppsPOLLY_S3_BUCKET
: S3 Bucket for streaming filesPOLLY_VOICE
: Optional. Reading voice. See available voices. Defaults to Salli.META_VOICE
: Optional. Voice for intro/outro. Defaults to Joey.PROSODY_RATE
: Optional. Voice speed (x-slow, slow, medium, fast, x-fast). See documentation. Defaults to medium.PROSODY_VOLUME
: Optional. Voice volume (silent, x-soft, soft, medium, loud, x-loud). See documentation. Defaults to medium.SM_API_KEY
: Partner API key for SMMRY service.LOG_LEVEL
: Optional. Winston logging level. Defaults to info.GA_PROPERTY_ID
: Google Analytics ID. Can be an empty string.Node version 9.11.1 is helpful for running locally due to natural libraries dependencies.
This can also be run on Heroku. Here are the instructions for running with Heroku:
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.