updated streamline-setup v2

This commit is contained in:
2025-01-15 08:53:49 -08:00
committed by alec.turner
parent a2ce9248f0
commit 4b569f81b0
20228 changed files with 2932048 additions and 63204 deletions
+54
View File
@@ -0,0 +1,54 @@
#! /bin/sh
# Required script variables
APP_NAME=${APP_NAME:-'streamline'}
export MYSQL_DATABASE=${DB_DATABASE:-'streamline'}
export MYSQL_USER=${DB_USERNAME:-'root'}
export MYSQL_PASSWORD=${DB_PASSWORD:-'streamline'}
export MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD:-'streamline'}
# execute run.sh script for MySQL initialisation
chmod +x .docker/mysql/mysql-init.sh
# run the MariaDB initilisation script
./.docker/mysql/mysql-init.sh
if [ $? -eq 0 ]; then
echo "[info] MySQL server started. checking for '$MYSQL_DATABASE' database. "
mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -e "use streamline;"
# Guard condition to re-check existence of database schema
# If it doesnt exist, create it and import streamline_initial.sql file
if [ $? -eq 1 ]; then
mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -e "CREATE DATABASE $MYSQL_DATABASE;"
if [ $? -eq 0 ]; then
echo "[info] Database: $MYSQL_DATABASE created."
mysql -u $MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE < ./.docker/mysql/scripts/streamline_initial.sql
if [ $? -eq 0 ]; then
echo "[info] populated database."
else
echo "[error] database not populated."
fi
else
echo "[error] database not created."
fi
else
echo "[info] Database: $MYSQL_DATABASE exists. "
fi
echo "[info] starting $APP_NAME ..."
php /var/www/html/artisan serve --host=0.0.0.0 --port=80
else
echo "[error] MariaDB server couldnt be started."
# terminate script if database isnt running
exit 1;
fi