Skip to main content

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 variableRequiredDefaultDescription
DOCKER_REGISTRY_USERNAMENo1-Docker username
DOCKER_REGISTRY_PASSWORDNo1-Docker password
MAIN_MODULENoorchestratorCan 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_VERBOSENoFalseTurn on verbose logging
JIT_ORCHESTRATOR_HOSTNo0.0.0.0Address to listen on
JIT_ORCHESTRATOR_PORTNo8080Port (TCP) to listen on
JIT_PUBLIC_IPNo-This is passed to the JIT container, read more about it here
JIT_CAPACITYNo64Max concurrent streaming services
JIT_TURNNoFalseUse to start STUN/TURN server (port 3478)
JIT_INSTANCE_PROVIDER_CLASS_PATHNoorchestrator.providers.
single_instance_provider.
SingleInstanceProvider
Instance provider implementation to use. See instance providers (only relevant when running docker manually)
JIT_INSTANCE_READY_TIMEOUTNo120Seconds. Max wait time for instance to be ready after starting it.
JIT_SESSION_IDLE_TIMEOUTNo120Seconds. Max wait time for streaming session to be idle after killing an ongoing streaming session (restart).
JIT_SESSION_RUNNING_TIMEOUTNo120Seconds. Max wait time for streaming session to be running after starting a new streaming session (restart).
JIT_INSTANCE_AGENT_STATUS_POLL_INTERVALNo5Seconds. Interval for which the status of the instance will be polled.
JIT_INSTANCE_AGENT_STATUS_POLL_MAX_IDLE_TIMENo600Seconds. Max amount of time an instance can be idle before it is killed.
JIT_INSTANCE_AGENT_STATUS_POLL_MAX_UP_TIMENo14400Seconds. Max amount of time an instance can be running before it is killed.
1. The variable is required if Docker images have not already been pulled.

These options are only used when running the image as an instance agent

Environment variableRequiredDefaultDescription
JIT_INSTANCE_AGENT_HOSTNo0.0.0.0Adress for agent to listen on
JIT_INSTANCE_AGENT_PORTNo8081Port (TCP) for agent to listen on
JIT_IMAGENocodemill-docker.jfrog.io//accurate-player/accurate-player-jit/jit:latestImage to use when starting streaming nodes
JIT_CONTAINER_PORT_MINNo49152Min port (UDP) used when starting a WebRTC streaming session
JIT_CONTAINER_PORT_MAXNo65535Max 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 providerDefaultDescription
orchestrator.providers.single_instance_provider.
SingleInstanceProvider
YesProvides instances through docker on the same machine as the Orchestrator
orchestrator.providers.aws_instance_provider.
AWSInstanceProvider
NoProvides 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 variableRequiredDefaultDescription
JIT_INSTANCE_AGENT_IMAGENocodemill-docker.jfrog.io/accurate-player/accurate-player-jit/jit-orchestrator:latestThe docker image to use when spawning new instance agents
JIT_INSTANCE_AGENT_PORT_MINNo8081The min port to use for local instance agents
JIT_INSTANCE_AGENT_PORT_MAXNo8090The 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 variableRequiredDefaultDescription
JIT_AWS_AMI_IDYes-The ID of the AMI that will be launched
AWS_REGIONNoThe same region as the orchestrator is running inThe AWS region that will be used for the JIT instances
JIT_AWS_INSTANCE_TYPENoc5n.xlargeThe instance type used for JIT streaming instances
JIT_AWS_AGENT_INSTANCE_PROFILE_NAMENo1-IAM profile that will be used for the spawned agents
JIT_AWS_KEY_PAIR_NAMENoJIT-Key-PairThe name of the SSH key-pair that will be used for the JIT instances
JIT_AWS_SECURITY_GROUP_IDYes-The security group ID that will be used for the JIT instances
JIT_AWS_SUBNET_IDNo-The subnet id that will be used for the JIT instances
JIT_AWS_MANAGED_TAG_KEYNoManaging-JIT-Orchestrator-IDName of the tag that will be applied to JIT instances. Used to identify which orchestrator that started an instance
JIT_AWS_MANAGED_TAG_VALUENoA UUID generated at start upValue of the tag that will be applied to JIT instances. Used to identify which orchestrator that started an instance
JIT_AWS_RESOURCES_TAGSNo-Additional tag that will be applied to created AWS resources. A comma separated list in the format K1=V1,K2=V2
1. This is usually required. If a profile name is not provided, the credentials need to be provided by other means, usually by AWS environment variables

Docker

The service is started using docker.

Docker image
codemill-docker.jfrog.io/accurate-player/accurate-player-jit/jit-orchestrator:latest

CLI arguments

Run this command to display all command line options
docker run codemill-docker.jfrog.io/accurate-player/accurate-player-jit/jit-orchestrator:latest orchestrator --help
Help output
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 variableRequiredDefaultDescription
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).

Docker image
codemill-docker.jfrog.io/accurate-player/accurate-player-jit/jit:latest

CLI arguments

Run this command to display all command line options
docker run codemill-docker.jfrog.io/accurate-player/accurate-player-jit/jit:latest --help
Help output
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).