Skip to content

Commit 89589bd

Browse files
authored
AP-515: add 4.9.6 image for cross-platform testing (#4)
* Build from wowzamedia/wowza-streaming-engine-linux:4.9.6. * Auto install platform-specific version of OpenJDK 21 and update necessary log4j classes to their appropriate versions. * Wrap Python testing scripts in a virtual environment. * Readd arm64 to the build matrix. * Add healthcheck to the compose file for the API endpoint. * simplify test runner given the reliance on supervisord * allow supervisord to drop privileges to APP_USER and follow Docker guidelines for supervisord logging
1 parent 29c1ad8 commit 89589bd

14 files changed

Lines changed: 185 additions & 117 deletions

.github/workflows/build.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ jobs:
1414
build:
1515
runs-on: ${{ matrix.runner }}
1616
outputs:
17-
# image-arm64: ${{ steps.gen-output.outputs.image-arm64 }}
17+
image-arm64: ${{ steps.gen-output.outputs.image-arm64 }}
1818
image-x64: ${{ steps.gen-output.outputs.image-x64 }}
1919
strategy:
2020
fail-fast: false
2121
matrix:
2222
runner:
2323
- ubuntu-24.04
24-
# - ubuntu-24.04-arm
24+
- ubuntu-24.04-arm
2525
steps:
2626
- name: Checkout code
2727
uses: actions/checkout@v4
@@ -77,7 +77,7 @@ jobs:
7777
runs-on: ubuntu-24.04
7878
needs: build
7979
env:
80-
# DOCKER_APP_IMAGE_ARM64: ${{ needs.build.outputs.image-arm64 }}
80+
DOCKER_APP_IMAGE_ARM64: ${{ needs.build.outputs.image-arm64 }}
8181
DOCKER_APP_IMAGE_X64: ${{ needs.build.outputs.image-x64 }}
8282
outputs:
8383
image: ${{ steps.meta.outputs.tags }}
@@ -106,7 +106,7 @@ jobs:
106106
run: |
107107
docker buildx imagetools create \
108108
--tag "$DOCKER_METADATA_OUTPUT_TAGS" \
109-
"$DOCKER_APP_IMAGE_X64"
109+
"$DOCKER_APP_IMAGE_ARM64" "$DOCKER_APP_IMAGE_X64"
110110
111111
test:
112112
runs-on: ubuntu-24.04
@@ -143,7 +143,7 @@ jobs:
143143
- name: Run tests
144144
if: ${{ always() }}
145145
run: |
146-
docker compose run app /opt/app/test/run_tests.py
146+
docker compose exec app venv/bin/python test/run_tests.py
147147
env:
148148
WOWZA_LICENSE_KEY: ${{ secrets.WOWZA_LICENSE_KEY }}
149149

@@ -153,7 +153,8 @@ jobs:
153153
docker compose cp app:/opt/app/artifacts ./
154154
docker compose logs > artifacts/docker-compose-services.log
155155
docker compose config > artifacts/docker-compose.merged.yml
156-
156+
env:
157+
WOWZA_LICENSE_KEY: EZZZZ-INTEN-TIONA-LLYRE-DACT-EDFROM-BUILDLOGS
157158
- name: Upload the test report
158159
if: ${{ always() }}
159160
uses: actions/upload-artifact@v4

Dockerfile

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Target: base
33
#
44

5-
FROM wowzamedia/wowza-streaming-engine-linux:4.8.25 AS base
5+
FROM wowzamedia/wowza-streaming-engine-linux:4.9.6 AS base
66

77
# =============================================================================
88
# Ports
@@ -27,28 +27,34 @@ RUN apt-get update -qq
2727
RUN apt-get install -y --no-install-recommends \
2828
curl \
2929
dnsutils \
30-
iputils-ping \
31-
lsb-core
30+
iputils-ping
3231

3332
# =============================================================================
3433
# Java
3534

36-
# The upstream Wowza image ships with OpenJDK 9.0.4+11, which is not a
37-
# long-term support release and, importantly, doesn't know about containers:
38-
# https://www.wowza.com/community/t/creating-a-production-worthy-docker-image/53957/3
35+
# The upstream Wowza image may ship with an outdated OpenJDK, and
36+
# previously (even as of 4.8.25) did not include an LTS release or
37+
# one that was aware of containers.
3938
#
4039
# Luckily, Wowza supports manually replacing the JRE:
4140
# https://www.wowza.com/docs/manually-install-and-troubleshoot-java-on-wowza-streaming-engine
41+
# ... so this updates to the latest version of OpenJDK 21 (LTS).
4242
#
4343
# (Unfortunately, this by itself isn't enough to get Wowza to properly
4444
# calculate its own max heap size, so we still need to set that explicitly
4545
# in Tune.xml. Possibly a future version of Wowza will be clever enough to
4646
# use -XX:MaxRAMPercentage instead.)
4747

48-
RUN apt-get install -y --no-install-recommends openjdk-11-jre-headless
48+
RUN apt-get install -y --no-install-recommends openjdk-21-jre-headless
4949

5050
RUN rm -rf /usr/local/WowzaStreamingEngine/java
51-
RUN ln -s /usr/lib/jvm/java-11-openjdk-amd64 /usr/local/WowzaStreamingEngine/java
51+
52+
# for some reason, OpenJDK's default directory includes the architecture
53+
# name and does not symlink it to something more straightforward like
54+
# /usr/lib/jvm/java-21-openjdk so we have to detect the architecture
55+
56+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
57+
RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) ln -s "/usr/lib/jvm/java-21-openjdk-${arch}" /usr/local/WowzaStreamingEngine/java
5258

