clrghouz/init-php.sh

34 lines
773 B
Bash
Raw Normal View History

#!/bin/bash
2021-06-24 10:36:27 +00:00
set -e
2021-06-24 10:36:27 +00:00
BASE_DIR=storage/app
# 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
# 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:31:02 +00:00
echo "* Ready to start server"
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"