Publishing Streaming Applications using the Public Streaming API#

Publishing custom Omniverse applications to the NVIDIA Container Registry for streaming from the public streaming API can be accomplished using the following process, highlighting the steps required to make an Omniverse application available online with the WebRTC streaming extension enabled in order to make streaming workflows accessible from User’s web browsers.

Once published to NGC, Omniverse application streams can be launched using the public streaming API according to the guide documenting the procedure.

publish_docker_image.sh#
 1#!/usr/bin/env bash
 2set -e
 3set -u
 4
 5# Log in to NGC using your API key (https://ngc.nvidia.com/setup/api-key):
 6docker login --username="$oauthtoken" --password="<NGC_API_KEY>" nvcr.io
 7
 8NGC_ENVIRONMENT="nvcr.io"
 9NGC_ORG="<NGC_ORGANIZATION>" # Replace with your NGC organization's name.
10NGC_TEAM="<NGC_TEAM>"        # Replace with your NGC team's name.
11
12TAG="2023.1.0"
13BASEDIR="omniverse-application-webrtc-streaming-example"
14CONTAINER_LABEL="${BASEDIR}:${TAG}"
15NGC_CONTAINER_NAME="${NGC_ENVIRONMENT}/${NGC_ORG}/${NGC_TEAM}/${BASEDIR}:${TAG}"
16
17# Build container and tag its version before publishing it to the NGC container registry:
18DOCKER_BUILDKIT=1 docker build --pull -t "${CONTAINER_LABEL}" "${BASEDIR}" --build-arg CREATE_CONTAINER_TAG="${TAG}"
19echo "Pushing to NGC '${NGC_CONTAINER_NAME}'..."
20docker push "${NGC_CONTAINER_NAME}"
nvidia-icd.json#
1{
2   "file_format_version" : "1.0.0",
3   "ICD": {
4      "library_path": "libGLX_nvidia.so.0",
5      "api_version" : "1.2.194"
6   }
7}
startup.sh#
  1#!/usr/bin/env bash
  2set -e
  3set -u
  4
  5# Check for libGLX_nvidia.so.0 (needed for vulkan)
  6ldconfig -p | grep libGLX_nvidia.so.0 || NOTFOUND=1
  7if [[ -v NOTFOUND ]]; then
  8    cat << EOF > /dev/stderr
  9
 10Fatal Error: Cannot find libGLX_nvidia.so.0...
 11
 12Ensure running with NVIDIA runtime (`--gpus all`) or (`--runtime nvidia`).
 13
 14EOF
 15    exit 1
 16fi
 17
 18
 19# Detect NVIDIA Vulkan API version, and create ICD:
 20export VK_ICD_FILENAMES=/tmp/nvidia_icd.json
 21export LD_LIBRARY_PATH="/opt/nvidia/omniverse/kit-sdk-launcher/plugins/carb_gfx"
 22LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/plugins/gpu.foundation"
 23LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/extscore/omni.gpu_foundation/bin/deps"
 24LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/extscore/omni.assets.plugins/bin"
 25LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/extscore/omni.assets.plugins/bin/deps"
 26LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/extscore/omni.client/bin"
 27LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/extscore/omni.client/bin/deps"
 28LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/exts/omni.gpu_foundation/bin"
 29LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/exts/omni.gpu_foundation/bin/deps"
 30LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/exts/omni.gpucompute.plugins/bin"
 31LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/exts/omni.gpucompute.plugins/bin/deps"
 32LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/exts/omni.hydra.iray/bin"
 33LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/exts/omni.hydra.iray/bin/deps"
 34LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/exts/omni.hydra.rtx/bin/"
 35LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/exts/omni.hydra.rtx/bin/deps"
 36LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/exts/omni.kit.renderer.imgui/bin"
 37LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/exts/omni.kit.renderer.imgui/bin/deps"
 38LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/exts/omni.mdl.neuraylib/bin" # No /deps
 39LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/exts/omni.stats/bin"
 40LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/exts/omni.stats/bin/deps"
 41LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/exts/omni.usd.libs/bin"
 42LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/exts/omni.usd.libs/bin/deps"
 43LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/exts/omni.volume/bin"
 44LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/nvidia/omniverse/kit-sdk-launcher/exts/omni.volume/bin/deps"
 45LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${VK_ICD_FILENAMES}"
 46
 47OPEN_STAGE=$(find /opt/nvidia/omniverse/open_stage -name open_stage2.py)
 48
 49EXEC=""
 50USD_PATH="${USD_PATH:-""}"
 51if [ -z "${USD_PATH}" ]; then
 52    echo "USD_PATH not set"
 53else
 54    echo "open_stage is at ${OPEN_STAGE}"
 55    EXEC="--exec ${OPEN_STAGE}"
 56fi
 57
 58USER_ID="${USER_ID:-""}"
 59if [ -z "${USER_ID}" ]; then
 60    echo "User id is not set"
 61fi
 62
 63WORKSTREAM="${OV_WORKSTREAM:-"omni-saas-custom-example"}"
 64SHELL="${OV_SHELL:-0}"
 65if [ "${SHELL}" == "1" ]; then
 66    echo "Running in shell mode"
 67    tail -f /dev/null
 68fi
 69
 70export HSSC_SC_MEMCACHED_SERVICE_NAME="memcached-service-r3"
 71export HSSC_SC_MEMCACHED_REDISCOVER="1"
 72export HSSC_SC_CLIENT_LOGFILE_ROOT=/tmp/renders/hssc
 73mkdir -p /tmp/renders
 74
 75__GL_F32B90a0=$(find /opt/nvidia/omniverse/hssc_shader_cache_client_lib -path \*release/lib\* -name libhssc_shader_cache_client.so)
 76echo "Found hssc client so in: $__GL_F32B90a0"
 77export __GL_F32B90a0
 78export __GL_a011d7=1   # OGL_VULKAN_GFN_SHADER_CACHE_CONTROL=ON
 79export __GL_43787d32=0 # OGL_VULKAN_SHADER_CACHE_TYPE=NONE
 80export __GL_3489FB=1   # OGL_VULKAN_IGNORE_PIPELINE_CACHE=ON
 81
 82CMD="/opt/nvidia/omniverse/create-launcher/kit/kit"
 83ARGS=(
 84    "/opt/nvidia/omniverse/create-launcher/apps/omni.create.kit"
 85    "--allow-root"
 86    "--no-window"
 87    "--enable omni.kit.livestream.webrtc"
 88    "--/rtx/verifyDriverVersion/enabled=false"
 89    "--/rtx/post/aa/op=3"
 90    "--/app/livestream/allowResize=false"
 91    "--/app/window/width=1920"
 92    "--/app/window/height=1080"
 93    "--/app/window/scaleToMonitor=true"
 94    "--/realm/timeout=0"
 95    "--/app/livestream/enabled=true"
 96    "--/app/livestream/proto=ws"
 97    "--/app/livestream/logLevel=error"
 98    "--/log/file=app/out/kit.log"
 99    "--/rtx-transient/dlssg/enabled=false"
100    "--/app/runLoops/present/rateLimitEnabled=false"
101    "--/app/window/showStartup=false"
102    "--/app/livestream/webrtcEtli=true"
103    "--/plugins/carb.tasking.plugin/threadCount=16"
104    "--/crashreporter/data/workstream=${WORKSTREAM}"
105    "--/privacy/userId=${USER_ID}"
106    "--/app/extensions/fsWatcherEnabled=false"
107    "--enable omni.services.transport.server.http"
108)
109
110for arg in "${ARGS[@]}"
111do
112    CMD="$CMD $arg"
113done
114
115echo "Starting USD Composer with $CMD $@ ${EXEC}"
116
117CMD="exec $CMD $@ ${EXEC}"
118
119eval $CMD
Dockerfile#
 1# syntax=docker/dockerfile:1
 2
 3FROM nvcr.io/nvidia/omniverse/kit:104.0.0
 4
 5# Include custom application configuration files:
 6COPY ./nvidia-icd.json /tmp
 7COPY --chmod=0755 ./startup.sh /startup.sh
 8
 9# Expose ports used for native streaming:
10EXPOSE 47995-48012/udp \
11       47995-48012/tcp \
12       49000-49007/udp \
13       49000-49007/tcp \
14       8011/tcp \
15       8111/tcp \
16       49100/tcp
17
18# Switch back to non-root user:
19USER ubuntu
20
21WORKDIR /home/ubuntu/
22RUN mkdir -p /home/ubuntu/.nvidia-omniverse/config
23
24ENTRYPOINT ["/startup.sh"]