Created
June 26, 2020 02:14
-
-
Save yorch/95d9156223443fec37b116a94bbc6aa4 to your computer and use it in GitHub Desktop.
Run Wowza Streaming Server in Docker bash script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
VERSION=4.8.0 | |
IMAGE=wowzamedia/wowza-streaming-engine-linux:${VERSION} | |
NAME=wowza | |
DATA_DIR=$(pwd)/data | |
CONFIG_DIR=${DATA_DIR}/conf | |
LOGS_DIR=${DATA_DIR}/logs | |
SUPERVISOR_LOG_FILE=${DATA_DIR}/supervisord.log | |
CONTAINER_BASE_DIR=/usr/local/WowzaStreamingEngine | |
CONTAINER_CONFIG_DIR=${CONTAINER_BASE_DIR}/conf | |
CONTAINER_LOGS_DIR=${CONTAINER_BASE_DIR}/logs | |
function copyConfigFromImage() { | |
local TEMP_NAME=dummy | |
docker create -ti --name ${TEMP_NAME} ${IMAGE} bash | |
docker cp ${TEMP_NAME}:${CONTAINER_CONFIG_DIR} ${CONFIG_DIR} | |
docker rm -f ${TEMP_NAME} | |
} | |
docker pull ${IMAGE} | |
if [ -z "$(ls -A $CONFIG_DIR)" ] | |
then | |
echo "Local config directory doesn't exist, copying config directory from container..." | |
mkdir -p "${DATA_DIR}" | |
copyConfigFromImage | |
echo "Done copying config files!" | |
fi | |
if [ ! -f ${SUPERVISOR_LOG_FILE} ] | |
then | |
echo "Creating supervisor log file ${SUPERVISOR_LOG_FILE}..." | |
touch "${SUPERVISOR_LOG_FILE}" | |
echo "Done creating supervisor log file!" | |
fi | |
# Stop container if already running | |
docker stop ${NAME} || true | |
docker rm ${NAME} || true | |
docker run \ | |
-it \ | |
--name ${NAME} \ | |
--restart unless-stopped \ | |
--expose 1935/tcp \ | |
--expose 8086/tcp \ | |
--expose 8087/tcp \ | |
--expose 8088/tcp \ | |
--publish 1935:1935 \ | |
--publish 8086:8086 \ | |
--publish 8087:8087 \ | |
--publish 8088:8088 \ | |
--volume ${CONFIG_DIR}:${CONTAINER_CONFIG_DIR} \ | |
--volume ${LOGS_DIR}:${CONTAINER_LOGS_DIR} \ | |
--volume ${SUPERVISOR_LOG_FILE}:/supervisor/supervisord.log \ | |
--entrypoint /sbin/entrypoint.sh \ | |
${IMAGE} | |
# --env WSE_MGR_USER=admin \ | |
# --env WSE_MGR_PASS=123456 \ | |
# --env WSE_LIC=[license] \ | |
# --env WSE_IP_PARAM=[wowza-ip-address] \ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment