Services
This page describes the different services that make up the JIT backend
Orchestrator
The REST API for the backend. This is the service that the JIT client (frontend) is communicating with to start a new JIT session.
This program can also run in agent mode. This is used when you run the JIT over multiple instances. Running the program in agent mode is useful if you implement your own instance provider. You'll need to start the agent on each instance for the main orchestrator to be able to communicate with it.
Configuration
General
These variables are common for all instance providers.
| Environment variable | Required | Default | Description |
|---|---|---|---|
DOCKER_REGISTRY_USERNAME | No1 | - | Docker username |
DOCKER_REGISTRY_PASSWORD | No1 | - | Docker password |
MAIN_MODULE | No | orchestrator | Can be set to agent to run the program in "agent" mode or to orchestrator to run it as the main orchestrator (only relevant when running docker manually) |
JIT_VERBOSE | No | False | Turn on verbose logging |
JIT_ORCHESTRATOR_HOST | No | 0.0.0.0 | Address to listen on |
JIT_ORCHESTRATOR_PORT | No | 8080 | Port (TCP) to listen on |
JIT_PUBLIC_IP | No | - | This is passed to the JIT container, read more about it here |
JIT_CAPACITY | No | 64 | Max concurrent streaming services |
JIT_TURN | No | False | Use to start STUN/TURN server (port 3478) |
JIT_INSTANCE_PROVIDER_CLASS_PATH | No | orchestrator.providers.single_instance_provider.SingleInstanceProvider | Instance provider implementation to use. See instance providers (only relevant when running docker manually) |
JIT_INSTANCE_READY_TIMEOUT | No | 120 | Seconds. Max wait time for instance to be ready after starting it. |
JIT_SESSION_IDLE_TIMEOUT | No | 120 | Seconds. Max wait time for streaming session to be idle after killing an ongoing streaming session (restart). |
JIT_SESSION_RUNNING_TIMEOUT | No | 120 | Seconds. Max wait time for streaming session to be running after starting a new streaming session (restart). |
JIT_INSTANCE_AGENT_STATUS_POLL_INTERVAL | No | 5 | Seconds. Interval for which the status of the instance will be polled. |
JIT_INSTANCE_AGENT_STATUS_POLL_MAX_IDLE_TIME | No | 600 | Seconds. Max amount of time an instance can be idle before it is killed. |
JIT_INSTANCE_AGENT_STATUS_POLL_MAX_UP_TIME | No | 14400 | Seconds. Max amount of time an instance can be running before it is killed. |
These options are only used when running the image as an instance agent
| Environment variable | Required | Default | Description |
|---|---|---|---|
JIT_INSTANCE_AGENT_HOST | No | 0.0.0.0 | Adress for agent to listen on |
JIT_INSTANCE_AGENT_PORT | No | 8081 | Port (TCP) for agent to listen on |
JIT_IMAGE | No | codemill-docker.jfrog.io//accurate-player/accurate-player-jit/jit:latest | Image to use when starting streaming nodes |
JIT_CONTAINER_PORT_MIN | No | 49152 | Min port (UDP) used when starting a WebRTC streaming session |
JIT_CONTAINER_PORT_MAX | No | 65535 | Max port (UDP)used when starting a WebRTC streaming session |
Instance providers
The instance provider determines the way new instances are provided to the Orchestrator. They implement how instances are started and stopped, for example.
| Instance provider | Default | Description |
|---|---|---|
orchestrator.providers.single_instance_provider.SingleInstanceProvider | Yes | Provides instances through docker on the same machine as the Orchestrator |
orchestrator.providers.aws_instance_provider.AWSInstanceProvider | No | Provides instances on AWS EC2 |
If you are interested in running JIT in another environment, please reach out.
SingleInstanceProvider
This provider spawns new instances by starting the same Orchestrator image but configured to run in agent mode. This agent container runs on the same host machine as the main Orchestrator. The Orchestrator then communicates with this agent to control and manage the new instance.
The following environment variables only apply to the SingleInstaceProvider, these are set in the environment for the Orchestrator.
| Environment variable | Required | Default | Description |
|---|---|---|---|
JIT_INSTANCE_AGENT_IMAGE | No | codemill-docker.jfrog.io/accurate-player/accurate-player-jit/jit-orchestrator:latest | The docker image to use when spawning new instance agents |
JIT_INSTANCE_AGENT_PORT_MIN | No | 8081 | The min port to use for local instance agents |
JIT_INSTANCE_AGENT_PORT_MAX | No | 8090 | The max port to use for local instance agents |
AWSInstanceProvider
This provider spawns new instances in AWS EC2. Each JIT stream will run in a separate instance which allows for scaling.
The following environment variables only apply to the AWSInstanceProvider, these are set in the environment for the Orchestrator.
| Environment variable | Required | Default | Description |
|---|---|---|---|
JIT_AWS_AMI_ID | Yes | - | The ID of the AMI that will be launched |
AWS_REGION | No | The same region as the orchestrator is running in | The AWS region that will be used for the JIT instances |
JIT_AWS_INSTANCE_TYPE | No | c5n.xlarge | The instance type used for JIT streaming instances |
JIT_AWS_AGENT_INSTANCE_PROFILE_NAME | No1 | - | IAM profile that will be used for the spawned agents |
JIT_AWS_KEY_PAIR_NAME | No | JIT-Key-Pair | The name of the SSH key-pair that will be used for the JIT instances |
JIT_AWS_SECURITY_GROUP_ID | Yes | - | The security group ID that will be used for the JIT instances |
JIT_AWS_SUBNET_ID | No | - | The subnet id that will be used for the JIT instances |
JIT_AWS_MANAGED_TAG_KEY | No | Managing-JIT-Orchestrator-ID | Name of the tag that will be applied to JIT instances. Used to identify which orchestrator that started an instance |
JIT_AWS_MANAGED_TAG_VALUE | No | A UUID generated at start up | Value of the tag that will be applied to JIT instances. Used to identify which orchestrator that started an instance |
JIT_AWS_RESOURCES_TAGS | No | - | Additional tag that will be applied to created AWS resources. A comma separated list in the format K1=V1,K2=V2 |
Docker
The service is started using docker.
codemill-docker.jfrog.io/accurate-player/accurate-player-jit/jit-orchestrator:latest
CLI arguments
docker run codemill-docker.jfrog.io/accurate-player/accurate-player-jit/jit-orchestrator:latest orchestrator --help
JIT Orchestrator
options:
-h, --help show this help message and exit
--public-ip PUBLIC_IP
Used when building the jitUrl in /session response. If omitted, env PUBLIC_IP is used. If not set, the default None is used.
--host HOST Host for HTTP server. Default: 0.0.0.0
--port PORT Port for HTTP server. Default: 8080
--container-port-min CONTAINER_PORT_MIN
Container port range min. Default: 49152
--container-port-max CONTAINER_PORT_MAX
Container port range max. Default: 65535
--capacity CAPACITY Max concurrent streaming services. Default: 64
--turn, -t Starts a TURN server on ports 3478 and 5349
--image IMAGE, -i IMAGE
Remote Docker image (default: codemill-docker.jfrog.io/accurate-player/accurate-player-jit/jit:latest)
--prune, -p Prune non-running containers with label jit
--remove-running Remove running containers with label jit
--keep-containers Don't remove stopped containers (Docker: remove=False)
--verbose, -v Verbose logging
--dev Shortcut for: --verbose --remove-running --prune --turn --image jit-orchestrator--host 0.0.0.0 --port 8080, specific parameters may
be overridden
--instance-provider-path INSTANCE_PROVIDER_PATH
Path to the instance provider implementation
--instance-agent-status-poll-interval INSTANCE_AGENT_STATUS_POLL_INTERVAL
Interval for which the status of the agents will be polled
--instance-agent-status-poll-max-idle-time INSTANCE_AGENT_STATUS_POLL_MAX_IDLE_TIME
Max amount of time an agent can be idle before it is killed
--instance-agent-status-poll-max-up-time INSTANCE_AGENT_STATUS_POLL_MAX_UP_TIME
Max amount of time an agent can be running before it is killed
JIT
This service is responsible for the actual JIT stream. It transcodes, just in time, to a web friendly format and streams it through WebRTC.
Configuration
| Environment variable | Required | Default | Description |
|---|---|---|---|
PUBLIC_IP | No | - | The public (internet facing) url of the instance running this program. This needs to be set if the JIT client and server run on the same LAN to allow the WebRTC handshake to succeed. |
Docker
This image runs the main JIT streaming program. It's recommended that you do not use this directly. Instead, use the Orchestrator. It starts this program for each streaming session (see the JIT_IMAGE option).
codemill-docker.jfrog.io/accurate-player/accurate-player-jit/jit:latest
CLI arguments
docker run codemill-docker.jfrog.io/accurate-player/accurate-player-jit/jit:latest --help
JIT WebRTC
positional arguments:
URLS Deprecated, use -i,--input instead. Specify input
files. The first is the video file; others are audio.
options:
-h, --help show this help message and exit
-i URL [channel_count=...] [id=...] [URL [channel_count=...] [id=...] ...], --input URL [channel_count=...] [id=...] [URL [channel_count=...] [id=...] ...]
Specify input files with optional channel count and
id. The first is the video file; others are audio.
--lowres LOWRES lowres scaling factor
--sample-aspect-num SAMPLE_ASPECT_NUM
SAR numerator
--sample-aspect-den SAMPLE_ASPECT_DEN
SAR denominator
--colorspace COLORSPACE
Colorspace
--host HOST Host for HTTP server (default: 0.0.0.0)
--port PORT Port for HTTP server (default: 8080)
--verbose, -v
--channels CHANNELS Expected number of channels
--cho CHO Initial channel offset
--threads THREADS Number of threads to request
--thread-type THREAD_TYPE
Thread type
--bt2100-tone-mapping
Deal with BT.2100 by inserting rudimentary tonemapping
--width WIDTH Resolution width
--height HEIGHT Resolution height
--frame-rate-num FRAME_RATE_NUM
FPS numerator
--frame-rate-den FRAME_RATE_DEN
FPS denominator
--region REGION AWS S3 region
--bitrate BITRATE Bitrate in bits/s. Used for setting kaffekopp defaults
for S3 URLs. Give maximum peak bitrate of all files
--technical-timeout TECHNICAL_TIMEOUT
Extend JIT technical timeout for debugging purpose
--duration DURATION Duration in frames (exclusive).