Cloud Containerization

From SOUND4wiki

The SOUND4 .CL processing can be containerized.

Experimental: Images with default settings and extensions are on Docker Hub

General information

To provide the audio to the container, the easier is to use RTP to send and retrieve audio.

You can use the sound4.xxx-proc program contained in the archive to create the process using the dynamic library.

For X1.CL and IMPACT.CL, you can add extensions (Kantar.CL and Stream.CL) in the container to have them available.

The libraries for Linux have very little dependencies :

  • kernel >= 5.4
  • GlibC >= 2.31

So, using Debian>=11 or Ubuntu>=20.04 will work.

(Versions before May 2042 need only Kernel 3.13 and glibc 2.19, so Debian 8 and Ubuntu 14.04)

If you need, you can separate the process and the user interface server, but this is not required

Special care

The distribution should have recent ca-certificates to be able to access HTTPS on the Internet, for licenses or metadata pulling.

The configuration storage should be in a volume to keep presets and configuration upon upgrades.

You need to pass license information when starting the container. This can be done with environment variables or process parameters.

You can check all available options by running the sound4.xxx-proc with -h to get help. You can also have a look on .CL_Command-line_tools.

Example for X1.CL

Files used in image should be extracted from the matching process library archives.

Files

You need to get the processing libraries, and optionally the plugins' library, and extract them in the same folder as the Dockerfile, so Docker can use them.

All files are available from http://download.sound4.biz.

Dockerfile

