Fix Docker deployment: restore HTTPS, auto-run plugin migrations, install core plugins only
- 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>
This commit is contained in:
@@ -47,18 +47,29 @@ services:
|
|||||||
db:
|
db:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
command: >
|
command:
|
||||||
gunicorn
|
- gunicorn
|
||||||
--bind 0.0.0.0:5001
|
- --bind
|
||||||
--workers 4
|
- 0.0.0.0:5001
|
||||||
--worker-class gevent
|
- --worker-class
|
||||||
--worker-connections 2000
|
- gevent
|
||||||
--timeout 300
|
- --workers
|
||||||
--certfile /app/certs/server.crt
|
- "4"
|
||||||
--keyfile /app/certs/server.key
|
- --worker-connections
|
||||||
--access-logfile -
|
- "2000"
|
||||||
--error-logfile -
|
- --timeout
|
||||||
wsgi:app
|
- "60"
|
||||||
|
- --access-logfile
|
||||||
|
- "-"
|
||||||
|
- --access-logformat
|
||||||
|
- '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s %(D)sus "%(f)s" "%(a)s"'
|
||||||
|
- --error-logfile
|
||||||
|
- "-"
|
||||||
|
- --certfile
|
||||||
|
- /app/certs/server.crt
|
||||||
|
- --keyfile
|
||||||
|
- /app/certs/server.key
|
||||||
|
- wsgi:app
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
db_data:
|
db_data:
|
||||||
|
|||||||
@@ -8,12 +8,13 @@ set -e
|
|||||||
REGISTRY_FILE="/app/instance/plugins.json"
|
REGISTRY_FILE="/app/instance/plugins.json"
|
||||||
|
|
||||||
if [ ! -f "$REGISTRY_FILE" ]; then
|
if [ ! -f "$REGISTRY_FILE" ]; then
|
||||||
echo "==> First deployment detected: installing all available plugins (disabled by default)"
|
echo "==> First deployment detected: installing core plugins"
|
||||||
|
|
||||||
# Get list of all available plugins
|
# Core plugins to install on first deployment
|
||||||
PLUGINS=$(flask plugin list 2>/dev/null | grep -E '^\s+\w+\s+v[0-9]' | awk '{print $1}')
|
# These provide essential ShopDB functionality
|
||||||
|
CORE_PLUGINS="backups computers endpoints guides knowledgebase machines network notifications printers slides tools warranty"
|
||||||
|
|
||||||
for plugin in $PLUGINS; do
|
for plugin in $CORE_PLUGINS; do
|
||||||
echo " Installing $plugin..."
|
echo " Installing $plugin..."
|
||||||
flask plugin install "$plugin" || {
|
flask plugin install "$plugin" || {
|
||||||
echo " WARNING: Failed to install $plugin, skipping"
|
echo " WARNING: Failed to install $plugin, skipping"
|
||||||
@@ -21,7 +22,7 @@ if [ ! -f "$REGISTRY_FILE" ]; then
|
|||||||
}
|
}
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "==> All plugins installed (disabled). Enable them in Settings > Plugins"
|
echo "==> Core plugins installed. Additional plugins (employees, geenforce, measuringtools, printedparts, usb) can be installed via Settings > Plugins"
|
||||||
else
|
else
|
||||||
echo "==> Plugin registry exists, skipping bootstrap"
|
echo "==> Plugin registry exists, skipping bootstrap"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -30,5 +30,12 @@ flask db upgrade || {
|
|||||||
echo "==> Checking plugin installation"
|
echo "==> Checking plugin installation"
|
||||||
/app/scripts/bootstrap-plugins.sh
|
/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"
|
echo "==> Starting application"
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user