taskmanager/startup.sh
2025-11-12 17:16:01 +01:00

36 lines
828 B
Bash

#!/bin/sh
set -e
echo "========================================="
echo "Aufgabenplaner Startup Script"
echo "========================================="
echo ""
echo "Waiting for database..."
until PGPASSWORD=$DB_PASSWORD psql -h "db" -U "aufgabenplaner" -d "aufgabenplaner_db" -c '\q' 2>/dev/null; do
>&2 echo "Postgres is unavailable - sleeping"
sleep 1
done
echo "✓ Database is ready!"
echo ""
echo "Running Prisma migrations..."
npx prisma migrate deploy
echo "✓ Migrations completed!"
echo ""
echo "Seeding database (if needed)..."
npx prisma db seed || {
echo "⚠ Seeding skipped or failed (this is ok if database is already seeded)"
}
echo ""
echo "========================================="
echo "Starting Next.js application..."
echo "========================================="
echo ""
node server.js