- Restore original HTTPS config in docker-compose files (gunicorn + gevent DOES support SSL) - Add plugin migration step to docker-entrypoint.sh (fixes missing plugin tables on first deploy) - Install only core plugins on bootstrap (backups, computers, endpoints, guides, knowledgebase, machines, network, notifications, printers, slides, tools, warranty) - Set FLASK_ENV=production to disable Werkzeug debugger Bug: bootstrap-plugins.sh installed ALL plugins but didn't run migrations, causing 'Table does not exist' errors. Now installs core plugins only and runs 'flask plugin upgrade-all' after bootstrap. Optional plugins (employees, geenforce, measuringtools, printedparts, usb) can be installed later via Settings > Plugins. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
42 lines
1.1 KiB
Bash
42 lines
1.1 KiB
Bash
#!/bin/bash
|
|
# Docker container entrypoint for ShopDB Flask.
|
|
# Runs migrations, bootstraps plugins on first deployment, then starts the app.
|
|
|
|
set -e
|
|
|
|
echo "==> ShopDB Flask Container Starting"
|
|
|
|
# Wait for database to be ready (optional, useful with docker-compose)
|
|
if [ -n "$DATABASE_URL" ]; then
|
|
echo "==> Waiting for database..."
|
|
for i in {1..30}; do
|
|
if flask db current &>/dev/null; then
|
|
echo "==> Database ready"
|
|
break
|
|
fi
|
|
echo " Attempt $i/30: database not ready, waiting..."
|
|
sleep 2
|
|
done
|
|
fi
|
|
|
|
# Run migrations
|
|
echo "==> Running database migrations"
|
|
flask db upgrade || {
|
|
echo "ERROR: Database migrations failed"
|
|
exit 1
|
|
}
|
|
|
|
# Bootstrap plugins on first deployment
|
|
echo "==> Checking plugin installation"
|
|
/app/scripts/bootstrap-plugins.sh
|
|
|
|
# Run plugin migrations after bootstrap (creates tables for enabled plugins)
|
|
# Safe to run even if no plugins are enabled - it will just do nothing
|
|
echo "==> Running plugin migrations"
|
|
flask plugin upgrade-all || {
|
|
echo "WARNING: Plugin migrations failed - some features may not work"
|
|
}
|
|
|
|
echo "==> Starting application"
|
|
exec "$@"
|