Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 67 additions & 16 deletions .github/workflows/node-server-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- node-server/**
branches:
- main
- staging
tags:
- "v*.*.*"
pull_request:
workflow_dispatch:

Expand All @@ -14,7 +17,8 @@ permissions:
contents: read

env:
node-version: 20
NODE_VERSION: 20
DOCKERHUB_ORG: 'scribear'

jobs:
test-node-server:
Expand All @@ -23,36 +27,36 @@ jobs:
- name: Set up Git repository
uses: actions/checkout@v4

- name: Set up Node.js ${{ env.node-version }}
- name: Set up Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
node-version: ${{ env.NODE_VERSION }}

- name: Install dependencies
working-directory: 'node-server'
working-directory: "node-server"
run: npm ci

- name: Run tests
working-directory: 'node-server'
working-directory: "node-server"
run: npm run ci-test

lint-node-server:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v4

- name: Set up Node.js ${{ env.node-version }}
- name: Set up Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
node-version: ${{ env.NODE_VERSION }}

- name: Install dependencies
working-directory: 'node-server'
run: npm ci
working-directory: "node-server"
run: npm ci

- name: Run linter
working-directory: 'node-server'
working-directory: "node-server"
run: npm run lint

build-node-server:
Expand All @@ -61,15 +65,62 @@ jobs:
- name: Set up Git repository
uses: actions/checkout@v4

- name: Set up Node.js ${{ env.node-version }}
- name: Set up Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
node-version: ${{ env.NODE_VERSION }}

- name: Install dependencies
working-directory: 'node-server'
working-directory: "node-server"
run: npm ci

- name: Run build
working-directory: 'node-server'
working-directory: "node-server"
run: npm run build

build-container-node-server:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKERHUB_ORG }}/node-server
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./node-server
file: ./node-server/Dockerfile
push: true
platforms: "linux/amd64,linux/arm64"
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.DOCKERHUB_ORG }}/node-server:buildcache
cache-to: type=registry,ref=${{ env.DOCKERHUB_ORG }}/node-server:buildcache,mode=max
build-args: |
BRANCH=${{ steps.meta.outputs.version }}
BUILDNUMBER=${{ github.run_number }}
ARG GITSHA1=${{ github.sha }}
108 changes: 103 additions & 5 deletions .github/workflows/whisper-service-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- whisper-service/**
branches:
- main
- staging
tags:
- "v*.*.*"
pull_request:
workflow_dispatch:

Expand All @@ -14,7 +17,8 @@ permissions:
contents: read

env:
python-version: 3.12
PYTHON_VERSION: 3.12
DOCKERHUB_ORG: 'scribear'

jobs:
test-whisper-service:
Expand All @@ -23,10 +27,10 @@ jobs:
- name: Set up Git repository
uses: actions/checkout@v4

- name: Set up Python ${{ env.python-version }}
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.python-version }}
python-version: ${{ env.PYTHON_VERSION }}

- name: Install dependencies
working-directory: "whisper-service"
Expand All @@ -42,10 +46,10 @@ jobs:
- name: Set up Git repository
uses: actions/checkout@v4

- name: Set up Python ${{ env.python-version }}
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.python-version }}
python-version: ${{ env.PYTHON_VERSION }}

- name: Install dependencies
working-directory: "whisper-service"
Expand All @@ -54,3 +58,97 @@ jobs:
- name: Run tests
working-directory: "whisper-service"
run: pylint --disable=import-error $(git ls-files '*.py')

build-cpu-container-whisper-service:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKERHUB_ORG }}/whisper-service-cpu
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./whisper-service
file: ./whisper-service/Dockerfile_CPU
push: true
platforms: "linux/amd64,linux/arm64"
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.DOCKERHUB_ORG }}/whisper-service-cpu:buildcache
cache-to: type=registry,ref=${{ env.DOCKERHUB_ORG }}/whisper-service-cpu:buildcache,mode=max
build-args: |
BRANCH=${{ steps.meta.outputs.version }}
BUILDNUMBER=${{ github.run_number }}
ARG GITSHA1=${{ github.sha }}

build-cuda-container-whisper-service:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKERHUB_ORG }}/whisper-service-cuda
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./whisper-service
file: ./whisper-service/Dockerfile_CUDA
push: true
platforms: "linux/amd64,linux/arm64"
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.DOCKERHUB_ORG }}/whisper-service-cuda:buildcache
cache-to: type=registry,ref=${{ env.DOCKERHUB_ORG }}/whisper-service-cuda:buildcache,mode=max
build-args: |
BRANCH=${{ steps.meta.outputs.version }}
BUILDNUMBER=${{ github.run_number }}
ARG GITSHA1=${{ github.sha }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
logs
logs
.env
36 changes: 30 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,41 @@

Backend for ScribeAR. Handles transcribing audio stream and rebroadcasting transcriptions to multiple devices.

## Getting Started
# Getting Started

* See `README.md` in `/node-server` and `/whisper-service` folders for detailed instructions for installation, development, and usage.
See the `README.md` files in `/node-server` and `/whisper-service` folders for detailed instructions for installation, configuration, development, and usage of node-server and whisper-service. See [Setup](#setup)

## Usage
# Setup ScribeAR Server

### All-in-one Deployment
## Docker Deployment

Deploys node-server, whisper-service, and ScribeAR frontend to be running on the same system.
1. Install Docker using official methods
* https://www.docker.com/
* If you'd like to use CUDA, make sure you have the Nvidia Container Toolkit installed as well
* https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/index.html
2. Clone this repository
```
git clone https://github.com/scribear/ScribeAR-NodeServer
```
3. Make a copy of `template.env` and name it `.env`
4. Edit `.env` to configure deployment.
* Configuration matches that of [Node Server Configuration](./node-server/README.md#configuration-options) and [Whisper Service Configuration](./whisper-service/README.md#configuration-options) with a few exceptions, noted below.
* `HOST` and `PORT` for whisper-service and node-server are disabled.
* `MODEL_KEY` is added for node-server. This is the [model key](#model-implementations-and-model-keys) that node-server will use when connecting to whisper-service.
* `WHISPER_SERVICE_ENDPOINT` for node-server is removed and instead automatically generated using `MODEL_KEY` and `API_KEY`.
5. Start containers via Docker compose
* For CPU only deployment
```
docker compose -f ./compose_cpu.yaml up -d
```
* For CUDA deployment
```
docker compose -f ./compose_cpu.yaml up -d
```

**Setup**
## Local All-in-one Deployment

Deploys node-server, whisper-service, and ScribeAR frontend to be running on the same system.

1. Install Node 20, Python 3, and Google Chrome using official methods
* https://nodejs.org/en/download
Expand Down
42 changes: 42 additions & 0 deletions compose_cpu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: 'scribear-server'
services:
node-server:
build:
context: ./node-server
dockerfile: Dockerfile
environment:
- NODE_ENV=${NODE_ENV}
- LOG_LEVEL=${LOG_LEVEL}
- HOST=0.0.0.0
- PORT=8080
- USE_HTTPS=${USE_HTTPS}
- CORS_ORIGIN=${CORS_ORIGIN}
- SERVER_ADDRESS=${SERVER_ADDRESS}
- WHISPER_SERVICE_ENDPOINT=ws://whisper-service:8000/whisper?api_key=${API_KEY}&model_key=${MODEL_KEY}
- WHISPER_RECONNECT_INTERVAL_SEC=${WHISPER_RECONNECT_INTERVAL_SEC}
- REQUIRE_AUTH=${REQUIRE_AUTH}
- SOURCE_TOKEN=${SOURCE_TOKEN}
- ACCESS_TOKEN_BYTES=${ACCESS_TOKEN_BYTES}
- ACCESS_TOKEN_REFRESH_INTERVAL_SEC=${ACCESS_TOKEN_REFRESH_INTERVAL_SEC}
- ACCESS_TOKEN_VALID_PERIOD_SEC=${ACCESS_TOKEN_VALID_PERIOD_SEC}
- SESSION_TOKEN_BYTES=${SESSION_TOKEN_BYTES}
- SESSION_LENGTH_SEC=${SESSION_LENGTH_SEC}
ports:
- ${PORT}:8080
volumes:
- ${KEY_FILEPATH:-/dev/null}:/app/cert/key.pem
- ${CERTIFICATE_FILEPATH:-/dev/null}:/app/cert/key.pem
restart: unless-stopped

whisper-service:
build:
context: ./whisper-service
dockerfile: Dockerfile_CPU
environment:
- LOG_LEVEL=${LOG_LEVEL}
- API_KEY=${API_KEY}
- HOST=0.0.0.0
- PORT=8000
expose:
- 8000
restart: unless-stopped
Loading