Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- Config, docs, scripts, and backup manifests - Submodule refs unchanged (m = modified content in submodules) Made-with: Cursor
49 lines
1.8 KiB
Bash
Executable File
49 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Deploy token-aggregation service for publication (token lists, CoinGecko/CMC reports).
|
|
# Run on explorer VM (VMID 5000) or host that serves explorer.d-bis.org.
|
|
#
|
|
# Prerequisites: Node 20+, PostgreSQL (for full indexing; report API may work with minimal config)
|
|
# Usage: ./scripts/deploy-token-aggregation-for-publication.sh [INSTALL_DIR]
|
|
#
|
|
# After deploy: Run apply-nginx-token-aggregation-proxy.sh to proxy /api/v1/ to this service.
|
|
|
|
set -euo pipefail
|
|
|
|
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
# Default: user-writable dir in repo (no sudo). Use /opt/token-aggregation with sudo for system install.
|
|
INSTALL_DIR="${1:-$REPO_ROOT/token-aggregation-build}"
|
|
SVC_DIR="$REPO_ROOT/smom-dbis-138/services/token-aggregation"
|
|
|
|
if [ ! -d "$SVC_DIR" ]; then
|
|
echo "Token-aggregation not found at $SVC_DIR" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "Deploying token-aggregation to $INSTALL_DIR"
|
|
mkdir -p "$INSTALL_DIR"
|
|
cp -a "$SVC_DIR"/* "$INSTALL_DIR/"
|
|
cd "$INSTALL_DIR"
|
|
|
|
if [ ! -f .env ]; then
|
|
if [ -f .env.example ]; then
|
|
cp .env.example .env
|
|
echo "Created .env from .env.example — edit with CUSDC_ADDRESS_138, CUSDT_ADDRESS_138, DATABASE_URL"
|
|
else
|
|
echo "Create .env with at least: CUSDC_ADDRESS_138, CUSDT_ADDRESS_138, CHAIN_138_RPC_URL"
|
|
fi
|
|
fi
|
|
|
|
npm install --omit=dev 2>/dev/null || npm install
|
|
npm run build 2>/dev/null || true
|
|
|
|
echo ""
|
|
echo "Token-aggregation built. Start with:"
|
|
echo " cd $INSTALL_DIR && node dist/index.js"
|
|
echo "Or add systemd unit. Default port: 3000"
|
|
echo ""
|
|
echo "Then apply nginx proxy (on same host):"
|
|
echo " TOKEN_AGG_PORT=3000 CONFIG_FILE=/etc/nginx/sites-available/blockscout \\"
|
|
echo " bash $REPO_ROOT/explorer-monorepo/scripts/apply-nginx-token-aggregation-proxy.sh"
|
|
echo ""
|
|
echo "Verify: curl -s https://explorer.d-bis.org/api/v1/report/token-list?chainId=138 | jq '.tokens | length'"
|