Sync workspace: config, docs, scripts, CI, operator rules, and submodule pointers.
- Update dbis_core, cross-chain-pmm-lps, explorer-monorepo, metamask-integration, pr-workspace/chains - Omit embedded publish git dirs and empty placeholders from index Made-with: Cursor
This commit is contained in:
57
scripts/deployment/push-token-aggregation-bundle-to-explorer.sh
Executable file
57
scripts/deployment/push-token-aggregation-bundle-to-explorer.sh
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copy a local publication bundle (from deploy-token-aggregation-for-publication.sh) to the explorer host
|
||||
# and optionally restart systemd. Run from repo root on LAN.
|
||||
#
|
||||
# Prereq:
|
||||
# bash scripts/deploy-token-aggregation-for-publication.sh "$PWD/token-aggregation-build"
|
||||
#
|
||||
# Usage:
|
||||
# EXPLORER_SSH=root@192.168.11.140 REMOTE_DIR=/opt/token-aggregation \
|
||||
# bash scripts/deployment/push-token-aggregation-bundle-to-explorer.sh /path/to/token-aggregation-build
|
||||
#
|
||||
# Env:
|
||||
# EXPLORER_SSH default root@192.168.11.140
|
||||
# REMOTE_DIR default /opt/token-aggregation
|
||||
# REMOTE_SERVICE systemd unit to restart (default: token-aggregation); empty to skip restart
|
||||
# SYNC_REMOTE_ENV set to 1 to allow bundle .env to overwrite remote .env (default: preserve remote env)
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
BUNDLE_ROOT="${1:?Usage: $0 /path/to/token-aggregation-build}"
|
||||
SERVICE_SRC="$BUNDLE_ROOT/smom-dbis-138/services/token-aggregation"
|
||||
EXPLORER_SSH="${EXPLORER_SSH:-root@192.168.11.140}"
|
||||
REMOTE_DIR="${REMOTE_DIR:-/opt/token-aggregation}"
|
||||
REMOTE_SERVICE="${REMOTE_SERVICE:-token-aggregation}"
|
||||
SYNC_REMOTE_ENV="${SYNC_REMOTE_ENV:-0}"
|
||||
|
||||
if [[ ! -d "$SERVICE_SRC" || ! -f "$SERVICE_SRC/dist/index.js" ]]; then
|
||||
echo "Expected built service at $SERVICE_SRC (run deploy-token-aggregation-for-publication.sh first)." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Rsync $SERVICE_SRC/ → ${EXPLORER_SSH}:${REMOTE_DIR}/"
|
||||
rsync_args=(
|
||||
-avz
|
||||
--delete
|
||||
--exclude '.git'
|
||||
--exclude 'src'
|
||||
--exclude '*.test.ts'
|
||||
)
|
||||
|
||||
if [[ "$SYNC_REMOTE_ENV" != "1" ]]; then
|
||||
rsync_args+=(--exclude '.env' --exclude '.env.local')
|
||||
echo "Preserving remote .env files (set SYNC_REMOTE_ENV=1 to overwrite them)."
|
||||
fi
|
||||
|
||||
RSYNC_RSH="ssh -o BatchMode=yes" rsync "${rsync_args[@]}" \
|
||||
"$SERVICE_SRC/" "${EXPLORER_SSH}:${REMOTE_DIR}/"
|
||||
|
||||
if [[ -n "$REMOTE_SERVICE" ]]; then
|
||||
echo "Restart ${REMOTE_SERVICE} on ${EXPLORER_SSH}..."
|
||||
ssh -o BatchMode=yes "$EXPLORER_SSH" "systemctl restart '${REMOTE_SERVICE}'" || {
|
||||
echo "systemctl restart failed (unit may differ). Start manually: cd $REMOTE_DIR && node dist/index.js" >&2
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
|
||||
echo "Done. Verify: BASE_URL=https://explorer.d-bis.org pnpm run verify:token-aggregation-api"
|
||||
Reference in New Issue
Block a user