2021-06-24 11:10:15 +00:00
|
|
|
#!/bin/bash
|
2021-06-24 10:36:27 +00:00
|
|
|
|
2021-07-18 12:10:21 +00:00
|
|
|
set -e
|
2021-06-24 10:36:27 +00:00
|
|
|
|
2021-07-18 12:10:21 +00:00
|
|
|
BASE_DIR=storage/app
|
2021-06-24 11:10:15 +00:00
|
|
|
|
2021-07-18 13:48:43 +00:00
|
|
|
# If DB_HOST not set, source the env file
|
|
|
|
[ -z "${DB_HOST}" -a -r .env ] && . .env
|
|
|
|
|
|
|
|
if [ -n "${DB_HOST}" -a -n "${DB_PORT}" ]; then
|
|
|
|
while ! wait-for-it -h ${DB_HOST} -p ${DB_PORT} -t 5 -q; do
|
|
|
|
echo "? Waiting for database at ${DB_HOST}:${DB_PORT}"
|
|
|
|
sleep 1;
|
|
|
|
done
|
|
|
|
echo "- DB is active on ${DB_HOST}:${DB_PORT}"
|
|
|
|
fi
|
|
|
|
|
2021-07-18 12:10:21 +00:00
|
|
|
# If FIDO_DIR not set, source the env file
|
|
|
|
[ -z "${FIDO_DIR}" -a -r .env ] && . .env
|
|
|
|
|
|
|
|
FIDO_DIR=${FIDO_DIR:-fido}
|
|
|
|
|
|
|
|
if [ ! -d "${BASE_DIR}/${FIDO_DIR}" ]; then
|
|
|
|
if ! mkdir ${BASE_DIR}/${FIDO_DIR}; then
|
|
|
|
echo "! ERROR creating FIDO_DIR [${BASE_DIR}/${FIDO_DIR}]"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
2021-06-24 11:10:15 +00:00
|
|
|
|
2021-06-24 11:31:02 +00:00
|
|
|
echo "* Ready to start server"
|
2021-07-18 12:10:21 +00:00
|
|
|
echo " - INBOUND [${BASE_DIR}/${FIDO_DIR}]"
|
2021-06-24 11:31:02 +00:00
|
|
|
|
2021-06-26 00:57:18 +00:00
|
|
|
exec su www-data -s /bin/sh -c "./artisan server:start"
|