45 lines
1.3 KiB
Bash
45 lines
1.3 KiB
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
php /app/artisan migrate --force
|
|
php /app/artisan storage:link
|
|
|
|
# Generate only if no key is set in env or config
|
|
if [ -z "$APP_KEY" ]; then
|
|
echo "Generating APP_KEY..."
|
|
php /app/artisan key:generate --force
|
|
fi
|
|
|
|
php /app/artisan config:clear
|
|
php /app/artisan config:cache
|
|
php /app/artisan view:cache
|
|
|
|
# Execute hook script if it exists
|
|
if [ -f "/app/hook.sh" ]; then
|
|
echo "Executing application hook script..."
|
|
chmod +x /app/hook.sh
|
|
/app/hook.sh
|
|
fi
|
|
|
|
# Start supervisor if any services are enabled
|
|
if [ "$ENABLE_QUEUE_WORKER" = "true" ] || [ "$ENABLE_SCHEDULER" = "true" ]; then
|
|
echo "Starting supervisor..."
|
|
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf &
|
|
|
|
# Wait for supervisor to start
|
|
sleep 2
|
|
|
|
if [ "$ENABLE_QUEUE_WORKER" = "true" ]; then
|
|
echo "Starting Laravel queue worker..."
|
|
supervisorctl -c /etc/supervisor/conf.d/supervisord.conf start laravel-queue:*
|
|
fi
|
|
|
|
if [ "$ENABLE_SCHEDULER" = "true" ]; then
|
|
echo "Starting Laravel scheduler..."
|
|
supervisorctl -c /etc/supervisor/conf.d/supervisord.conf start laravel-scheduler:*
|
|
fi
|
|
fi
|
|
|
|
# exec php /app/artisan octane:frankenphp
|
|
exec php /app/artisan octane:start --server=frankenphp --host=0.0.0.0 --admin-port=2019 --port=8000
|