2
0
Fork 0
Beep backend stitching and tracking. Keeps all backends in version sync
 
 
Go to file
Daniel Lim 3aa41b6361
continuous-integration/drone/push Build is passing Details
Integrated backend-transcription into revised bite pipeline
2019-06-28 23:59:26 +08:00
backend-auth@78cd136987 Use RSA to sign tokens 2019-06-23 07:50:37 +08:00
backend-bite@f847fe3402 Fixed mistake not copying backend-protobuf/go in Dockerfile 2019-06-24 22:49:18 +08:00
backend-core@1064edce60 backend-permissions main logic 2019-06-23 04:24:37 +08:00
backend-heartbeat@d5828f96f4 Added WriteHeader and delay to push last seen for backend-heartbeat eventsource 2019-06-23 09:16:00 +08:00
backend-login@217c90d0cf Use RSA to sign tokens 2019-06-23 07:50:37 +08:00
backend-permissions@156a0ed950 Updated backend-permissions README 2019-06-23 04:57:47 +08:00
backend-pictures@e64c1988cc backend-pictures. Fixes #9 2019-06-20 23:14:44 +08:00
backend-publish@42e1b651d4 Fixed mistake not copying backend-protobuf/go in Dockerfile 2019-06-24 22:49:18 +08:00
backend-signal@a5540dff22 fix: merge problems 2019-06-18 21:04:28 +08:00
backend-store@ec7026385b Fixed mistake not copying backend-protobuf/go in Dockerfile 2019-06-24 22:49:18 +08:00
backend-subscribe@40da1b00bc Fixed mistake not copying backend-protobuf/go in Dockerfile 2019-06-24 22:49:18 +08:00
backend-transcription@9e8ae9b73e Integrated backend-transcription into revised bite pipeline 2019-06-28 23:59:26 +08:00
backend-webrtc@f7d9197940 Integrated backend-transcription into revised bite pipeline 2019-06-28 23:59:26 +08:00
files backend-pictures. Fixes #9 2019-06-20 23:14:44 +08:00
.drone.yml Reduce pipeline stages 2019-04-02 12:27:20 +08:00
.gitignore backend-pictures. Fixes #9 2019-06-20 23:14:44 +08:00
.gitmodules backend-webrtc initial logic 2019-06-24 15:10:10 +08:00
README.md Add deploy step 2019-03-24 01:28:38 +08:00
docker-compose.staging.yml Move auth to http network 2019-03-25 00:49:44 +08:00
docker-compose.yml Integrated backend-transcription into revised bite pipeline 2019-06-28 23:59:26 +08:00
drone_gen.js Reduce pipeline stages 2019-04-02 12:27:20 +08:00
key Use RSA to sign tokens 2019-06-23 07:50:37 +08:00
key.pub Use RSA to sign tokens 2019-06-23 07:50:37 +08:00
package.json Send help generate 2019-03-24 00:31:41 +08:00
traefik.toml Integrated backend-transcription into revised bite pipeline 2019-06-28 23:59:26 +08:00
yarn.lock Add drone generator script 2019-03-23 23:27:04 +08:00

README.md

backend

Beep backend, consisting of several microservices behind traefik, which provides CORS, SSL and authentication services, and orchestrated with docker. The name of each microservice is derived from its folder name. For example, the name of the microservice in backend-auth is auth. As always, more information, such as API docs, can be found in the individual READMEs of each service.

Quickstart

Requires docker-compose.

git clone git@makerforce.io:beep/backend.git
git submodule update --init --recursive
docker-compose up --build

Background services

The microservices of Beep rely on a few background services, listed below. All of them are covered by the docker-compose file, but in case one wishes to run a service separately, they need to be provided. What a service needs is mentioned in its description.

Name Website
postgres [https://www.postgresql.org/]
redis [https://redis.io/]
nats [https://nats.io/]

Services

The microservices of the Beep backend can be grouped into groups which each cover one of a few different areas of functionality, described below:

Auth

auth and login handle the authentication of user requests, coupled closely with traefik.

login

URL: <base-url>:1837

login takes a phone number and client id and then does a SMS OTP verification of the phone number. Client ID can be any value, but it is highly recommended that it be a unique value, like a MAC address or UUID. If verification succeeds, a signed JWT of the user id and client id is issued. This token will be used by the client for all future attempts of authentication.

login relies on a running redis instance.

auth

auth is completely invisible to the client. When traefik processes a request with a method other than OPTIONS, it calls auth, which parses the Authorization header looking for bearer authentication. If such a header is found, the token is retrieved and its signature verified. If all this succeeds, the request is allowed through with the X-User-Claim header populated by the token's contents. Otherwise, an error is returned and traefik rejects the request.

auth does not rely on anything, but is a bit pointless without a traefik instance calling on it.

Core

URL: <base-url>/core

core handles the retrieval and updating of the information that is not updated comparatively often. For example: user, conversation or contact data. Call this service to do things related to such information. It relies on the X-User-Claim header being populated by auth, mentioned previously. If you run this service without putting it behind a traefik router calling auth, then any old person can populate that header and claim to be anyone. I hope I don't need to say why that is insecure.

core relies on a running postgres instance. Is insecure if not behind traefik calling auth.

Bite pipeline

Audio data in Beep is stored in discrete packets called "bites". The Bite pipeline takes in bites and processes them, doing things like storage and transcription to text. publish receives the bites, publishing them to nats, from which the processing services receive bite events. Output is then published again to nats, received by subscribe which pushes them as Server Sent Events.

publish

URL: <base-url>/publish

publish accepts a POST request, containing a bite, and publishes it to NATs, to be received by services such as bite or transcription.

publish relies on a running nats instance. Is insecure if not behind traefik calling auth.

subscribe

URL: <base-url>/subscribe

subscribe sits on the other end of the bite pipeline, waiting for responses returned by services along it. Each request pushed to the pipeline stores the user/client ID of the requester, and the client can subscribe to subscribe to receive the response.

subscribe relies on a running nats instance. Is insecure if not behind traefik calling auth.

store

store is a wrapper around badger. Receives data through nats, generating keys based on a label supplied with the data. Also supports retrieval of specific data based on key, and scanning a range of keys based on timestamp.

store relies on a running nats instance.

bite

URL: <base-url>/bite

bite stores raw audio data via store. Basically just acts as a forwarder to store, adding labels to the data and accepting HTTP requests to retrieve the data.

bite relies on a running nats instance. Is insecure if not behind traefik calling auth.

transcription

URL: <base-url>/transcription

transcription takes the raw audio data, packages it and then sends it to the Google Cloud Speech-to-Text. Sends the transcripted result to store to be stored. Handles HTTP requests to retrieve transcriptions too.

transcription relies on a running nats instance. Is insecure if not behind traefik calling auth.

Staging