5359
# =============================================================================
5460
# Global configuration
@@ -66,6 +72,10 @@ RUN usermod -u $APP_UID $APP_USER && \
6672
# transfer now-orphaned files to new wowza user (-h to chown symlinks)
6773
RUN find / -xdev -nouser -exec chown -h $APP_USER:$APP_USER {} \;
6874

75+
# set variables to be used by envsubst to overwrite the default wowza config
76+
ENV SUPERVISORD_PID_FILE=/tmp/supervisord.pid
77+
ENV SUPERVISORD_SOCKET_FILE=/tmp/supervisor.sock
78+
6979
# =============================================================================
7080
# Set working directory
7181

@@ -74,12 +84,13 @@ WORKDIR /opt/app
7484
# =============================================================================
7585
# Tests
7686

77-
RUN apt-get install -y --no-install-recommends python3-pip
78-
RUN pip3 install unittest-xml-reporting
87+
RUN apt-get install -y --no-install-recommends python3-pip python3-venv
88+
RUN python3 -m venv venv
89+
RUN venv/bin/pip3 install unittest-xml-reporting
7990

8091
COPY --chown=$APP_USER test /opt/app/test
8192

82-
# Put artifacts where Jenkins can get at them
93+
# Put artifacts where Github Actions can get at them
8394
RUN mkdir /opt/app/artifacts && \
8495
chown $APP_USER:$APP_USER /opt/app/artifacts
8596

@@ -96,8 +107,22 @@ RUN for app in vod live; \
96107
# Copy our scripts, configs, templates, etc. into the container
97108
COPY --chown=$APP_USER WowzaStreamingEngine /usr/local/WowzaStreamingEngine
98109
COPY --chown=$APP_USER log4j-templates /opt/app/log4j-templates
110+
COPY --chown=$APP_USER supervisor_templates /opt/app/supervisor_templates
99111
COPY --chown=$APP_USER bin /opt/app/bin
100112

113+
# create supervisord config files from templates
114+
RUN apt-get install -y --no-install-recommends gettext
115+
RUN envsubst < \
116+
supervisor_templates/supervisord.conf.tmpl > \
117+
/etc/supervisor/supervisord.conf
118+
RUN envsubst < \
119+
supervisor_templates/conf.d/WowzaStreamingEngine.conf.tmpl > \
120+
/etc/supervisor/conf.d/WowzaStreamingEngine.conf
121+
RUN envsubst < \
122+
supervisor_templates/conf.d/WowzaStreamingEngineManager.conf.tmpl > \
123+
/etc/supervisor/conf.d/WowzaStreamingEngineManager.conf
124+
125+
101126
# =============================================================================
102127
# Additional Java libraries
103128

@@ -138,7 +163,11 @@ RUN apt-get remove -y zip
138163

139164
USER $APP_USER
140165

166+
# =============================================================================
167+
# Healthcheck
168+
HEALTHCHECK --interval=5s --timeout=5s --start-period=10s --retries=10 CMD curl -s http://localhost:8087 > /dev/null || exit 1
169+
141170
# =============================================================================
142171
# Default command
143172

