Files
ben f42d124593 Harden stuck Whisper recovery and record transcription duration.
Fail jobs on timeout, treat stale reserved queue rows as orphans, skip migrate/seed on queue/reverb boot, and store how long each successful run took.
2026-08-13 00:12:06 +02:00

58 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
set -eu
cd /app
mkdir -p \
database \
storage/app/private/recordings \
storage/app/public \
storage/framework/cache \
storage/framework/sessions \
storage/framework/views \
storage/logs \
bootstrap/cache
if [ ! -f database/database.sqlite ]; then
touch database/database.sqlite
fi
# Production images should not honor a leftover Vite HMR file from the host.
# Development bind mounts keep public/hot so the Vite container can drive assets.
if [ "${KEEP_VITE_HOT:-false}" != "true" ]; then
rm -f public/hot
fi
# Bind mounts may arrive as root-owned; keep the app and host tooling writable.
chmod -R a+rwX database storage bootstrap/cache 2>/dev/null || true
if [ -z "${APP_KEY:-}" ]; then
echo "APP_KEY is not set. Generate one with: php artisan key:generate --show" >&2
exit 1
fi
# Bind-mounted trees may lack vendor/ (image files are shadowed by the mount).
if [ ! -f vendor/autoload.php ]; then
composer install --prefer-dist --no-interaction
fi
# Only the web app should migrate/seed. Queue and Reverb share the DB and must
# not race on sqlite (locks) or re-seed on every restart/deploy.
should_bootstrap_db() {
case " $* " in
*" queue:work "*|*" queue:listen "*|*" reverb:start "*)
return 1
;;
*)
return 0
;;
esac
}
if should_bootstrap_db "$@"; then
php artisan migrate --force --no-interaction
php artisan db:seed --force --no-interaction
fi
exec "$@"