diff --git a/backend/wait-for-db.sh b/backend/wait-for-db.sh index 24be434..802fb3a 100755 --- a/backend/wait-for-db.sh +++ b/backend/wait-for-db.sh @@ -43,6 +43,13 @@ done >&2 echo "Target database \"$target_db\" is ready." +# Ensure storage directories exist with proper permissions (Issue #67 fix) +# When host directories are bind-mounted, the container's built-in directories are overridden +# This ensures the required directory structure exists before the application starts +echo "Ensuring storage directories exist..." +STORAGE_BASE="${STORAGE_PATH:-/app/storage}" +mkdir -p "$STORAGE_BASE/events/active" "$STORAGE_BASE/events/archived" "$STORAGE_BASE/thumbnails" 2>/dev/null || true + # Run migrations (use safe runner in production) echo "Running database migrations..." if [ "$NODE_ENV" = "production" ]; then diff --git a/scripts/picpeak-setup.sh b/scripts/picpeak-setup.sh index f85a8d1..554f00f 100755 --- a/scripts/picpeak-setup.sh +++ b/scripts/picpeak-setup.sh @@ -823,8 +823,8 @@ EOF create_systemd_services() { log_step "Creating systemd services..." - - # Backend service + + # Backend service (includes workers - fileWatcher, expirationChecker are started by server.js) cat > /etc/systemd/system/picpeak-backend.service < /etc/systemd/system/picpeak-workers.service <