-
-
Notifications
You must be signed in to change notification settings - Fork 41
/
run_server
executable file
·38 lines (27 loc) · 977 Bytes
/
run_server
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash -xe
fc-cache -v /usr/share/fonts/user
BUILD_DIR=/var/www/image-exporter/build
if [[ -n "${PLOTLY_JS_SRC}" ]]; then
# Fetch plotly js bundle and save it locally:
mkdir -p $BUILD_DIR
wget --retry-connrefused --no-check-certificate -O $BUILD_DIR/plotly-bundle.js $PLOTLY_JS_SRC
PLOTLYJS_ARG="--plotlyJS $BUILD_DIR/plotly-bundle.js"
fi
# Dynamically create the wrapper used to launch xvfb and the server so that
# we can fill in $@ from the Docker "command" argument.
cat > /usr/local/bin/xvfb_wrapper <<EOF
#!/bin/bash
PIDFILE=/var/run/xvfb.pid
if [ -e \$PIDFILE ] ; then
kill \`cat \$PIDFILE\`
rm -f \$PIDFILE
sleep 1
fi
pkill Xvfb
pkill node
xvfb-run --auto-servernum --server-args '-screen 0 640x480x24' ./bin/orca.js serve --request-limit=1000 --safe-mode $PLOTLYJS_ARG $@ 1>/proc/1/fd/1 2>/proc/1/fd/2 &
echo \$! > \$PIDFILE
EOF
chmod 755 /usr/local/bin/xvfb_wrapper
/usr/local/bin/xvfb_wrapper start
/opt/monit/bin/monit -c /etc/monitrc