144-
CMD ["/opt/app/bin/docker-entrypoint.sh"]
173+
ENTRYPOINT ["/opt/app/bin/docker-entrypoint.sh"]
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
# this is a BerkeleyLibrary modified version of the WSE startup script
3+
4+
# check for root access. If not, put up message and exit
5+
# if [ "$(/usr/bin/id -u)" -ne "0" ] ; then
6+
# echo "The Wowza Streaming Engine requires root access to start. Please run script again using sudo."
7+
# exit
8+
# fi
9+
10+
systemctl >> /dev/null 2>&1
11+
if [ $? -eq 0 ]; then
12+
# Restart XRM service
13+
SERVICE_NAME="xrmd.service"
14+
systemctl list-units --full -all | grep -Fq $SERVICE_NAME
15+
16+
if [ $? -eq 0 ]; then
17+
echo "Restarting XRM service"
18+
systemctl restart $SERVICE_NAME
19+
. /opt/xilinx/xcdr/setup.sh
20+
fi
21+
fi
22+
23+
. /usr/local/WowzaStreamingEngine/bin/setenv.sh
24+
mode=standalone
25+
if [ "$#" -eq 1 ];
26+
then
27+
mode=$1
28+
fi
29+
30+
#chmod 600 /usr/local/WowzaStreamingEngine/conf/jmxremote.password
31+
#chmod 600 /usr/local/WowzaStreamingEngine/conf/jmxremote.access
32+
33+
# NOTE: Here you can configure the JVM's built in JMX interface.
34+
# See the "Server Management Console and Monitoring" chapter
35+
# of the "User's Guide" for more information on how to configure the
36+
# remote JMX interface in the [install-dir]/conf/Server.xml file.
37+
38+
JMXOPTIONS=-Dcom.sun.management.jmxremote=true
39+
#JMXOPTIONS="$JMXOPTIONS -Djava.rmi.server.hostname=192.168.1.7"
40+
#JMXOPTIONS="$JMXOPTIONS -Dcom.sun.management.jmxremote.port=1099"
41+
#JMXOPTIONS="$JMXOPTIONS -Dcom.sun.management.jmxremote.authenticate=true"
42+
#JMXOPTIONS="$JMXOPTIONS -Dcom.sun.management.jmxremote.ssl=false"
43+
#JMXOPTIONS="$JMXOPTIONS -Dcom.sun.management.jmxremote.password.file=$WMSCONFIG_HOME/conf/jmxremote.password"
44+
#JMXOPTIONS="$JMXOPTIONS -Dcom.sun.management.jmxremote.access.file=$WMSCONFIG_HOME/conf/jmxremote.access"
45+
46+
ulimit -n 64000 > /dev/null 2>&1
47+
48+
rc=144
49+
while [ $rc -eq 144 ]
50+
do
51+
52+
WMSTUNE_OPTS=`$WMSAPP_HOME/bin/tune.sh $mode`
53+
export LD_PRELOAD=`$WMSAPP_HOME/bin/ldpreload.sh`
54+
55+
# log interceptor com.wowza.wms.logging.LogNotify - see Javadocs for ILogNotify
56+
57+
$_EXECJAVA $WMSTUNE_OPTS $JMXOPTIONS -Dorg.slf4j.simpleLogger.defaultLogLevel=warn -Dcom.wowza.wms.runmode="$mode" -Dcom.wowza.wms.native.base="linux" -Dlog4j.configurationFile="$WMSCONFIG_HOME/conf/log4j2-config.xml" -Dcom.wowza.wms.AppHome="$WMSAPP_HOME" -Dcom.wowza.wms.ConfigURL="$WMSCONFIG_URL" -Dcom.wowza.wms.ConfigHome="$WMSCONFIG_HOME" -cp $WMSAPP_HOME/bin/wms-bootstrap.jar com.wowza.wms.bootstrap.Bootstrap start
58+
59+
rc=$?
60+
if [ $rc -ge 10 ] && [ $rc -le 15 ] ; then
61+
WSE_EXIT_CODE=$rc
62+
$_EXECJAVA $WMSTUNE_OPTS $JMXOPTIONS -Dcom.wowza.wms.runmode="$mode" -Dcom.wowza.wms.native.base="linux" -Dlog4j.configurationFile="$WMSCONFIG_HOME/conf/log4j2-config.xml" -Dcom.wowza.wms.AppHome="$WMSAPP_HOME" -Dcom.wowza.wms.ConfigURL="$WMSCONFIG_URL" -Dcom.wowza.wms.ConfigHome="$WMSCONFIG_HOME" -cp $WMSAPP_HOME/bin/wms-bootstrap.jar com.wowza.wms.bootstrap.Bootstrap startLicenseUpdateServer
63+
rc=$?
64+
fi
65+
done

bin/docker-entrypoint.sh

Lines changed: 10 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
# Streaming Media Engine Manager in subprocesses, and waits
66
# for them to exit.
77

8-
# TODO: now that we're running the manager and server in the same container,
9-
# consider getting rid of this (or simplifying it) in favor of the
10-
# upstream container's /sbin/entrypoint.sh, which uses supervisord
11-
128
BASENAME=$(basename ${BASH_SOURCE})
139
echo "${BASENAME} running"
1410

