/sofie-package-manager

Package Manager for Sofie: The Modern TV News Studio Automation System

Primary LanguageTypeScriptMIT LicenseMIT

Sofie: The Modern TV News Studio Automation System (Package Manager)

This is the "Package Manager" application of the Sofie TV News Studio Automation System.

Note: This is a mono-repo.

Introduction and Quick Start

See the Installing Package Manager page of the Sofie System Documentation to learn how to get started with Package Manager in a demo environment with CasparCG.

File structure

This is a mono-repo, all packages resides in shared/packages and apps/.

The packages in shared/packages are helper libraries, used by the packages in apps/.

The packages in apps/ can be run as individual applications.

The packages in tests/ contain unit/integration tests.

Applications

Name Location Description
Workforce apps/workforce/app Mediates connections between the Workers and the Package Managers. (Later: Will handle spin-up/down of workers according to the current need.)
Package Manager apps/package-manager/app The Package Manager receives expectedPackages from a Sofie Core, converts them into Expectations. Keeps track of work statues and distributes the work to the Workers.
Worker apps/worker/app Executes work orders from the Package Manager
AppContainer-node apps/appcontainer-node/app Spins up/down workers according to the current need. (This appContainer uses child processes, future ones could work with for example Kubernetes or AWS)
HTTP-server apps/http-server/app A simple HTTP server, where files can be uploaded to and served from. (Often used for thumbnails & previews)
Single-app apps/single-app/app Runs one of each of the above in a single application.

Packages (Libraries)

Name Location Description
API shared/packages/api Various interfaces used by the other libraries
ExpectationManager shared/packages/expectationManager The ExpectationManager class is used by the Package Manager application
Worker shared/packages/worker The Worker class is used by the Worker application
Workforce shared/packages/Workforce The Workforce class is used by the Worker application

Notes on installation

It has been observed a potential issue when running Package Manager as an executable on Windows: For unknown reasons, there is a buildup of "zombie" TCP sockets over time. It is unknown if this is caused by something in Package Manager or ffmpeg/ffprobe. As a remedy/hack, this script has been useful to avoid potential longterm issues.

For Developers

Be sure to read the FOR DEVELOPERS documentation.

Note: This mono-repo uses Yarn and Lerna, so most commands can be run on the root folder (no need to cd into each package).

Initialize repo:

# install lerna globally
yarn global add lerna

# set up mono-repo
yarn setup

# Install all dependencies
yarn

# Build all packages
yarn build

Now you should be good to go.

Whenever you do a change, run yarn build (or yarn build:changed to only build the changed ones) to compile.

Before any code is committed, run these:

# Lint all packages
yarn lint

# Run all tests
yarn test

Other useful commands:

# Start the single-app (contains all apps)
yarn start:single-app

# Start the single-app in local-only mode, using packages from expectedPackages.json
yarn start:single-app -- -- --watchFiles=true --noCore=true



# (Windows only) Compile all apps into executables, and put into the deploy/ folder.
yarn do:build-win32

# To run a command for a single package, use the --scope option
yarn build --scope @sofie-package-manager/api

# CLI arguments can be passed like so: (note the double -- --)
yarn start:workforce -- -- --port=8080

# Documentation for the CLI agruments
yarn start:workforce -- -- --help