...
1#!/bin/sh
2# runNginx.sh script is used to perform setup steps, as well as run nginx
3# 1. Apply environment variables to the nginx configuration template files
4# 2. Wait for an applicable FIFO file to be created
5# 3. Start up nginx
6
7set -eu
8
9envsubst '$NAMESPACE$WS_SERVER_LOGS' < /etc/nginx/templates/novnc.conf.template > /etc/nginx/conf.d/novnc.conf
10
11echo "Waiting for creation of log FIFO file"
12
13# We need to wait for the log FIFO file to be created by the log processor
14# component first. If we don't wait here, nginx might start up first and attempt
15# to open the file with the O_CREAT flag. If the file is missing at this point,
16# it will be created by nginx as a normal file rather than the required FIFO.
17
18while :; do
19 if [ -p "${WS_SERVER_LOGS}" ]; then
20 break
21 fi
22
23 sleep 1
24done
25
26echo "Found log FIFO file"
27
28nginx -g 'daemon off;'
View as plain text