Streaming API
The APIs supporting Ownzones Discover platform.
Essentially it serves two purposes:
- Admin - API for managing VOD content for Connect admin web app.
- Consumer - API for accessing VOD content for consumer apps.
The code is on GitHub (team-platform), tasks are tracked in Jira, discussion on Slack (#team-discover-ro and #team-platform-ro channels), and Grumpy tracks issues in progress and owners of test namespaces.
Deployment is done via kube-customer, we do CI with CircleCI, and servers are monitored using Papertrail, Sentry and Honeycomb.
Getting Started
-
Prerequisites:
node@10.15 elasticsearch@5.6 postgresql@9.5 redis
-
Clone the repository, install dependencies:
git clone https://github.com/OwnZones/streaming-api cd streaming-api yarn install --frozen-lockfile
-
Create a
config/local.ts
file:export const config = { db: { username: '<your postgres username>', password: '<your postgres password>', database: '<your postgres database>', manageDatabase: true, // set `true` to generate initial db structure }, cache: { enabled: true, }, ses: { enabled: true, }, swf: { decidersTaskListSuffix: 'streaming-api-decider-suffix', }, mediaconvert: { // some tests and features will fail if this is not setup accountId: '', // ask team members for credentials iamRole: '', queueArn: '', region: '', accessKeyId: '', // ask @DevOps for credentials secretAccessKey: '', }, search: { forceRefresh: true, // this is set only for tests }, web: { admin: { mockAuthenticationEnabled: true, // override IAM authentication }, }, };
-
Start the project locally:
NODE_ENV=local yarn run serve
-
Recreate the database structure:
NODE_ENV=local bin/ts-node.sh dbInit.ts # `manageDatabase: true` in config
Test suite
Please write tests for new code. Your PR will probably be rejected otherwise.
Tests run automatically on every git push
in CircleCI and a Docker image
is created and uploaded.
To run tests locally, you need the config file set up, then run:
NODE_ENV=local yarn test
To run a single test or suite, either run them directly from WebStorm, or run:
yarn install -g jest
NODE_ENV=local jest --runTestsByPath <path-to-test-suite> --verbose
Related projects
The Admin API lives behind graphql-gateway, which merges the schema with the schema from zypline-api (which handles admin actions for the Connect product) and iam-service (which handles user authentication). The Admin API is consumed by zypline-web.
The consumer Streaming API is used by the consumer applications:
- Magnolia: magnolia-web, magnolia-ios, magnolia-android
- 420TV: 420tv-web, 420tv-ios, 420tv-android
Environments
streaming-api
is deployed as part of the OwnZones platform on several test
and production environments. All production and testing servers are deployed in
Kubernetes clusters. See documentation in kube-customer for details.
Scripts to help with accessing the servers are in the streaming-api-scripts
repo.
devN
- Clusters:
temp.dev.ownzones.com (dev3 - dev7)
-
crash.dev.ownzones.com (dev8 - dev10)
.
- Zypline Web url - https://devN.CLUSTER_NAME.dev.ownzones.com
- Streaming API admin url (accessed via
graphql-gateway
): https://graphql-gateway.devN.CLUSTER_NAME.dev.ownzones.com/graphql - Streaming API consumer url: https://streaming-api.devN.CLUSTER_NAME.dev.ownzones.com/consumer/graphQl
- Credentials - default admin user:
- username:
system.admin@onzones.com
- password:
Parola123$
- username:
staging
- Clusters:
-
crash.dev.ownzones.com
.
-
- Zypline Web url - https://staging.dev.ownzones.com
- Streaming API admin url (accessed via
graphql-gateway
): https://graphql-gateway.staging.dev.ownzones.com/graphql - Streaming API consumer url: https://streaming-api.staging.dev.ownzones.com/consumer/graphQl
- Credentials: ask team members
demo
- Clusters:
live.ownzones.com
- Zypline Web url - https://demo.ownzones.com
- Streaming API admin url (accessed via
graphql-gateway
): https://graphql-gateway.demo.ownzones.com/graphql - Streaming API consumer url: https://streaming-api.demo.ownzones.com/consumer/graphQl
- Credentials: ask team members
connect (aka production)
- Clusters:
live.ownzones.com
- Zypline Web url - https://connect.ownzones.com
- Streaming API admin url (accessed via
graphql-gateway
): https://graphql-gateway.connect.ownzones.com/graphql - Streaming API consumer url: https://streaming-api.connect.ownzones.com/consumer/graphQl
- Credentials: ask team members