Files
shopdb-flask/scripts/bootstrap-plugins.sh
Proudlock 316bc81a4c Add automatic plugin installation on first Docker deployment
- Add docker-entrypoint.sh: runs migrations and bootstraps plugins
- Add bootstrap-plugins.sh: installs all plugins (disabled by default)
- Update Dockerfile to use entrypoint
- Plugins can now be enabled via Settings UI after first deployment
- Idempotent: safe to run multiple times
- Solves issue where imported prod databases had tables but no plugin registry
2026-09-06 23:01:06 -04:00

28 lines
909 B
Bash

#!/bin/bash
# Bootstrap plugin installation on first deployment.
# Installs all available plugins but leaves them disabled, so admins can
# enable what they need via Settings UI. Idempotent: safe to run multiple times.
set -e
REGISTRY_FILE="/app/instance/plugins.json"
if [ ! -f "$REGISTRY_FILE" ]; then
echo "==> First deployment detected: installing all available plugins (disabled by default)"
# Get list of all available plugins
PLUGINS=$(flask plugin list 2>/dev/null | grep -E '^\s+\w+\s+v[0-9]' | awk '{print $1}')
for plugin in $PLUGINS; do
echo " Installing $plugin..."
flask plugin install "$plugin" || {
echo " WARNING: Failed to install $plugin, skipping"
continue
}
done
echo "==> All plugins installed (disabled). Enable them in Settings > Plugins"
else
echo "==> Plugin registry exists, skipping bootstrap"
fi