#!/bin/sh # runNginx.sh script is used to perform setup steps, as well as run nginx # 1. Apply environment variables to the nginx configuration template files # 2. Wait for an applicable FIFO file to be created # 3. Start up nginx set -eu envsubst '$NAMESPACE$WS_SERVER_LOGS' < /etc/nginx/templates/novnc.conf.template > /etc/nginx/conf.d/novnc.conf echo "Waiting for creation of log FIFO file" # We need to wait for the log FIFO file to be created by the log processor # component first. If we don't wait here, nginx might start up first and attempt # to open the file with the O_CREAT flag. If the file is missing at this point, # it will be created by nginx as a normal file rather than the required FIFO. while :; do if [ -p "${WS_SERVER_LOGS}" ]; then break fi sleep 1 done echo "Found log FIFO file" nginx -g 'daemon off;'