speech-service
v2.0.0
Published
WW Speech Service for Alexa & Assistant
Downloads
8
Readme
|Master|Develop|Code Climate|Test Coverage| |-----|-------|--------|---------| |||||
Speech Service
Alexa and Google Assistant speech processing service.
Setup
This project depends on node 8.12.0
- Create a
.npmrc
file and add your secret NPM registry key as so://registry.npmjs.org/:_authToken=<your-token-here>
- Run
npm i
- Add a
.env
file to the root of your directory. You will need:DIALOGFLOW_KEY=""
Project Structure
We use a MVVM architecture, however instead of ViewModels, we use SpeechModels. Be sure to package your classes by Domain -- see the /domain
folder for examples.
All classes belong in the /model
folder, and all services belong in the /services
folder.
The /test
folder contains unit tests and mock data used for testing.
Environments
We host 2 skills based on environment: WW (PROD | Master) & WW Alpha (QAT2 | Develop).
Alexa
Quick start guide for Alexa: https://developer.amazon.com/docs/devconsole/about-the-developer-console.html
See Alexa SDK documentation for node.js: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs
WW (PROD):
https://developer.amazon.com/alexa/console/ask/build/amzn1.ask.skill.759c1075-911b-41c1-a160-2116d3737e64/development/en_US
WW Alpha (QAT2):
https://developer.amazon.com/alexa/console/ask/build/custom/amzn1.ask.skill.16a8e5ef-78fb-4f90-b62c-860b53468f8b/development/en_US/dashboard
Google Assistant
Quick start guide for DialogFlow: https://dialogflow.com/docs/getting-started
See Google's DialogFlow SDK for node JS: https://github.com/dialogflow/dialogflow-nodejs-client-v2
WW (PROD):
https://console.dialogflow.com/api-client/#/agent/a8d809bb-7bf7-4b17-b480-78cdf7d0781a/intents
WW Alpha (QAT2):
https://console.dialogflow.com/api-client/#/agent/35e11392-4702-4af5-85a4-a9ea4260c3d0/intents
Deployments
Deployments are managed via WW's trigger system using docker containers.
Process
Travis CI will test and build all commits into Develop and Master. Develop branches are designated to be deployed into QAT2, while Master are designated for PROD. At the end of every sprint, Develop is cut into Master. Upon sign off, Trigger is used to deploy PROD.
Both QAT2 and PROD environments use API url routing via Ingress. Upon every release, we alternate deployments to either v1
or v2
. Each version
points to a different docker container.
Alexa & Assistant Consoles
Both Alexa & Google Actions need to be submitted for approval in order to release new intents. Upon submission, the fulfillment endpoint is locked in place, which is why we must support multiple docker versions at the same time.
Trigger
Once your docker container has been pushed:
- Deploy your keys (config.env.json) to IDB
trigger-oidc-curl -s -XPOST [email protected] https://idb.wwiops.io/v1/configs
- Deploy trigger script:
trigger-oidc-curl -k -XPOST -d”@trigger.qat2.json" https://trigger.wwiops.io/betav1/speechnonprod/speech-service/qat2/us-east-1.aws
- To check the status of a deployment:
triggerctl status —product speech-service --environment qat2 --group speechnonprod
Running locally, Tests & Lint
Docker
Running locally:
- Start your server by
npm start
Tests
To run all tests:
npm test
To run coverage (istanbul/nyc) test with report (results will be in coverage/nyc folder):
npm run coverage
To generate test results report with mochawesome (results will be in coverage/mochawesome folder):
npm run report
To run lint checks:
npm run lint