@@ -26,58 +22,17 @@ if [ ! -z "${WOWZA_ENABLE_DOCUMENTATION_SERVER}" ]; then
2622
"${WOWZA_BIN}"/enable-documentation-server.sh
2723
fi
2824

29-
# ########################################
30-
# Start server and manager in background
31-
32-
# shellcheck source=start-server.sh
33-
echo "Invoking ${WOWZA_BIN}"/start-server.sh
34-
"${WOWZA_BIN}"/start-server.sh &
35-
SERVER_PID=$!
36-
echo "SERVER_PID=${SERVER_PID}"
37-
38-
echo "Invoking ${WMSMGR_HOME}"/bin/startmgr.sh
39-
"${WMSMGR_HOME}"/bin/startmgr.sh &
40-
MANAGER_PID=$!
41-
echo "MANAGER_PID=${MANAGER_PID}"
42-
43-
# ########################################
44-
# Make sure child processes exit cleanly
45-
46-
ensure_clean_exit() {
47-
trap - SIGINT SIGTERM # clear the trap
48-
echo "Killing process $$ and all subprocesses"
49-
kill -- -$$
50-
}
51-
52-
sigint_received() {
53-
echo "SIGINT received"
54-
ensure_clean_exit
55-
}
56-
57-
sigterm_received() {
58-
echo "SIGTERM received"
59-
ensure_clean_exit
60-
}
25+
# load secrets into wowza env vars. by default, the Wowza entrypoint
26+
# creates the keyfile in question, which is why we pass the variable
27+
# in using a different name.
28+
. "${WOWZA_BIN}/secrets.sh"
6129

62-
trap sigint_received SIGINT
63-
trap sigterm_received SIGTERM
30+
export WSE_MGR_USER=$WOWZA_MANAGER_USER
31+
export WSE_MGR_PASS=$WOWZA_MANAGER_PASSWORD
32+
export WSE_LIC=$WOWZA_LICENSE_KEY
6433

6534
# ########################################
66-
# Wait for manager or server to exit
67-
68-
wait -n
69-
EXIT_STATUS=$?
70-
71-
# Whichever exited, kill the other one
72-
if ! kill -0 $SERVER_PID 2> /dev/null; then
73-
echo "Wowza Streaming Engine (PID ${SERVER_PID}) exited with ${EXIT_STATUS}"
74-
echo "Stopping Wowza Streaming Engine Manager (PID ${MANAGER_PID})"
75-
kill -- -$MANAGER_PID 2> /dev/null
76-
elif ! kill -0 $MANAGER_PID 2> /dev/null; then
77-
echo "Wowza Streaming Engine Manager (PID ${MANAGER_PID}) exited with ${EXIT_STATUS}"
78-
echo "Stopping Wowza Streaming Engine (PID ${SERVER_PID})"
79-
kill -- -$SERVER_PID 2> /dev/null
80-
fi
35+
# Start server and manager by handing off to Wowza's entrypoint
8136

82-
echo "Exiting with status ${EXIT_STATUS}"
83-
exit $EXIT_STATUS
37+
echo Invoking Wowza\'s /sbin/entrypoint.sh
38+
exec /sbin/entrypoint.sh "$@"

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ services:
1616
- WOWZA_MANAGER_USER=${WOWZA_MANAGER_USER}
1717
- WOWZA_MANAGER_PASSWORD=${WOWZA_MANAGER_PASSWORD}
1818
- WOWZA_ENABLE_DOCUMENTATION_SERVER=yes
19-
# Uncommment these when editing / running tests locally.
19+
# Uncomment these when editing / running tests locally.
2020
# (Note: slows performance on macOS Catalina, for some reason.)
2121
# volumes:
2222
# - ./test:/opt/app/test

lib-ucblit/log4j-api-2.17.0.jar

-295 KB
Binary file not shown.

lib-ucblit/log4j-core-2.17.0.jar

-1.71 MB
Binary file not shown.
-215 KB
Binary file not shown.
230 KB
Binary file not shown.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[program:WowzaStreamingEngine]
2+
priority=10
3+
directory=/usr/local/WowzaStreamingEngine/bin
4+
command=/usr/local/WowzaStreamingEngine/bin/startup.sh
5+
user=${APP_USER}
6+
autostart=true
7+
autorestart=true
8+
stdout_logfile=/dev/fd/1
9+
stdout_logfile_maxbytes = 0
10+
redirect_stderr=true

0 commit comments

Comments
 (0)