26 lines
829 B
Bash
26 lines
829 B
Bash
|
|
#!/bin/sh
|
||
|
|
set -e
|
||
|
|
|
||
|
|
cd /app
|
||
|
|
|
||
|
|
# Storage must be writable at runtime (Coolify may mount a fresh volume).
|
||
|
|
mkdir -p storage/framework/sessions storage/framework/views storage/framework/cache/data storage/logs bootstrap/cache
|
||
|
|
chown -R www-data:www-data storage bootstrap/cache
|
||
|
|
|
||
|
|
# Migrate before serving, but never leave the container crash-looping on a
|
||
|
|
# temporarily unavailable DB: retry a few times, then start anyway and let the
|
||
|
|
# health endpoint report the state.
|
||
|
|
i=0
|
||
|
|
until php artisan migrate --force --no-ansi; do
|
||
|
|
i=$((i+1))
|
||
|
|
if [ "$i" -ge 5 ]; then
|
||
|
|
echo "festbench-web: migrations failed after 5 attempts, starting anyway" >&2
|
||
|
|
break
|
||
|
|
fi
|
||
|
|
echo "festbench-web: migrate failed (attempt $i), retrying in 3s…" >&2
|
||
|
|
sleep 3
|
||
|
|
done
|
||
|
|
|
||
|
|
php artisan optimize --no-ansi || true
|
||
|
|
|
||
|
|
exec frankenphp run --config /etc/caddy/Caddyfile
|