add fixture-invoicing example, sample-room wrap, kind cluster support

- examples/fixture-invoicing/: FastAPI + Vue + Postgres demo (4-entity invoice fixture)
- cfg/sample/: wraps the fixture (managed.repos points at examples/)
- ctrl/kind-{up,down,status}.sh + per-room k8s render in soleprint/ctrl/k8s/
- build.py: relative repo paths, resilient rmtree, optional k8s render hook
- cfg/.gitignore: stop ignoring sample/ and standalone/ template rooms

Manifests render cleanly but kind cluster has not been run end-to-end yet.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-29 05:30:52 -03:00
parent b886455431
commit 5f9cac1947
78 changed files with 3025 additions and 201 deletions

62
cfg/sample/ctrl/deploy.sh Executable file
View File

@@ -0,0 +1,62 @@
#!/bin/bash
# Deploy dlt to AWS
#
# Usage:
# ./ctrl/deploy.sh # Sync and restart
# ./ctrl/deploy.sh --rebuild # Rebuild container image
# ./ctrl/deploy.sh --dry-run # Preview sync
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
ROOM_DIR="$(dirname "$SCRIPT_DIR")"
ROOM_NAME="$(basename "$ROOM_DIR")"
SPR_DIR="$(cd "$ROOM_DIR/../.." && pwd)"
SERVER="${DEPLOY_SERVER:-mcrn.ar}"
REMOTE_BASE="${DEPLOY_REMOTE_PATH:-~/soleprint/gen}"
REMOTE_PATH="$REMOTE_BASE/$ROOM_NAME/soleprint"
LOCAL_PATH="$SPR_DIR/gen/$ROOM_NAME/soleprint"
DRY_RUN=""
REBUILD=""
[ "$1" == "--dry-run" ] && DRY_RUN="--dry-run"
[ "$1" == "--rebuild" ] && REBUILD="--build"
# Check if built
if [[ ! -d "$LOCAL_PATH" ]]; then
echo "Error: $LOCAL_PATH not found"
echo "Build first: cd $SPR_DIR && python build.py --cfg $ROOM_NAME"
exit 1
fi
echo "=== Deploying $ROOM_NAME to $SERVER ==="
# Sync files, excluding local-only
rsync -avz --delete --progress $DRY_RUN \
--exclude='.env' \
--exclude='__pycache__/' \
--exclude='*.pyc' \
--exclude='**/storage/' \
"$LOCAL_PATH/" \
"$SERVER:$REMOTE_PATH/"
if [ -n "$DRY_RUN" ]; then
echo "=== Dry run complete ==="
exit 0
fi
# Get container name from AWS .env
CONTAINER_NAME=$(ssh "$SERVER" "grep DEPLOYMENT_NAME $REMOTE_PATH/.env 2>/dev/null | cut -d= -f2" || echo "${ROOM_NAME}_spr")
echo ""
echo "=== Restarting $CONTAINER_NAME ==="
ssh "$SERVER" "cd $REMOTE_PATH && docker compose down && docker compose up -d $REBUILD"
echo ""
echo "=== Connecting to gateway network ==="
ssh "$SERVER" "docker network connect gateway $CONTAINER_NAME 2>/dev/null || true"
echo ""
echo "=== Done ==="
echo "Test at: https://$ROOM_NAME.spr.mcrn.ar"

View File

@@ -1,28 +1,45 @@
#!/bin/bash
# Start all sample services
# Usage: ./ctrl/start.sh [-d]
# Start sample room (fixture invoicing + link + soleprint)
#
# Usage:
# ./start.sh # Start all (foreground, with nginx)
# ./start.sh -d # Start all (detached)
# ./start.sh --no-nginx # Skip nginx reverse proxy
# ./start.sh --build # Rebuild images
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
APP_DIR="$ROOT_DIR/sample"
LINK_DIR="$ROOT_DIR/link"
SPR_DIR="$ROOT_DIR/soleprint"
BUILD=""
DETACH=""
if [[ "$1" == "-d" ]]; then
DETACH="-d"
NGINX_OVERRIDE="-f docker-compose.nginx.yml"
for arg in "$@"; do
case $arg in
-d|--detached) DETACH="-d" ;;
--build) BUILD="--build" ;;
--no-nginx) NGINX_OVERRIDE="" ;;
esac
done
# Ensure shared docker network exists (soleprint + managed app share it)
NETWORK="$(grep -m1 '^NETWORK_NAME=' "$APP_DIR/.env" | cut -d= -f2)"
docker network inspect "$NETWORK" >/dev/null 2>&1 || docker network create "$NETWORK"
echo "=== Starting sample ==="
# 1) Managed app (db + backend + frontend)
(cd "$APP_DIR" && docker compose up -d $BUILD)
# 2) Link bridge
if [[ -f "$LINK_DIR/docker-compose.yml" ]]; then
(cd "$LINK_DIR" && docker compose --env-file "$APP_DIR/.env" up -d $BUILD)
fi
echo "=== Starting sample services ==="
# Start soleprint
echo "Starting soleprint..."
cd "$ROOT_DIR/soleprint"
docker compose up $DETACH &
# Start sample app
if [[ -f "$ROOT_DIR/sample/docker-compose.yml" ]]; then
echo "Starting sample app..."
cd "$ROOT_DIR/sample"
docker compose up $DETACH &
fi
wait
echo "=== All services started ==="
# 3) Soleprint (+ nginx sidebar injection)
(cd "$SPR_DIR" && docker compose -f docker-compose.yml $NGINX_OVERRIDE up $DETACH $BUILD)

View File

@@ -1,22 +1,15 @@
#!/bin/bash
# Stop all sample services
# Usage: ./ctrl/stop.sh
# Stop sample room
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
echo "=== Stopping sample services ==="
echo "=== Stopping sample ==="
# Stop sample app
if [[ -f "$ROOT_DIR/sample/docker-compose.yml" ]]; then
echo "Stopping sample app..."
cd "$ROOT_DIR/sample"
docker compose down
fi
# Stop soleprint
echo "Stopping soleprint..."
cd "$ROOT_DIR/soleprint"
docker compose down
echo "=== All services stopped ==="
for d in "$ROOT_DIR/soleprint" "$ROOT_DIR/link" "$ROOT_DIR/sample"; do
if [[ -f "$d/docker-compose.yml" ]]; then
(cd "$d" && docker compose down)
fi
done