eigent/server/start.sh

36 lines
1.1 KiB
Bash

#!/bin/sh
# ── Stale image detection ─────────────────────────────────────────────
# The Dockerfile bakes a build timestamp into /app/.image_env.
# On startup we display it so developers can tell at a glance whether
# their image is fresh or stale after a git pull.
if [ -f /app/.image_env ]; then
. /app/.image_env
fi
if [ -n "$EIGENT_IMAGE_BUILD_TIME" ]; then
echo ""
echo "========================================"
echo " Image built at: $EIGENT_IMAGE_BUILD_TIME"
echo ""
echo " If you have pulled new server code,"
echo " please rebuild the image:"
echo " docker-compose up --build -d"
echo "========================================"
echo ""
fi
# wait for database to be ready
echo "Waiting for database to be ready..."
while ! nc -z postgres 5432; do
sleep 1
done
echo "Database is ready!"
# run database migrations
echo "Running database migrations..."
uv run alembic upgrade head
# start application
echo "Starting application..."
exec uv run uvicorn main:api --host 0.0.0.0 --port 5678