#!/bin/sh
set -e
if [ ! -f /var/www/html/database/database.sqlite ]; then
touch /var/www/html/database/database.sqlite
fi
chown -R www-data:www-data /var/www/html/database
chmod -R 775 /var/www/html/database
if [ -z "$APP_KEY" ]; then
php artisan key:generate --force --no-interaction
fi
php artisan migrate --force --no-interaction
php artisan storage:link --force --no-interaction 2>/dev/null || true
chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache
exec /usr/bin/supervisord -c /etc/supervisord.conf