2020-02-10 08:00:54 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
## Thanks
|
|
|
|
# https://serverfault.com/a/919212
|
|
|
|
##
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
rsync -a --delete /var/www/html/assets/js /assets
|
|
|
|
rsync -a --delete /var/www/html/assets/css /assets
|
|
|
|
rsync -a --delete /var/www/html/assets/frappe /assets
|
2020-03-05 01:43:50 +00:00
|
|
|
. /rsync
|
2020-02-10 08:00:54 +00:00
|
|
|
|
|
|
|
chmod -R 755 /assets
|
|
|
|
|
2020-07-13 17:42:29 +00:00
|
|
|
touch /var/www/html/sites/.build -r $(ls -td /assets/* | head -n 1)
|
|
|
|
|
2020-02-20 16:18:51 +00:00
|
|
|
if [[ -z "$FRAPPE_PY" ]]; then
|
|
|
|
export FRAPPE_PY=0.0.0.0
|
2020-02-10 08:00:54 +00:00
|
|
|
fi
|
|
|
|
|
2020-02-20 16:18:51 +00:00
|
|
|
if [[ -z "$FRAPPE_PY_PORT" ]]; then
|
|
|
|
export FRAPPE_PY_PORT=8000
|
2020-02-10 08:00:54 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "$FRAPPE_SOCKETIO" ]]; then
|
|
|
|
export FRAPPE_SOCKETIO=0.0.0.0
|
|
|
|
fi
|
|
|
|
|
2020-03-01 23:39:57 +00:00
|
|
|
if [[ -z "$SOCKETIO_PORT" ]]; then
|
|
|
|
export SOCKETIO_PORT=9000
|
2020-02-10 08:00:54 +00:00
|
|
|
fi
|
|
|
|
|
2021-01-04 13:00:24 +00:00
|
|
|
if [[ -z "$HTTP_TIMEOUT" ]]; then
|
|
|
|
export HTTP_TIMEOUT=120
|
|
|
|
fi
|
|
|
|
|
2021-02-17 11:25:41 +00:00
|
|
|
if [[ -z "$UPSTREAM_REAL_IP_ADDRESS" ]]; then
|
|
|
|
export UPSTREAM_REAL_IP_ADDRESS=127.0.0.1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "$UPSTREAM_REAL_IP_RECURSIVE" ]]; then
|
|
|
|
export UPSTREAM_REAL_IP_RECURSIVE=off
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "$UPSTREAM_REAL_IP_HEADER" ]]; then
|
|
|
|
export UPSTREAM_REAL_IP_HEADER="X-Forwarded-For"
|
|
|
|
fi
|
|
|
|
|
2021-01-04 13:00:24 +00:00
|
|
|
envsubst '${FRAPPE_PY}
|
2020-02-20 16:18:51 +00:00
|
|
|
${FRAPPE_PY_PORT}
|
|
|
|
${FRAPPE_SOCKETIO}
|
2021-01-04 13:00:24 +00:00
|
|
|
${SOCKETIO_PORT}
|
2021-02-17 11:25:41 +00:00
|
|
|
${HTTP_TIMEOUT}
|
|
|
|
${UPSTREAM_REAL_IP_ADDRESS}
|
|
|
|
${UPSTREAM_REAL_IP_RECURSIVE}
|
|
|
|
${UPSTREAM_REAL_IP_HEADER}' \
|
2020-02-10 08:00:54 +00:00
|
|
|
< /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf
|
|
|
|
|
2020-03-04 14:15:25 +00:00
|
|
|
echo "Waiting for frappe-python to be available on $FRAPPE_PY port $FRAPPE_PY_PORT"
|
|
|
|
timeout 10 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/$0/$1; do sleep 1; done' $FRAPPE_PY $FRAPPE_PY_PORT
|
|
|
|
echo "Frappe-python available on $FRAPPE_PY port $FRAPPE_PY_PORT"
|
2020-04-21 09:29:06 +00:00
|
|
|
echo "Waiting for frappe-socketio to be available on $FRAPPE_SOCKETIO port $SOCKETIO_PORT"
|
2020-03-04 14:15:25 +00:00
|
|
|
timeout 10 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/$0/$1; do sleep 1; done' $FRAPPE_SOCKETIO $SOCKETIO_PORT
|
2020-04-21 09:29:06 +00:00
|
|
|
echo "Frappe-socketio available on $FRAPPE_SOCKETIO port $SOCKETIO_PORT"
|
2020-03-04 14:15:25 +00:00
|
|
|
|
2020-02-10 08:00:54 +00:00
|
|
|
exec "$@"
|