Files
bootnode/infra/k8s/lux/deploy-subgraph.sh
zeekay 0aa9c4e346 feat: add Explorer + MPC product pages, fleet management, operator, Helm charts, and CI/CD
- Add Explorer product page with branded block explorer deployment, contract
  verification, Etherscan-compatible API, and multi-chain support
- Add MPC product page with deep Lux MPC integration: CGGMP21 (ECDSA),
  FROST (EdDSA), LSS resharing, 15+ chain support, threshold signing API
- Update landing page with 6-product grid (Node, Data, Wallets, Explorer,
  MPC, Rollups) and 8 API cards including Explorer API and MPC Signing
- Update navbar and command menu with Explorer and MPC products
- Add Lux fleet management dashboard, observability, and services pages
- Add AI chat component and unified navigation with org switcher
- Add Kubernetes operator (Rust) for multi-chain node lifecycle management
- Add Lux Helm charts with genesis configs for devnet/testnet/mainnet
- Add docker-release.yml CI/CD pipeline for automated DOKS deployment
- Add monitoring, network policies, web deployments, and ingress updates
- Refactor API: fleet management, billing tracker, observability endpoints
- Update brand config, API client, and infrastructure manifests
2026-03-12 14:48:40 -07:00

140 lines
4.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Deploy or redeploy a subgraph to the Lux graph-node.
#
# Usage:
# ./deploy-subgraph.sh # Deploy all subgraphs
# ./deploy-subgraph.sh amm-v3 # Deploy Lux AMM V3 only
# ./deploy-subgraph.sh zoo-amm-v3 # Deploy Zoo AMM V3 only
# ./deploy-subgraph.sh amm-v3 --wipe # Wipe and redeploy AMM V3
#
# Prerequisites:
# - graph-node running (k8s or local compose)
# - Port-forwards active or local compose ports
# - npx graph-cli available
#
# Environment variables:
# GRAPH_NODE_URL - Graph admin endpoint (default: http://localhost:18020)
# GRAPH_IPFS_URL - IPFS endpoint (default: http://localhost:15001)
# EXCHANGE_DIR - Exchange repo root (default: ~/work/lux/exchange)
set -euo pipefail
GRAPH_NODE_URL="${GRAPH_NODE_URL:-http://localhost:18020}"
GRAPH_IPFS_URL="${GRAPH_IPFS_URL:-http://localhost:15001}"
EXCHANGE_DIR="${EXCHANGE_DIR:-$HOME/work/lux/exchange}"
SUBGRAPH="${1:-all}"
WIPE="${2:-}"
deploy_subgraph() {
local name="$1"
local dir="$2"
local version="$3"
echo "=== Deploying $name (v$version) ==="
if [ "$WIPE" = "--wipe" ]; then
echo "Removing existing deployment..."
curl -sf -X POST "$GRAPH_NODE_URL" \
-H 'Content-Type: application/json' \
-d "{\"jsonrpc\":\"2.0\",\"method\":\"subgraph_remove\",\"params\":{\"name\":\"luxfi/$name\"},\"id\":1}" \
2>/dev/null || true
fi
# Create subgraph name (idempotent)
curl -sf -X POST "$GRAPH_NODE_URL" \
-H 'Content-Type: application/json' \
-d "{\"jsonrpc\":\"2.0\",\"method\":\"subgraph_create\",\"params\":{\"name\":\"luxfi/$name\"},\"id\":1}" \
2>/dev/null || true
# Build and deploy
cd "$dir"
npx graph codegen 2>&1 | tail -2
npx graph build 2>&1 | tail -2
npx graph deploy "luxfi/$name" \
--node "$GRAPH_NODE_URL" \
--ipfs "$GRAPH_IPFS_URL" \
--version-label "v$version" 2>&1 | tail -5
echo "Deployed luxfi/$name v$version"
echo ""
}
check_sync() {
local name="$1"
local query_url="${GRAPH_NODE_URL/18020/18000}"
# Replace admin port with query port
query_url="${query_url/8020/8000}"
echo "Checking sync status for luxfi/$name..."
curl -sf "$query_url/subgraphs/name/luxfi/$name" \
-H 'Content-Type: application/json' \
-d '{"query":"{ _meta { block { number } hasIndexingErrors } }"}' 2>/dev/null \
| python3 -m json.tool 2>/dev/null || echo "(not yet syncing)"
}
case "$SUBGRAPH" in
amm-v3)
deploy_subgraph "amm-v3" "$EXCHANGE_DIR/subgraphs/dex-v3" "2.1.0"
check_sync "amm-v3"
;;
zoo-amm-v3)
deploy_subgraph "zoo-amm-v3" "$EXCHANGE_DIR/subgraphs/zoo-v3" "1.0.0"
check_sync "zoo-amm-v3"
;;
pars-amm-v2)
if [ -d "$EXCHANGE_DIR/subgraphs/pars-v2" ]; then
deploy_subgraph "pars-amm-v2" "$EXCHANGE_DIR/subgraphs/pars-v2" "1.0.0"
check_sync "pars-amm-v2"
else
echo "Pars AMM V2 subgraph not found at $EXCHANGE_DIR/subgraphs/pars-v2"
fi
;;
hanzo-amm-v2)
if [ -d "$EXCHANGE_DIR/subgraphs/hanzo-v2" ]; then
deploy_subgraph "hanzo-amm-v2" "$EXCHANGE_DIR/subgraphs/hanzo-v2" "1.0.0"
check_sync "hanzo-amm-v2"
else
echo "Hanzo AMM V2 subgraph not found at $EXCHANGE_DIR/subgraphs/hanzo-v2"
fi
;;
zoo-amm-v2)
deploy_subgraph "zoo-amm-v2" "$EXCHANGE_DIR/subgraphs/zoo-v2" "1.0.0"
check_sync "zoo-amm-v2"
;;
amm-v2)
if [ -d "$EXCHANGE_DIR/subgraphs/dex-factory" ]; then
deploy_subgraph "amm-v2" "$EXCHANGE_DIR/subgraphs/dex-factory" "1.0.0"
check_sync "amm-v2"
else
echo "AMM V2 subgraph not found at $EXCHANGE_DIR/subgraphs/dex-factory"
fi
;;
status)
check_sync "amm-v3"
check_sync "amm-v2"
check_sync "zoo-amm-v3"
check_sync "zoo-amm-v2"
check_sync "pars-amm-v2"
check_sync "hanzo-amm-v2"
;;
all)
deploy_subgraph "amm-v3" "$EXCHANGE_DIR/subgraphs/dex-v3" "2.1.0"
deploy_subgraph "amm-v2" "$EXCHANGE_DIR/subgraphs/dex-factory" "1.0.0"
deploy_subgraph "zoo-amm-v3" "$EXCHANGE_DIR/subgraphs/zoo-v3" "1.0.0"
deploy_subgraph "zoo-amm-v2" "$EXCHANGE_DIR/subgraphs/zoo-v2" "1.0.0"
deploy_subgraph "pars-amm-v2" "$EXCHANGE_DIR/subgraphs/pars-v2" "1.0.0"
deploy_subgraph "hanzo-amm-v2" "$EXCHANGE_DIR/subgraphs/hanzo-v2" "1.0.0"
echo "=== Sync Status ==="
check_sync "amm-v3"
check_sync "amm-v2"
check_sync "zoo-amm-v3"
check_sync "zoo-amm-v2"
check_sync "pars-amm-v2"
check_sync "hanzo-amm-v2"
;;
*)
echo "Usage: $0 {amm-v3|zoo-amm-v3|zoo-amm-v2|amm-v2|pars-amm-v2|hanzo-amm-v2|all|status} [--wipe]"
exit 1
;;
esac