Skip to content

Commit e1c5105

Browse files
authored
Merge pull request #1345 from bbc/upstream/package-manager-docs-update
chore: add docs for distributed package-manager
2 parents 315bb5e + aa3332a commit e1c5105

File tree

2 files changed

+106
-10
lines changed

2 files changed

+106
-10
lines changed

packages/documentation/docs/user-guide/installation/installing-package-manager.md

Lines changed: 103 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,14 @@ Although Package Manager can be used to copy any kind of file to/from a wide arr
1818

1919
:::caution
2020

21-
At this time, the Package Manager worker process is Windows-only. Therefore, these instructions as a whole will only work on Windows. The worker will not work on WSL2.
21+
Sofie supports only one package manager running for a Studio. Attaching more at a time will result in weird behaviour due to them fighting over reporting the statuses of packages.
22+
If you feel like you need multiple, then you likely want to run package manager in the distributed setup instead.
23+
24+
:::
25+
26+
:::caution
27+
28+
The package manager worker process is primarily tested on Windows only. It does run on Linux (without support for network shares), but has not been extensively tested.
2229

2330
:::
2431

@@ -49,10 +56,13 @@ To setup, go into Core and add this device to a Studio
4956

5057
This first run is necessary to get the Package Manager device registered with _Sofie Core_. We'll restart Package Manager later on in the [Configuration](#configuration) instructions.
5158

52-
5359
## Installation In Production
5460

