Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m16s
CI/CD Pipeline / Security Scanning (push) Successful in 2m39s
CI/CD Pipeline / Lint and Format (push) Failing after 48s
CI/CD Pipeline / Terraform Validation (push) Failing after 26s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 29s
Deploy ChainID 138 / Deploy ChainID 138 (push) Failing after 42s
Validation / validate-genesis (push) Has started running
Validation / validate-terraform (push) Has been cancelled
Validation / validate-kubernetes (push) Has been cancelled
Validation / validate-smart-contracts (push) Has been cancelled
Validation / validate-security (push) Has been cancelled
Validation / validate-documentation (push) Has been cancelled
Verify Deployment / Verify Deployment (push) Failing after 1m19s
Use fuser to free the listen port when pkill misses orphaned node processes. Co-authored-by: Cursor <cursoragent@cursor.com>
116 lines
3.9 KiB
Bash
116 lines
3.9 KiB
Bash
#!/usr/bin/env bash
|
|
# OMNL Bank — production deploy on server (128-chain, Office 24)
|
|
set -euo pipefail
|
|
|
|
REPO_DIR="${OMNL_BANK_ROOT:-$HOME/smom-dbis-138}"
|
|
BRANCH="${OMNL_BANK_BRANCH:-main}"
|
|
LOG_DIR="${OMNL_BANK_LOG_DIR:-$HOME/omnl-bank/logs}"
|
|
ENV_FILE="${OMNL_BANK_ENV:-$REPO_DIR/.env}"
|
|
|
|
log() { echo "[$(date -Iseconds)] $*"; }
|
|
|
|
mkdir -p "$LOG_DIR"
|
|
|
|
if [ ! -d "$REPO_DIR/.git" ]; then
|
|
log "Cloning smom-dbis-138..."
|
|
git clone "https://gitea.d-bis.org/d-bis/smom-dbis-138.git" "$REPO_DIR"
|
|
fi
|
|
|
|
cd "$REPO_DIR"
|
|
log "Pull latest ($BRANCH)..."
|
|
git fetch origin
|
|
git checkout "$BRANCH"
|
|
git pull --ff-only origin "$BRANCH"
|
|
|
|
log "Generate 128-chain registry..."
|
|
node scripts/generate-omnl-128-chains.mjs
|
|
|
|
export SETTLEMENT_MIDDLEWARE_CONFIG="${SETTLEMENT_MIDDLEWARE_CONFIG:-$REPO_DIR/config/settlement-middleware.production.v1.json}"
|
|
export DBIS_EXCHANGE_CONFIG="${DBIS_EXCHANGE_CONFIG:-$REPO_DIR/config/dbis-exchange.production.v1.json}"
|
|
export OMNL_SUPPORTED_CHAINS_CONFIG="${OMNL_SUPPORTED_CHAINS_CONFIG:-$REPO_DIR/config/omnl-supported-chains.v1.json}"
|
|
export OMNL_M2_TOKEN_REGISTRY="${OMNL_M2_TOKEN_REGISTRY:-$REPO_DIR/config/omnl-m2-token-registry.v1.json}"
|
|
|
|
if [ -f "$ENV_FILE" ]; then
|
|
set -a
|
|
# shellcheck disable=SC1090
|
|
source "$ENV_FILE"
|
|
set +a
|
|
fi
|
|
|
|
build_pkg() {
|
|
local dir="$1"
|
|
log "Building $dir..."
|
|
cd "$REPO_DIR/$dir"
|
|
npm install --no-fund --no-audit
|
|
npm run build
|
|
}
|
|
|
|
for dir in packages/integration-foundation packages/settlement-core \
|
|
services/token-aggregation services/settlement-middleware services/dbis-exchange; do
|
|
build_pkg "$dir"
|
|
done
|
|
|
|
log "Building frontend..."
|
|
cd "$REPO_DIR/frontend-dapp"
|
|
if command -v pnpm >/dev/null 2>&1; then
|
|
pnpm install --frozen-lockfile 2>/dev/null || pnpm install
|
|
pnpm run build
|
|
else
|
|
npm install
|
|
npm run build
|
|
fi
|
|
|
|
start_svc() {
|
|
local name="$1"
|
|
local dir="$2"
|
|
local port="$3"
|
|
local cmd="$4"
|
|
log "Starting $name on :$port"
|
|
cd "$REPO_DIR/$dir"
|
|
pkill -f "smom-dbis-138/$dir" 2>/dev/null || true
|
|
fuser -k "${port}/tcp" 2>/dev/null || true
|
|
sleep 1
|
|
nohup env \
|
|
SETTLEMENT_MIDDLEWARE_CONFIG="$SETTLEMENT_MIDDLEWARE_CONFIG" \
|
|
DBIS_EXCHANGE_CONFIG="$DBIS_EXCHANGE_CONFIG" \
|
|
OMNL_SUPPORTED_CHAINS_CONFIG="$OMNL_SUPPORTED_CHAINS_CONFIG" \
|
|
OMNL_M2_TOKEN_REGISTRY="$OMNL_M2_TOKEN_REGISTRY" \
|
|
OMNL_API_KEY="${OMNL_API_KEY:-}" \
|
|
OMNL_FINERACT_BASE_URL="${OMNL_FINERACT_BASE_URL:-${FINERACT_BASE_URL:-}}" \
|
|
OMNL_FINERACT_TENANT="${OMNL_FINERACT_TENANT:-${FINERACT_TENANT:-omnl}}" \
|
|
OMNL_FINERACT_USERNAME="${OMNL_FINERACT_USERNAME:-}" \
|
|
OMNL_FINERACT_PASSWORD="${OMNL_FINERACT_PASSWORD:-}" \
|
|
OMNL_PUBLIC_MONEY_SUPPLY="${OMNL_PUBLIC_MONEY_SUPPLY:-1}" \
|
|
bash -c "$cmd" >"$LOG_DIR/$name.log" 2>&1 &
|
|
echo $! >"$LOG_DIR/$name.pid"
|
|
}
|
|
|
|
start_svc token-aggregation services/token-aggregation 3000 "npm run start"
|
|
sleep 2
|
|
start_svc settlement-middleware services/settlement-middleware 3011 "npm run start"
|
|
sleep 2
|
|
start_svc dbis-exchange services/dbis-exchange 3012 "npm run start"
|
|
sleep 2
|
|
|
|
FRONTEND_PORT="${OMNL_BANK_FRONTEND_PORT:-3002}"
|
|
pkill -f "serve -s.*$FRONTEND_PORT" 2>/dev/null || true
|
|
cd "$REPO_DIR/frontend-dapp"
|
|
nohup npx --yes serve -s dist -l "$FRONTEND_PORT" >"$LOG_DIR/frontend.log" 2>&1 &
|
|
echo $! >"$LOG_DIR/frontend.pid"
|
|
|
|
sleep 5
|
|
log "Health checks..."
|
|
curl -sf "http://127.0.0.1:3011/api/v1/settlement/health" | head -c 200 || true
|
|
echo
|
|
curl -sf "http://127.0.0.1:3011/api/v1/settlement/money-supply/public" | head -c 300 || true
|
|
echo
|
|
curl -sf "http://127.0.0.1:3012/api/v1/exchange/health" | head -c 200 || true
|
|
echo
|
|
curl -sf -o /dev/null -w "frontend=%{http_code}\n" "http://127.0.0.1:$FRONTEND_PORT/central-bank"
|
|
|
|
log "OMNL Bank deploy complete"
|
|
log " Central Bank: http://127.0.0.1:$FRONTEND_PORT/central-bank"
|
|
log " Office 24: http://127.0.0.1:$FRONTEND_PORT/office-24"
|
|
log " DBIS Trade: http://127.0.0.1:$FRONTEND_PORT/trade"
|
|
log " 128 chains: http://127.0.0.1:3011/api/v1/settlement/chains"
|