Critical bug fix: Path(__file__).parent.parent returns a relative path, causing the database to be created in different locations depending on the working directory. This caused data loss on container restarts. Changes: - Add .resolve() to BASE_DIR in src/config.py and migrations/env.py - Fix admin dashboard showing 0 for participant count (was hardcoded) - Fix exchange detail page to show actual participant list - Add startup diagnostics to entrypoint.sh for troubleshooting 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
35 lines
924 B
Bash
Executable File
35 lines
924 B
Bash
Executable File
#!/bin/bash
|
|
set -e # Exit on any error
|
|
|
|
# Ensure data directory exists
|
|
mkdir -p /app/data
|
|
|
|
echo "=== Sneaky Klaus Container Startup ==="
|
|
echo "Data directory: /app/data"
|
|
echo "Database path: /app/data/sneaky-klaus.db"
|
|
|
|
# Check if database exists
|
|
if [ -f /app/data/sneaky-klaus.db ]; then
|
|
echo "Existing database found ($(ls -lh /app/data/sneaky-klaus.db | awk '{print $5}'))"
|
|
else
|
|
echo "No existing database - will be created by migrations"
|
|
fi
|
|
|
|
# List contents of data directory
|
|
echo "Data directory contents:"
|
|
ls -la /app/data/ || echo "(empty)"
|
|
|
|
echo ""
|
|
echo "Running database migrations..."
|
|
if uv run alembic upgrade head; then
|
|
echo "Database migrations completed successfully"
|
|
else
|
|
echo "ERROR: Database migration failed!"
|
|
echo "Please check the logs above for details."
|
|
exit 1
|
|
fi
|
|
|
|
echo ""
|
|
echo "Starting application server..."
|
|
exec gunicorn --bind 0.0.0.0:8000 --workers 2 --threads 4 main:app
|