eliteregistry/post_deploy.sh
Matt Burchett 5edf298758
All checks were successful
continuous-integration/drone/push Build is passing
changing post deploy
2021-04-07 00:28:57 -07:00

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;"