55-
We provide pre-built executables for Windows (x64) systems that can be used in production environments. These can be found on the [Releases](https://github.com/nrkno/sofie-package-manager/releases) GitHub repository page for Package Manager. For a minimal installation, you'll need the `package-manager-single-app.exe` and `worker.exe`. Put them in a folder of your choice. You can also place `ffmpeg.exe` and `ffprobe.exe` alongside them, if you don't want to make them available in `PATH`.
61+
Only one package manager can be running for a Sofie Studio. If you reached this point thinking of deploying multiple, you will want to follow the distributed setup.
62+
63+
### Simple Setup
64+
65+
For setups where you only need to interact with CasparCG on one machine, we provide pre-built executables for Windows (x64) systems. These can be found on the [Releases](https://github.com/nrkno/sofie-package-manager/releases) GitHub repository page for Package Manager. For a minimal installation, you'll need the `package-manager-single-app.exe` and `worker.exe`. Put them in a folder of your choice. You can also place `ffmpeg.exe` and `ffprobe.exe` alongside them, if you don't want to make them available in `PATH`.
5666

5767
```bash
5868
package-manager-single-app.exe --coreHost=<Core Host Name> --corePort=<Core HTTP(S) port> --deviceId=<Peripheral Device Id> --deviceToken=<Peripheral Device Token/Password>
@@ -62,22 +72,108 @@ Package Manager can be launched from [CasparCG Launcher](./installing-connection
6272

6373
You can see a list of available options by running `package-manager-single-app.exe --help`.
6474

75+
In some cases, you will need to run the HTTP proxy server component elsewhere so that it can be accessed from your Sofie UI machines.
76+
For this, you can run the `sofietv/package-manager-http-server` docker image, which exposes its service on port 8080 and expects `/data/http-server` to be persistent storage.
77+
When configuring the http proxy server in Sofie, you may need to follow extra configuration steps for this to work as expected.
78+
79+
### Distributed Setup
80+
81+
For setups where you need to interact with multiple CasparCG machines, or want a more resilient/scalable setup, package manager can be partially deployed in Docker, with just the workers running on each CasparCG machine.
82+
83+
An example `docker-compose` of the setup is as follows:
84+
85+
```
86+
services:
87+
http-server:
88+
build:
89+
context: .
90+
dockerfile: sofietv/package-manager-http-server
91+
environment:
92+
HTTP_SERVER_BASE_PATH: '/data/http-server'
93+
ports:
94+
- '8080:8080'
95+
volumes:
96+
- http-server-data:/data/http-server
97+
98+
workforce:
99+
build:
100+
context: .
101+
dockerfile: sofietv/package-manager-workforce
102+
ports:
103+
- '8070:8070' # this needs to be exposed so that the workers can connect back to it
104+
105+
package-manager:
106+
depends_on:
107+
- http-server
108+
- workforce
109+
build:
110+
context: .
111+
dockerfile: sofietv/package-manager-package-manager
112+
environment:
113+
CORE_HOST: '172.18.0.1' # the address for connecting back to sofie core from this image
114+
CORE_PORT: '3000'
115+
DEVICE_ID: 'my-package-manager-id'
116+
DEVICE_TOKEN: 'some-secret'
117+
WORKFORCE_URL: 'ws://workforce:8070' # referencing the workforce component above
118+
PACKAGE_MANAGER_PORT: '8060'
119+
PACKAGE_MANAGER_URL: 'ws://insert-service-ip-here:8060' # the workers connect back to this address, so it needs to be accessible from CasparCG
120+
# CONCURRENCY: 10 # How many expectation states can be evaluated at the same time
121+
ports:
122+
- '8060:8060'
123+
124+
networks:
125+
default:
126+
volumes:
127+
http-server-data:
128+
```
129+
130+
In addition to this, you will need to run the appContainer and workers on each windows machine that package-manager needs access to:
131+
132+
```
133+
./appContainer-node.exe
134+
--appContainerId=caspar01 // This is a unique id for this instance of the appContainer
135+
--workforceURL=ws://workforce-service-ip:8070
136+
--resourceId=caspar01 // This should also be set in the 'resource id' field of the `casparcgLocalFolder1` accessor. This is how package manager can identify which machine is which.
137+
--networkIds=pm-net // This is not necessary, but can be useful for more complex setups
138+
```
139+
140+
You can get the windows executables from [Releases](https://github.com/nrkno/sofie-package-manager/releases) GitHub repository page for Package Manager. You'll need the `appContainer-node.exe` and `worker.exe`. Put them in a folder of your choice. You can also place `ffmpeg.exe` and `ffprobe.exe` alongside them, if you don't want to make them available in `PATH`.
141+
142+
Note that each appContainer needs to use a different resourceId and will need its own package containers set to use the same resourceIds if they need to access the local disk. This is how package-manager knows which workers have access to which machines.
143+
65144
## Configuration
66145

67-
1. Open the _Sofie&nbsp;Core_ Settings page ([http://localhost:3000/settings?admin=1](http://localhost:3000/settings?admin=1)), click on your Studio, and scroll down to the Attached Devices section.
68-
1. Click the plus button (`+`) and select Package Manager to add the Package Manager device to your Studio.
69-
1. On this same settings page, scroll down to the Package Manager section.
146+
1. Open the _Sofie&nbsp;Core_ Settings page ([http://localhost:3000/settings?admin=1](http://localhost:3000/settings?admin=1)), click on your Studio, and then Peripheral Devices.
147+
1. Click the plus button (`+`) in the Parent Devices section and configure the created device to be for your Package manager.
148+
1. On the sidebar under the current Studio, select to the Package Manager section.
70149
1. Click the plus button under the Package Containers heading, then click the edit icon (pencil) to the right of the newly-created package container.
71150
1. Give this package container an ID of `casparcgContainer0` and a label of `CasparCG Package Container`.
72151
1. Click on the dropdown under "Playout devices which use this package container" and select `casparcg0`.
73152
- If you don't have a `casparcg0` device, add it to the Playout Gateway under the Devices heading, then restart the Playout Gateway.
153+
- If you are using the distributed setup, you will likely want to repeat this step for each CasparCG machine. You will also want to set `Resource Id` to match the `resourceId` value provided in the appContainer command line.
74154
1. Click the plus button under "Accessors", then click the edit icon to the right of the newly-created accessor.
75155
1. Give this accessor an ID of `casparcgHttpProxy0`, a Label of `CasparCG HTTP Proxy Accessor`, an Accessor Type of `HTTP_PROXY`, and a Base URL of `http://localhost:8080/package`. Then, ensure that both the "Allow Read access" and "Allow Write access" boxes are checked. Finally, click the done button (checkmark icon) in the bottom right.
76-
1. Scroll back up a bit to the "Studio Settings" subsection (still in the Package Manager section) and select "CasparCG Package Container" for both "Package Containers to use for previews" and "Package Containers to use for thumbnails".
156+
1. Scroll back to the top of the page and select "CasparCG Package Container" for both "Package Containers to use for previews" and "Package Containers to use for thumbnails".
77157
1. Your settings should look like this once all the above steps have been completed:
78158
![Package Manager demo settings](/img/docs/Package_Manager_demo_settings.png)
79159
1. If Package Manager `start:single-app` is running, restart it. If not, start it (see the above [Installation instructions](#installation-quick-start) for the relevant command line).
80160

161+
### Separate HTTP proxy server
162+
163+
In some setups, the URL of the HTTP proxy server is different when accessing the Sofie UI and Package Manager.
164+
You can use the 'Network ID' concept in Package Manager to provide guidance on which to use when.
165+
166+
By adding `--networkIds=pm-net` (a semi colon separated list) when launching the exes on the CasparCG machine, the application will know to prefer certain accessors with matching values.
167+
168+
Then in the Sofie UI:
169+
170+
1. Return to the Package manager settings under the studio
171+
1. Expand the `casparcgContainer` container.
172+
1. Edit the `casparcgHttpProxy` accessor to have a `Base URL` that is accessible from the casparcg machines.
173+
1. Set the `Network ID` to `pm-net` (matching what was passed in the command line)
174+
1. Click the plus button under "Accessors", then click the edit icon to the right of the newly-created accessor.
175+
1. Give this accessor an ID of `casparcgHttpProxyThumbnails0`, a Label of `CasparCG Thumbnail HTTP Proxy Accessor`, an Accessor Type of `HTTP_PROXY`, and a Base URL that is accessible to your Sofie client network. Then, ensure that only the "Allow Write access" box is checked. Finally, click the done button (checkmark icon) in the bottom right.
176+
81177
## Usage
82178

83179
In this basic configuration, Package Manager won't be copying any packages into your CasparCG&nbsp;Server media folder. Instead, it will simply check that the files in the rundown are present in your CasparCG&nbsp;Server media folder, and you'll have to manually place those files in the correct directory. However, thumbnail and preview generation will still function, as will status reporting.

packages/shared-lib/src/pubsub/peripheralDevice.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,16 @@ export interface PeripheralDevicePubSubTypes {
103103
/** Custom publications for package-manager */
104104
[PeripheralDevicePubSub.packageManagerPlayoutContext]: (
105105
deviceId: PeripheralDeviceId,
106-
token: string | undefined
106+
token?: string
107107
) => PeripheralDevicePubSubCollectionsNames.packageManagerPlayoutContext
108108
[PeripheralDevicePubSub.packageManagerPackageContainers]: (
109109
deviceId: PeripheralDeviceId,
110-
token: string | undefined
110+
token?: string
111111
) => PeripheralDevicePubSubCollectionsNames.packageManagerPackageContainers
112112
[PeripheralDevicePubSub.packageManagerExpectedPackages]: (
113113
deviceId: PeripheralDeviceId,
114114
filterPlayoutDeviceIds: PeripheralDeviceId[] | undefined,
115-
token: string | undefined
115+
token?: string
116116
) => PeripheralDevicePubSubCollectionsNames.packageManagerExpectedPackages
117117
}
118118

0 commit comments

Comments
 (0)