graph-node reads one block range at a time and the historical scan is RPC-latency-bound, not CPU-bound (937m of a 2000m limit at full tilt). All five mainnet validators serve the same C-Chain at the same height and hash, so list all five as providers. Labels must be UNIQUE — a duplicate label is a hard `configuration error: Provider labels must be unique` at startup, not a warning. Also raises the range/batch knobs: 96369 has ~1.1M blocks of which only the first ~410k carry DEX activity, so the default 2000-block range spends the backfill walking empty space. exchange-api moves to 2.3.11 and its SUBGRAPH_URL — the endpoint the FE's combined explore query is proxied to — now points at graph-node. The FE reads TVL straight off pools[].totalValueLockedUSD, and the explorer shim returns "" for every USD field. SUBGRAPH_V2_URL keeps the v2-shaped helpers on the shim. Co-authored-by: Hanzo Dev <[email protected]>
289 lines
7.8 KiB
YAML
289 lines
7.8 KiB
YAML
# Graph Node + PostgreSQL for Lux AMM subgraph indexing
|
|
# Indexes v2/v3 pool events from AMMV2Factory on Lux C-chain
|
|
|
|
---
|
|
# PostgreSQL for Graph Node
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: graph-postgres-data
|
|
namespace: lux-mainnet
|
|
spec:
|
|
accessModes: [ReadWriteOnce]
|
|
resources:
|
|
requests:
|
|
storage: 50Gi
|
|
---
|
|
# IPFS store — graph-node re-reads the subgraph manifest from IPFS on every
|
|
# restart, so this cannot be an emptyDir or a restart deletes the deployment.
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: graph-ipfs-data
|
|
namespace: lux-mainnet
|
|
spec:
|
|
accessModes: [ReadWriteOnce]
|
|
resources:
|
|
requests:
|
|
storage: 5Gi
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: graph-postgres
|
|
namespace: lux-mainnet
|
|
spec:
|
|
serviceName: graph-postgres
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: graph-postgres
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: graph-postgres
|
|
spec:
|
|
containers:
|
|
- name: postgres
|
|
# MUST match the on-disk PGDATA major version. The volume was
|
|
# written by 18.4; postgres:16 dies with FATAL "unrecognized
|
|
# configuration parameter autovacuum_worker_slots" and takes
|
|
# graph-node down with DatabaseUnavailable.
|
|
image: postgres:18-alpine
|
|
ports:
|
|
- containerPort: 5432
|
|
env:
|
|
- name: POSTGRES_USER
|
|
value: graph
|
|
- name: POSTGRES_PASSWORD
|
|
value: graph-lux-2026
|
|
- name: POSTGRES_DB
|
|
value: graph_node
|
|
- name: POSTGRES_INITDB_ARGS
|
|
value: "-E UTF8 --locale=C"
|
|
- name: PGDATA
|
|
value: /var/lib/postgresql/data/pgdata
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /var/lib/postgresql/data
|
|
resources:
|
|
requests:
|
|
memory: "512Mi"
|
|
cpu: "250m"
|
|
limits:
|
|
memory: "2Gi"
|
|
cpu: "1000m"
|
|
volumes:
|
|
- name: data
|
|
persistentVolumeClaim:
|
|
claimName: graph-postgres-data
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: graph-postgres
|
|
namespace: lux-mainnet
|
|
spec:
|
|
selector:
|
|
app: graph-postgres
|
|
ports:
|
|
- port: 5432
|
|
---
|
|
# IPFS node for subgraph deployment artifacts
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: graph-ipfs
|
|
namespace: lux-mainnet
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: graph-ipfs
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: graph-ipfs
|
|
spec:
|
|
containers:
|
|
- name: ipfs
|
|
image: ipfs/kubo:v0.28.0
|
|
ports:
|
|
- containerPort: 5001 # API
|
|
- containerPort: 8080 # Gateway
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /data/ipfs
|
|
resources:
|
|
requests:
|
|
memory: "256Mi"
|
|
cpu: "100m"
|
|
limits:
|
|
memory: "1Gi"
|
|
cpu: "500m"
|
|
volumes:
|
|
- name: data
|
|
persistentVolumeClaim:
|
|
claimName: graph-ipfs-data
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: graph-ipfs
|
|
namespace: lux-mainnet
|
|
spec:
|
|
selector:
|
|
app: graph-ipfs
|
|
ports:
|
|
- name: api
|
|
port: 5001
|
|
- name: gateway
|
|
port: 8080
|
|
---
|
|
# Graph Node ConfigMap
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: graph-node-config
|
|
namespace: lux-mainnet
|
|
data:
|
|
config.toml: |
|
|
[store]
|
|
[store.primary]
|
|
connection = "postgresql://graph:[email protected]:5432/graph_node?sslmode=disable"
|
|
weight = 1
|
|
pool_size = 10
|
|
|
|
[deployment]
|
|
[[deployment.rule]]
|
|
shard = "primary"
|
|
indexers = ["graph_node"]
|
|
|
|
[chains]
|
|
ingestor = "graph_node"
|
|
|
|
[chains.lux]
|
|
shard = "primary"
|
|
# All five validators serve the same C-Chain at the same height, and the
|
|
# historical backfill is RPC-latency-bound, not CPU-bound — graph-node
|
|
# spreads requests across the providers of a chain, so listing all five is
|
|
# ~5x the backfill throughput at no cost. Labels MUST be unique ("Provider
|
|
# labels must be unique" is a hard config error, not a warning). luxd is
|
|
# archive (eth_call at block 49 returns WLUX), which the subgraph needs for
|
|
# token metadata.
|
|
provider = [
|
|
{ label = "luxd-0", url = "http://luxd-0.luxd-headless.lux-mainnet.svc:9630/v1/bc/C/rpc", features = ["archive"] },
|
|
{ label = "luxd-1", url = "http://luxd-1.luxd-headless.lux-mainnet.svc:9630/v1/bc/C/rpc", features = ["archive"] },
|
|
{ label = "luxd-2", url = "http://luxd-2.luxd-headless.lux-mainnet.svc:9630/v1/bc/C/rpc", features = ["archive"] },
|
|
{ label = "luxd-3", url = "http://luxd-3.luxd-headless.lux-mainnet.svc:9630/v1/bc/C/rpc", features = ["archive"] },
|
|
{ label = "luxd-4", url = "http://luxd-4.luxd-headless.lux-mainnet.svc:9630/v1/bc/C/rpc", features = ["archive"] }
|
|
]
|
|
---
|
|
# Graph Node StatefulSet
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: graph-node
|
|
namespace: lux-mainnet
|
|
spec:
|
|
serviceName: graph-node
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: graph-node
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: graph-node
|
|
spec:
|
|
containers:
|
|
- name: graph-node
|
|
image: graphprotocol/graph-node:v0.35.1
|
|
ports:
|
|
- containerPort: 8000 # GraphQL HTTP
|
|
name: graphql
|
|
- containerPort: 8001 # GraphQL WS
|
|
name: ws
|
|
- containerPort: 8020 # JSON-RPC (admin/deploy)
|
|
name: admin
|
|
- containerPort: 8030 # Index node status
|
|
name: status
|
|
- containerPort: 8040 # Metrics
|
|
name: metrics
|
|
env:
|
|
- name: GRAPH_NODE_CONFIG
|
|
value: /etc/graph-node/config.toml
|
|
# graph-node normalises node_id to snake_case internally; the
|
|
# deployment rule must use the SAME literal or deployments are
|
|
# assigned to a node that does not exist and never index.
|
|
- name: node_id
|
|
value: graph_node
|
|
- name: GRAPH_LOG
|
|
value: info
|
|
- name: ipfs
|
|
value: graph-ipfs.lux-mainnet.svc:5001
|
|
- name: ETHEREUM_REORG_THRESHOLD
|
|
value: "1"
|
|
- name: ETHEREUM_ANCESTOR_COUNT
|
|
value: "1"
|
|
# Backfill tuning. 96369 has ~1.1M blocks of which only the first
|
|
# ~410k carry any DEX activity, so the scan spends most of its time
|
|
# walking empty ranges one 2000-block default at a time. Larger
|
|
# ranges + a deeper block batch cut the round trips that dominate.
|
|
- name: GRAPH_ETHEREUM_TARGET_TRIGGERS_PER_BLOCK_RANGE
|
|
value: "1000"
|
|
- name: GRAPH_ETHEREUM_MAX_BLOCK_RANGE_SIZE
|
|
value: "10000"
|
|
- name: GRAPH_ETHEREUM_BLOCK_BATCH_SIZE
|
|
value: "50"
|
|
volumeMounts:
|
|
- name: config
|
|
mountPath: /etc/graph-node
|
|
resources:
|
|
requests:
|
|
memory: "2Gi"
|
|
cpu: "500m"
|
|
limits:
|
|
memory: "4Gi"
|
|
cpu: "2000m"
|
|
volumes:
|
|
- name: config
|
|
configMap:
|
|
name: graph-node-config
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: graph-node
|
|
namespace: lux-mainnet
|
|
spec:
|
|
selector:
|
|
app: graph-node
|
|
ports:
|
|
- name: graphql
|
|
port: 8000
|
|
- name: ws
|
|
port: 8001
|
|
- name: admin
|
|
port: 8020
|
|
- name: status
|
|
port: 8030
|
|
---
|
|
# IngressRoute for subgraph.lux.network
|
|
apiVersion: hanzo.ai/v1alpha1
|
|
kind: IngressRoute
|
|
metadata:
|
|
name: graph-node
|
|
namespace: lux-mainnet
|
|
spec:
|
|
entryPoints:
|
|
- websecure
|
|
routes:
|
|
- match: Host(`subgraph.lux.network`)
|
|
kind: Rule
|
|
services:
|
|
- name: graph-node
|
|
port: 8000
|
|
tls:
|
|
certResolver: letsencrypt
|