Matt Burchett
5edf298758
All checks were successful
continuous-integration/drone/push Build is passing
40 lines
842 B
Bash
40 lines
842 B
Bash
#!/usr/bin/env bash
|
|
|
|
# Create data dir if it doesn't exist
|
|
mkdir -p /data
|
|
|
|
# perform setup
|
|
if [[ ! -f ./database/database.sqlite ]]; then
|
|
echo "No link to database. Linking database."
|
|
ln -s /data/database.sqlite ./database/database.sqlite
|
|
fi
|
|
|
|
if [[ ! -f /data/database.sqlite ]]; then
|
|
echo "No database found. Creating."
|
|
touch /data/database.sqlite
|
|
fi
|
|
|
|
if [[ ! -f ./.env ]]; then
|
|
echo "No link to environment. Linking environment."
|
|
ln -s /data/.env ./.env
|
|
fi
|
|
|
|
if [[ ! -f /data/.env ]]; then
|
|
echo "No environment found. Creating."
|
|
cp .env.example /data/.env
|
|
php artisan key:generate --force
|
|
fi
|
|
|
|
# update application cache
|
|
php artisan optimize
|
|
|
|
# perform db migrations
|
|
php artisan migrate
|
|
|
|
# own the data folder to www-data
|
|
chown -R www-data: /data
|
|
|
|
# start the application
|
|
|
|
php-fpm -D && nginx -g "daemon off;"
|