Files
shopdb-flask/start-docker-full.sh
Proudlock 128bdabcb4 Add production readiness assessment - honest evaluation
ASSESSMENT: Current Docker source build is NOT production-ready.

Too complex:
- 10+ manual setup steps
- Zscaler cert extraction required
- 15+ minute build times
- 3-container backup orchestration
- Manual plugin installation
- Scattered documentation

RECOMMENDATIONS:
- West Jefferson: Use IIS + Windows Services (simplest)
- New sites: Pre-built Docker images from registry (needs CI/CD)
- Source build: Development only, not for operations

Code is solid. Deployment automation needs 2-3 weeks investment.

Created honest assessment document explaining why current approach
is too complex and what's needed for true production readiness.
2026-09-07 00:05:37 -04:00

92 lines
2.8 KiB
Bash

#!/bin/bash
# Start complete ShopDB Docker stack with backup system
# This script brings up the full stack including the backup watcher
set -e
echo "==> Starting ShopDB Full Docker Stack"
echo ""
# Check if .env exists
if [ ! -f .env ]; then
echo "ERROR: .env file not found. Copy .env.docker-dev to .env first."
exit 1
fi
# Check if certs exist
if [ ! -f certs/server.crt ] || [ ! -f certs/server.key ]; then
echo "ERROR: TLS certificates not found in certs/"
echo "Generate them with:"
echo " cd certs && openssl req -x509 -newkey rsa:2048 -nodes -keyout server.key -out server.crt -days 365 -subj '//CN=localhost'"
exit 1
fi
# Build if needed
echo "==> Building images (if needed)..."
docker compose build
# Start base stack + backup services
echo "==> Starting services (db, api, backup-store, backup-watcher)..."
docker compose -f docker-compose.yml -f docker-compose.backup.yml --profile backup up -d
# Wait for services to be healthy
echo ""
echo "==> Waiting for services to be ready..."
sleep 10
# Check status
echo ""
echo "==> Service Status:"
docker compose ps
# Initialize database if needed
echo ""
echo "==> Running database migrations..."
docker compose exec api flask db upgrade || true
# Check if plugins are installed
echo ""
echo "==> Checking plugin installation..."
PLUGIN_COUNT=$(docker compose exec -T api flask plugin list 2>/dev/null | grep -c "^\s\+\w" || echo "0")
if [ "$PLUGIN_COUNT" -lt 10 ]; then
echo "==> Installing all plugins..."
docker compose exec api flask plugin apply-profile deploy/site-profile-universal.json
else
echo "==> Plugins already installed ($PLUGIN_COUNT found)"
fi
echo ""
echo "==================================="
echo "ShopDB Docker Stack is running!"
echo "==================================="
echo ""
echo "Access ShopDB at: https://localhost:5001"
echo ""
echo "Services:"
echo " - MySQL Database: db (port 3306 internal)"
echo " - Flask API: api (https://localhost:5001)"
echo " - Backup Store: backup-store (isolated)"
echo " - Backup Watcher: backup-watcher (polls every ${BACKUP_POLL_SECONDS:-30}s)"
echo ""
echo "Volumes:"
echo " - db_data: MySQL database"
echo " - instance_data: Uploaded files, plugin state"
echo " - backup_data: Backup sets"
echo " - backupstore_data: Restic repository"
echo ""
echo "Next steps:"
echo " 1. Browse to https://localhost:5001 (accept self-signed cert warning)"
echo " 2. Login as 'admin' (reset password if needed)"
echo " 3. Go to Settings > Plugins to enable plugins"
echo " 4. Go to Settings > Backups to test backup system"
echo ""
echo "To view logs:"
echo " docker compose logs -f api"
echo " docker compose logs -f backup-watcher"
echo ""
echo "To trigger a backup:"
echo " - Via UI: Settings > Backups > 'Back Up Now'"
echo " - Via CLI: docker compose run --rm backup"
echo ""