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:
62
cfg/sample/ctrl/deploy.sh
Executable file
62
cfg/sample/ctrl/deploy.sh
Executable 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"
|
||||
Reference in New Issue
Block a user