eliteregistry/post_deploy.sh
Matt Burchett 064120f8c9
Some checks reported errors
continuous-integration/drone/push Build was killed
Fixing logging and changing post deploy
2021-04-07 00:28:03 -07:00

39 lines
826 B
Bash

#!/usr/bin/env bash
# Create data dir if it doesn't exist
mkdir -p /data
# update application cache
php artisan optimize
# perform DB migrations
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
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;"