Files
universe/k8s/lux-devnet/exchange-api.yaml
T

127 lines
4.9 KiB
YAML

---
###############################################################################
# Exchange API — Devnet (markets-data backend for lux.exchange ?network=devnet)
#
# ghcr.io/luxfi/exchange-api:2.3.28@sha256:b640cee416490deeb1fd133f4d58d6f2c4a99cf9e88d6ba9c384d27484278695 — the FE-facing markets API. Serves the
# native Lux graph (luxfi/graph in the explorer) as the SINGLE source of truth:
# - SUBGRAPH_URL -> devnet explorer AMM subgraph (/v1/graph/cchain/amm/graphql)
# - DEX_SUBGRAPH_URL -> devnet explorer DEX (CLOB) subgraph (/v1/graph/cchain/dex/graphql)
# exchange-api routes by leading root field: markets/fills/orders/orderbook ->
# DEX_GRAPH (the native CLOB the 0x9999 DEXFill events feed), everything else
# -> AMM_GRAPH. It FAIL-FASTS at boot if DEX_SUBGRAPH_URL is unset and
# SUBGRAPH_URL lacks an /amm/graphql segment (deriveDexGraph guard).
#
# DEVNET-SCOPED. Does NOT reuse / point at the mainnet exchange-api (lux-ns),
# which targets explorer.lux-mainnet.svc. This one targets explorer.lux-devnet.svc.
###############################################################################
apiVersion: apps/v1
kind: Deployment
metadata:
name: exchange-api
namespace: lux-devnet
labels:
app: exchange-api
network: devnet
spec:
replicas: 2
revisionHistoryLimit: 5
selector:
matchLabels:
app: exchange-api
network: devnet
template:
metadata:
labels:
app: exchange-api
network: devnet
spec:
imagePullSecrets:
- name: ghcr-luxfi
containers:
- name: exchange-api
image: ghcr.io/luxfi/exchange-api:2.3.28@sha256:b640cee416490deeb1fd133f4d58d6f2c4a99cf9e88d6ba9c384d27484278695
imagePullPolicy: IfNotPresent
ports:
- { name: http, containerPort: 4000, protocol: TCP }
env:
- { name: PORT, value: "4000" }
# NETWORK selects this deployment's chain/contract config (networks.ts).
- { name: NETWORK, value: "devnet" }
# CLOB real-asset gate (dexMarkets.ts): the markets surface shows ONLY
# real, accepted-chain-state markets. Synthetic-seed rows (crossed books,
# phantom ascii-of-symbol asset ids, mock/Liquidity* tokens) are REJECTED
# by verifying each EVM token's code + decimals() on THIS network's
# C-Chain. LUX_RPC_URL MUST be the devnet C-Chain RPC — it is the
# "chainID matches" guarantee by construction. Without it the gate would
# default to the mainnet RPC and verify devnet tokens against the wrong
# chain. devnet has no real asset contracts deployed yet, so every market
# fails verification and the surface is correctly EMPTY ("No active
# markets") — no per-network special-casing.
- name: LUX_RPC_URL
value: "http://luxd-headless.lux-devnet.svc.cluster.local:9650/v1/chain/C/rpc"
# AMM (uniswap-v2/v3-shaped) — devnet explorer amm subgraph.
- name: SUBGRAPH_URL
value: "http://explorer.lux-devnet.svc.cluster.local:8090/v1/graph/cchain/amm/graphql"
# Native DEX (CLOB) — devnet explorer dex subgraph (0x9999 DEXFill events).
- name: DEX_SUBGRAPH_URL
value: "http://explorer.lux-devnet.svc.cluster.local:8090/v1/graph/cchain/dex/graphql"
resources:
requests: { cpu: 100m, memory: 128Mi }
limits: { cpu: 500m, memory: 512Mi }
readinessProbe:
httpGet: { path: /health, port: http }
periodSeconds: 10
timeoutSeconds: 2
failureThreshold: 3
livenessProbe:
httpGet: { path: /health, port: http }
periodSeconds: 30
timeoutSeconds: 2
failureThreshold: 3
---
apiVersion: v1
kind: Service
metadata:
name: exchange-api
namespace: lux-devnet
labels:
app: exchange-api
network: devnet
spec:
type: ClusterIP
selector:
app: exchange-api
network: devnet
ports:
- { name: http, port: 4000, targetPort: 4000, protocol: TCP }
---
# Devnet markets host. Mirrors mainnet's api-exchange.lux.network -> exchange-api,
# but devnet-scoped: api-exchange.lux-dev.network -> devnet exchange-api. This is
# the host the lux.exchange devnet surface (?network=devnet) resolves markets from.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: api-exchange-lux-dev-network
namespace: lux-devnet
labels:
app: exchange-api
network: devnet
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
ingressClassName: ingress
rules:
- host: api-exchange.lux-dev.network
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: exchange-api
port:
number: 4000
tls:
- hosts: [api-exchange.lux-dev.network]
secretName: api-exchange-lux-dev-network-tls