FROM debian:bookworm-slim
# install ca-certificates to access HTTPS for licenses
RUN apt update \
    && apt install -yq --no-install-recommends \
		ca-certificates \
    && rm -rf /var/lib/apt/lists/*
RUN mkdir -p /usr/share/sound4proc
WORKDIR /
# copy processing library
COPY lib/libsound4.x1.cloud.so /usr/local/lib
# copy processing helper executable
COPY bin/sound4.x1.cloud-proc /usr/local/bin

# OPTIONAL: Kantar.CL
COPY lib/libsound4.kantar.so /usr/local/lib
COPY lib/libsnapliveaudioembedder.so /usr/local/lib

# OPTIONAL: Stream.CL
COPY lib/libsound4.stream.so /usr/local/lib
# OPTIONAL: Stream.CL scripts in share/sound4/SOUND4\ Stream.CL\ Metaparsers/
COPY share/ /usr/local/share/

# force libs locate
RUN ldconfig
# rtp needs a logname
ENV LOGNAME=sound4
CMD /usr/local/bin/sound4.x1.cloud-proc

Docker-compose File

version: '3.4'
services:
  process:
    build: .
    restart: unless-stopped
    ports:
     - "${RTP_SRC_PORT:-5004}:${RTP_SRC_PORT:-5004}/udp"
     - "${HTTP_PORT:-80}:${HTTP_PORT:-80}"
    volumes:
     - process_storage:/usr/share/sound4proc
    command: [
        "/usr/local/bin/sound4.x1.cloud-proc"
        # You can get the full command line options by running the program with -h

        # For Kantar, disable usage of offline licenses in cloud solutions
        , "-a", "KANTAR_OfflineLicense=0"
        # , "-a", "KANTAR_LicPath=/usr/share/sound4lic"
        # For Kantar, you may force KANTAR_Login, KANTAR_Password, KANTAR_LicenseName and KANTAR_ChannelName
        # For stream, known metadata parsers
        , "-a", "Metadata_provided_path=/usr/local/share/sound4/SOUND4 Stream.CL Metaparsers"
        # For stream, if you want no metadata management in UI, set to 1
        , "-a", "Metadata_no_ui=0"
    ]
    environment:
      # where to save, internally
      - STATE_DIR=/usr/share/sound4proc
      # RTP/UDP listening specific IP (use for broadcast) or Livewire channel in
      # use 0 to receive directly RTP (no Livewire)
      - RTP_SRC_IP=${RTP_SRC_IP:-0}
      - RTP_SRC_PORT=${RTP_SRC_PORT:-5004}
      # Send back to this IP or Livewire channel
      - RTP_DEST_IP=${RTP_DEST_IP:-x.x.x.x}
      - RTP_DEST_PORT=${RTP_DEST_PORT:-5004}
      - PROC_VERB=${PROC_VERB:-}
      # Choose sample format in S16_LE, S16_BE, S24_LE, S24_BE, S32_LE, S32_BE, F32_LE, F32_BE
      - RTP_SAMPLE_FORMAT=${RTP_SAMPLE_FORMAT:-S16_BE}
      # receive/send RTP payload. NOTE: payload 97 allows to receive payload 96 or 97, to ease compatibility.
      - RTP_PAYLOAD=${RTP_PAYLOAD:-97}
      # Audio frames Per Output Packet
      - RTP_FRAMES=${RTP_FRAMES:-64}
      # Port for HTTP
      - HTTP_PORT=${HTTP_PORT:-80}
      # Setup/Admin user: see doc
      - SETUP_USER=${SETUP_USER:-}
      - SETUP_SECRET=${SETUP_SECRET:-}
      - ADMIN_USER=${ADMIN_USER:-}
      - ADMIN_SECRET=${ADMIN_SECRET:-}
      # IDs for the licence SOUND4 gave you
      - S4LOGINKEY=${S4LOGINKEY:-xxxxxxxx}
      - RADIO_NAME=${RADIO_NAME:-}
      - S4_AWS_ACCESS_KEY_ID=${S4_AWS_ACCESS_KEY_ID:-}
      - S4_AWS_SECRET_ACCESS_KEY=${S4_AWS_SECRET_ACCESS_KEY:-}
volumes:
  process_storage:

Example for X1.CL with separated server

Files used in image should be extracted from the matching process library archives.

See Example for X1.CL for other details.

Dockerfile-process

FROM debian:bookworm-slim
# install ca-certificates to access HTTPS for licenses
RUN apt update \
    && apt install -yq --no-install-recommends \
		ca-certificates \
    && rm -rf /var/lib/apt/lists/*
RUN mkdir -p /usr/share/sound4proc
WORKDIR /
# copy processing library
COPY lib/libsound4.x1.cloud.so /usr/local/lib
# copy processing helper executable
COPY bin/sound4.x1.cloud-proc /usr/local/bin

# OPTIONAL: Kantar.CL
COPY lib/libsound4.kantar.so /usr/local/lib
COPY lib/libsnapliveaudioembedder.so /usr/local/lib

# OPTIONAL: Stream.CL
COPY lib/libsound4.stream.so /usr/local/lib
# OPTIONAL: Stream.CL scripts in share/sound4/SOUND4\ Stream.CL\ Metaparsers/
COPY share/ /usr/local/share/

# force libs locate
RUN ldconfig
# rtp needs a logname
ENV LOGNAME=sound4
CMD /usr/local/bin/sound4.x1.cloud-proc

Dockerfile-server

FROM debian:bookworm-slim
# install ca-certificates to access HTTPS for licenses
RUN apt update \
    && apt install -yq --no-install-recommends \
		ca-certificates \
    && rm -rf /var/lib/apt/lists/*
RUN mkdir -p /usr/share/sound4proc
WORKDIR /
# copy processing library
COPY lib/libsound4.x1.cloud.so /usr/local/lib
# copy server helper executable
COPY bin/sound4.x1.cloud-server /usr/local/bin

# force libs locate
RUN ldconfig

CMD /usr/local/bin/sound4.x1.cloud-server

Docker-compose File

version: '3.4'
services:
  server:
    build:
      context: .
      dockerfile: Dockerfile-server
    depends_on:
      - process
    restart: unless-stopped
    ports:
      - "${HTTP_PORT:-80}:80"
   environment:
      - HTTP_PORT=80
      - PROC_IP=process
      - PROC_PORT=5010
  process:
    build:
      context: .
      dockerfile: Dockerfile-process
    restart: unless-stopped
    ports:
      - "${RTP_SRC_PORT:-5004}:${RTP_SRC_PORT:-5004}/udp"
    volumes:
      - process_storage:/usr/share/sound4proc
    command: [
        "/usr/local/bin/sound4.x1.cloud-proc"
        # You can get the full command line options by running the program with -h

        # For Kantar, disable usage of offline licenses in cloud solutions
        , "-a", "KANTAR_OfflineLicense=0"
        # , "-a", "KANTAR_LicPath=/usr/share/sound4lic"
        # For Kantar, you may force KANTAR_Login, KANTAR_Password, KANTAR_LicenseName and KANTAR_ChannelName
        # For stream, known metadata parsers
        , "-a", "Metadata_provided_path=/usr/local/share/sound4/SOUND4 Stream.CL Metaparsers"
        # For stream, if you want no metadata management in UI, set to 1
        , "-a", "Metadata_no_ui=0"
    ]
    environment:
      # where to save, internally
      - STATE_DIR=/usr/share/sound4proc
      # RTP/UDP listening specific IP (use for broadcast) or Livewire channel in
      # use 0 to receive directly RTP (no Livewire)
      - RTP_SRC_IP=${RTP_SRC_IP:-0}
      - RTP_SRC_PORT=${RTP_SRC_PORT:-5004}
      # Send back to this IP or Livewire channel
      - RTP_DEST_IP=${RTP_DEST_IP:-x.x.x.x}
      - RTP_DEST_PORT=${RTP_DEST_PORT:-5004}
      - PROC_VERB=${PROC_VERB:-}
      # Choose sample format in S16_LE, S16_BE, S24_LE, S24_BE, S32_LE, S32_BE, F32_LE, F32_BE
      - RTP_SAMPLE_FORMAT=${RTP_SAMPLE_FORMAT:-S16_BE}
      # receive/send RTP payload. NOTE: payload 97 allows to receive payload 96 or 97, to ease compatibility.
      - RTP_PAYLOAD=${RTP_PAYLOAD:-97}
      # Audio frames Per Output Packet
      - RTP_FRAMES=${RTP_FRAMES:-64}
      # Port for server
      - PROC_PORT=5010
      # Setup/Admin user: see doc
      - SETUP_USER=${SETUP_USER:-}
      - SETUP_SECRET=${SETUP_SECRET:-}
      - ADMIN_USER=${ADMIN_USER:-}
      - ADMIN_SECRET=${ADMIN_SECRET:-}
      # IDs for the licence SOUND4 gave you
      - S4LOGINKEY=${S4LOGINKEY:-xxxxxxxx}
      - RADIO_NAME=${RADIO_NAME:-}
      - S4_AWS_ACCESS_KEY_ID=${S4_AWS_ACCESS_KEY_ID:-}
      - S4_AWS_SECRET_ACCESS_KEY=${S4_AWS_SECRET_ACCESS_KEY:-}
volumes:
  process_storage:

Impact.CL

This exactly the same as X1.CL, replacing sound4.x1.cloud by sound4.impact.cl.

See Example for X1.CL for details.

Bigvoice.CL

This exactly the same as X1.CL, replacing sound4.x1.cloud by sound4.bigvoice.cl. You can remove all Kantar and Stream extension's specific, as they are not used in BigVoice.CL.

See Example for X1.CL for details.

Dockerfile

FROM debian:bookworm-slim
# install ca-certificates to access HTTPS for licenses
RUN apt update \
    && apt install -yq --no-install-recommends \
		ca-certificates \
    && rm -rf /var/lib/apt/lists/*
RUN mkdir -p /usr/share/sound4proc
WORKDIR /
# copy processing library
COPY lib/libsound4.bigvoice.cl.so /usr/local/lib
# copy processing helper executable
COPY bin/sound4.bigvoice.cl-proc /usr/local/bin

# force libs locate
RUN ldconfig
# rtp needs a logname
ENV LOGNAME=sound4
CMD /usr/local/bin/sound4.bigvoice.cl-proc

Docker-compose File

version: '3.4'
services:
  process:
    build: .
    restart: unless-stopped
    ports:
     - "${RTP_SRC_PORT:-5004}:${RTP_SRC_PORT:-5004}/udp"
     - "${HTTP_PORT:-80}:${HTTP_PORT:-80}"
    volumes:
     - process_storage:/usr/share/sound4proc
    environment:
      # where to save, internally
      - STATE_DIR=/usr/share/sound4proc
      # RTP/UDP listening specific IP (use for broadcast) or Livewire channel in
      # use 0 to receive directly RTP (no Livewire)
      - RTP_SRC_IP=${RTP_SRC_IP:-0}
      - RTP_SRC_PORT=${RTP_SRC_PORT:-5004}
      # Send back to this IP or Livewire channel
      - RTP_DEST_IP=${RTP_DEST_IP:-x.x.x.x}
      - RTP_DEST_PORT=${RTP_DEST_PORT:-5004}
      - PROC_VERB=${PROC_VERB:-}
      # Choose sample format in S16_LE, S16_BE, S24_LE, S24_BE, S32_LE, S32_BE, F32_LE, F32_BE
      - RTP_SAMPLE_FORMAT=${RTP_SAMPLE_FORMAT:-S16_BE}
      # receive/send RTP payload. NOTE: payload 97 allows to receive payload 96 or 97, to ease compatibility.
      - RTP_PAYLOAD=${RTP_PAYLOAD:-97}
      # Audio frames Per Output Packet
      - RTP_FRAMES=${RTP_FRAMES:-64}
      # Port for HTTP
      - HTTP_PORT=${HTTP_PORT:-80}
      # Setup/Admin user: see doc
      - SETUP_USER=${SETUP_USER:-}
      - SETUP_SECRET=${SETUP_SECRET:-}
      - ADMIN_USER=${ADMIN_USER:-}
      - ADMIN_SECRET=${ADMIN_SECRET:-}
      # IDs for the licence SOUND4 gave you
      - S4LOGINKEY=${S4LOGINKEY:-xxxxxxxx}
      - RADIO_NAME=${RADIO_NAME:-}
      - S4_AWS_ACCESS_KEY_ID=${S4_AWS_ACCESS_KEY_ID:-}
      - S4_AWS_SECRET_ACCESS_KEY=${S4_AWS_SECRET_ACCESS_KEY:-}
volumes:
  process_storage: