59 lines
1.3 KiB
Bash
59 lines
1.3 KiB
Bash
# Install project dependencies
|
|
composer install --quiet --prefer-dist --no-dev -o
|
|
npm install
|
|
|
|
init=false
|
|
if ! test -f /config/.env; then
|
|
# Create Env File
|
|
cp .env.example .env
|
|
php artisan key:generate
|
|
|
|
cp .env /config/.env
|
|
|
|
init=true
|
|
echo "Initialization"
|
|
else
|
|
cp /config/.env .env
|
|
fi
|
|
|
|
if [ $(grep -ic "DB_CONNECTION=sqlite" /var/www/html/.env) -gt 0 ] || [ "${DEPLOY_ENV}" == "sqlite"]; then
|
|
if ! test -f "/var/www/html/database/database.sqlite" ; then
|
|
echo " DB Initialization"
|
|
init=true
|
|
fi
|
|
fi
|
|
|
|
|
|
# Migrate Database
|
|
php artisan migrate --force --no-interaction
|
|
|
|
# Link storage and create default user
|
|
if [ "$init" = true ]; then
|
|
echo "Initialization of Laravel"
|
|
|
|
# Install project build dependencies
|
|
composer install --quiet --prefer-dist-o
|
|
|
|
php artisan db:seed --force --class=DatabaseSeeder
|
|
php artisan storage:link
|
|
|
|
#clear build dependencies and install production dependencies
|
|
rm -rf vendor/*
|
|
composer install --quiet --prefer-dist --no-dev -o
|
|
fi
|
|
|
|
# Clear Cashes
|
|
php artisan cache:clear
|
|
php artisan config:clear
|
|
php artisan route:clear
|
|
php artisan view:clear
|
|
|
|
# fix permissions
|
|
chown -R www-data:www-data /var/www/html
|
|
find /var/www/html -type f -not -name "*.sh" -exec chmod 664 {} +
|
|
find /var/www/html -type d -exec chmod 775 {} +
|
|
|
|
# Start Apache
|
|
apache2-foreground
|
|
|