Files
mono/deploy.sh
giles fa431ee13e Split cart into 4 microservices: relations, likes, orders, page-config→blog
Phase 1 - Relations service (internal): owns ContainerRelation, exposes
get-children data + attach/detach-child actions. Retargeted events, blog,
market callers from cart to relations.

Phase 2 - Likes service (internal): unified Like model replaces ProductLike
and PostLike with generic target_type/target_slug/target_id. Exposes
is-liked, liked-slugs, liked-ids data + toggle action.

Phase 3 - PageConfig → blog: moved ownership to blog with direct DB queries,
removed proxy endpoints from cart.

Phase 4 - Orders service (public): owns Order/OrderItem + SumUp checkout
flow. Cart checkout now delegates to orders via create-order action.
Webhook/return routes and reconciliation moved to orders.

Phase 5 - Infrastructure: docker-compose, deploy.sh, Dockerfiles updated
for all 3 new services. Added orders_url helper and factory model imports.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 09:03:33 +00:00

57 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
REGISTRY="registry.rose-ash.com:5000"
APPS="blog market cart events federation account relations likes orders"
usage() {
echo "Usage: deploy.sh [app ...]"
echo " deploy.sh blog # rebuild + restart blog only"
echo " deploy.sh blog market # rebuild + restart blog and market"
echo " deploy.sh --all # rebuild + restart all apps"
echo " deploy.sh # auto-detect changed apps via git"
exit 1
}
cd "$(dirname "$0")"
# Determine which apps to build
if [ $# -eq 0 ]; then
# Auto-detect: uncommitted changes + last commit
CHANGED=$(git diff --name-only HEAD 2>/dev/null; git diff --name-only HEAD~1 HEAD 2>/dev/null || true)
BUILD=()
if echo "$CHANGED" | grep -q "^shared/"; then
BUILD=($APPS)
else
for app in $APPS; do
if echo "$CHANGED" | grep -q "^$app/"; then
BUILD+=("$app")
fi
done
fi
if [ ${#BUILD[@]} -eq 0 ]; then
echo "No app changes detected. Pass app names or --all."
exit 0
fi
elif [ "$1" = "--all" ]; then
BUILD=($APPS)
elif [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
usage
else
BUILD=("$@")
fi
echo "Building: ${BUILD[*]}"
echo ""
for app in "${BUILD[@]}"; do
echo "=== $app ==="
docker build -f "$app/Dockerfile" -t "$REGISTRY/$app:latest" .
docker push "$REGISTRY/$app:latest"
docker service update --force "coop_$app" 2>/dev/null \
|| echo " (service coop_$app not running — will start on next stack deploy)"
echo ""
done
echo "Done."