feat(sol): add agave-backed dlob hot path for canary
Some checks failed
deploy-trade-r001-canary / apply (push) Failing after 5m41s

This commit is contained in:
mpabi
2026-04-12 18:10:42 +02:00
parent 948c37c3f5
commit e1e993e2ac
26 changed files with 1110 additions and 4 deletions

View File

@@ -7,7 +7,7 @@ Minimal canary namespace for migration baseline `R001` on `sol`.
- Reserve a dedicated namespace for the first reconstructed trade deployment.
- Put hard upper bounds on namespace-level CPU, memory, object count, and PVC growth before application manifests land.
- Verify that workloads in the namespace can resolve and reach the shared `trade-infra` services for `Postgres` and `Redis`.
- Recreate the `R001` application surface in a controlled way: `Hasura`, `trade-api`, `trade-frontend`, and the first canary `trade-ingestor` path.
- Recreate the `R001` application surface in a controlled way: `Hasura`, `trade-api`, `trade-frontend`, the first canary `trade-ingestor` path, and the first DLOB hot-path components.
## Current Guardrails
@@ -34,16 +34,21 @@ Minimal canary namespace for migration baseline `R001` on `sol`.
- Current shared infrastructure endpoints expected by canary workloads:
- `postgres-host.trade-infra.svc.cluster.local:5432`
- `redis-host.trade-infra.svc.cluster.local:6379`
- `agave-rpc-host.trade-infra.svc.cluster.local:8899`
- `agave-ws-host.trade-infra.svc.cluster.local:8900`
- `agave-grpc-host.trade-infra.svc.cluster.local:10000`
## Application Surface
- `postgres` in this namespace is an `ExternalName` alias that points to `postgres-host.trade-infra.svc.cluster.local`.
- `Hasura` uses the live `R001` secrets copied from `trade-staging`, but connects to the host `Postgres` on `sol`.
- `trade-api` and `trade-frontend` use the current live images from Gitea registry and the same bootstrap wrapper/config pattern as the source environment.
- `dlob-publisher-hot` now targets the host validator on `sol` through `trade-infra` services and writes `dlob-hot:*` into the shared Redis host service.
- `dlob-hot-redis-to-postgres-raw-writer` and `dlob-hot-postgres-to-postgres-derived-writer` rebuild the first live DLOB derived path on `sol`.
- The canary workflow re-runs:
- `postgres-migrate`
- `hasura-bootstrap`
before it waits for `Hasura`, `trade-api`, `trade-frontend`, and `trade-ingestor` to become healthy.
before it waits for `Hasura`, `trade-api`, `trade-frontend`, `trade-ingestor`, and the DLOB hot-path deployments to become healthy.
- The current canary `trade-ingestor` is intentionally pinned to the schema already reconstructed on `sol` and reads from `dlob_stats_latest`.
- The exact live `R001` ingestor path that reads `dlob_*_derived_latest` remains a follow-up substep after the DLOB writer chain is reconstructed.
@@ -52,8 +57,11 @@ Minimal canary namespace for migration baseline `R001` on `sol`.
From the repository root:
```bash
./environments/sol/trade-infra/scripts/prepare-sol-agave-access.sh
kubectl apply -k environments/sol/trade-infra
./environments/sol/trade-r001-canary/scripts/prepare-sol-postgres.sh
./environments/sol/trade-r001-canary/scripts/create-gitea-registry-secret.sh
./environments/sol/trade-r001-canary/scripts/create-trade-dlob-rpc-secret.sh
./environments/sol/trade-r001-canary/scripts/sync-live-secrets.sh
```

View File

@@ -98,12 +98,17 @@ async function main() {
const source = 'default';
const baseTicks = { schema: 'public', name: 'drift_ticks' };
const dlobHotSnapshotLatestTable = { schema: 'public', name: 'dlob_hot_snapshot_latest' };
const dlobHotDerivedLatestTable = { schema: 'public', name: 'dlob_hot_derived_latest' };
const dlobAllDerivedLatestTable = { schema: 'public', name: 'dlob_all_derived_latest' };
const dlobL2LatestTable = { schema: 'public', name: 'dlob_l2_latest' };
const dlobStatsLatestTable = { schema: 'public', name: 'dlob_stats_latest' };
const dlobDepthBpsLatestTable = { schema: 'public', name: 'dlob_depth_bps_latest' };
const dlobSlippageLatestTable = { schema: 'public', name: 'dlob_slippage_latest' };
const dlobSlippageLatestV2Table = { schema: 'public', name: 'dlob_slippage_latest_v2' };
const candlesCacheTable = { schema: 'public', name: 'drift_candles_cache' };
const dlobHotDerivedTsTable = { schema: 'public', name: 'dlob_hot_derived_ts' };
const dlobAllDerivedTsTable = { schema: 'public', name: 'dlob_all_derived_ts' };
const dlobStatsTsTable = { schema: 'public', name: 'dlob_stats_ts' };
const dlobDepthBpsTsTable = { schema: 'public', name: 'dlob_depth_bps_ts' };
const dlobSlippageTsTable = { schema: 'public', name: 'dlob_slippage_ts' };
@@ -373,6 +378,171 @@ async function main() {
'updated_at',
], { publicFilter: dlobPublicFilter });
await ensurePublicSelectTable(dlobHotSnapshotLatestTable, [
'source',
'redis_key',
'snapshot_kind',
'market_type',
'market_index',
'market_name',
'is_indicative',
'ts_ms',
'slot',
'market_slot',
'payload_hash',
'mark_price_raw',
'oracle_price_raw',
'best_bid_price_raw',
'best_ask_price_raw',
'spread_pct_raw',
'spread_quote_raw',
'oracle_data',
'bids',
'asks',
'payload',
'updated_at',
]);
await ensurePublicSelectTable(dlobHotDerivedLatestTable, [
'source',
'market_type',
'market_index',
'market_name',
'is_indicative',
'ts_ms',
'slot',
'market_slot',
'mark_price',
'oracle_price',
'best_bid_price',
'best_ask_price',
'mid_price',
'spread_quote',
'spread_bps',
'depth_levels',
'bid_levels',
'ask_levels',
'top_bid_size',
'top_ask_size',
'top_bid_notional',
'top_ask_notional',
'depth_bid_base',
'depth_ask_base',
'depth_bid_quote',
'depth_ask_quote',
'imbalance',
'bids_norm',
'asks_norm',
'raw_payload_hash',
'updated_at',
]);
await ensurePublicSelectTable(dlobAllDerivedLatestTable, [
'source',
'market_type',
'market_index',
'market_name',
'is_indicative',
'ts_ms',
'slot',
'market_slot',
'mark_price',
'oracle_price',
'best_bid_price',
'best_ask_price',
'mid_price',
'spread_quote',
'spread_bps',
'depth_levels',
'bid_levels',
'ask_levels',
'top_bid_size',
'top_ask_size',
'top_bid_notional',
'top_ask_notional',
'depth_bid_base',
'depth_ask_base',
'depth_bid_quote',
'depth_ask_quote',
'imbalance',
'bids_norm',
'asks_norm',
'raw_payload_hash',
'updated_at',
]);
await ensurePublicSelectTable(dlobHotDerivedTsTable, [
'event_ts',
'id',
'source',
'market_type',
'market_index',
'market_name',
'is_indicative',
'ts_ms',
'slot',
'market_slot',
'mark_price',
'oracle_price',
'best_bid_price',
'best_ask_price',
'mid_price',
'spread_quote',
'spread_bps',
'depth_levels',
'bid_levels',
'ask_levels',
'top_bid_size',
'top_ask_size',
'top_bid_notional',
'top_ask_notional',
'depth_bid_base',
'depth_ask_base',
'depth_bid_quote',
'depth_ask_quote',
'imbalance',
'bids_norm',
'asks_norm',
'raw_payload_hash',
'inserted_at',
]);
await ensurePublicSelectTable(dlobAllDerivedTsTable, [
'event_ts',
'id',
'source',
'market_type',
'market_index',
'market_name',
'is_indicative',
'ts_ms',
'slot',
'market_slot',
'mark_price',
'oracle_price',
'best_bid_price',
'best_ask_price',
'mid_price',
'spread_quote',
'spread_bps',
'depth_levels',
'bid_levels',
'ask_levels',
'top_bid_size',
'top_ask_size',
'top_bid_notional',
'top_ask_notional',
'depth_bid_base',
'depth_ask_base',
'depth_bid_quote',
'depth_ask_quote',
'imbalance',
'bids_norm',
'asks_norm',
'raw_payload_hash',
'inserted_at',
]);
await ensurePublicSelectTable(dlobStatsTsTable, [
'ts',
'id',

View File

@@ -858,3 +858,271 @@ BEGIN
PERFORM add_retention_policy('dlob_slippage_ts_v2', INTERVAL '7 days');
EXCEPTION WHEN OTHERS THEN
END $$;
-- Canonical raw DLOB hot snapshots written from Redis to PostgreSQL.
CREATE TABLE IF NOT EXISTS public.dlob_hot_snapshot_latest (
source TEXT NOT NULL,
redis_key TEXT NOT NULL,
snapshot_kind TEXT NOT NULL CHECK (snapshot_kind IN ('orderbook_l2', 'orderbook_l3', 'best_makers')),
market_type TEXT NOT NULL,
market_index INTEGER NOT NULL,
market_name TEXT NOT NULL,
is_indicative BOOLEAN NOT NULL DEFAULT FALSE,
ts_ms BIGINT NOT NULL,
slot BIGINT,
market_slot BIGINT,
payload_hash TEXT NOT NULL,
mark_price_raw TEXT,
oracle_price_raw TEXT,
best_bid_price_raw TEXT,
best_ask_price_raw TEXT,
spread_pct_raw TEXT,
spread_quote_raw TEXT,
oracle_data JSONB,
bids JSONB,
asks JSONB,
payload JSONB NOT NULL,
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
PRIMARY KEY (source, market_type, market_index, snapshot_kind, is_indicative)
);
CREATE INDEX IF NOT EXISTS dlob_hot_snapshot_latest_updated_at_idx
ON public.dlob_hot_snapshot_latest (updated_at DESC);
CREATE INDEX IF NOT EXISTS dlob_hot_snapshot_latest_source_market_idx
ON public.dlob_hot_snapshot_latest (source, market_type, market_index, updated_at DESC);
CREATE TABLE IF NOT EXISTS public.dlob_hot_snapshot_ts (
event_ts TIMESTAMPTZ NOT NULL,
id BIGSERIAL NOT NULL,
source TEXT NOT NULL,
redis_key TEXT NOT NULL,
snapshot_kind TEXT NOT NULL CHECK (snapshot_kind IN ('orderbook_l2', 'orderbook_l3', 'best_makers')),
market_type TEXT NOT NULL,
market_index INTEGER NOT NULL,
market_name TEXT NOT NULL,
is_indicative BOOLEAN NOT NULL DEFAULT FALSE,
ts_ms BIGINT NOT NULL,
slot BIGINT,
market_slot BIGINT,
payload_hash TEXT NOT NULL,
mark_price_raw TEXT,
oracle_price_raw TEXT,
best_bid_price_raw TEXT,
best_ask_price_raw TEXT,
spread_pct_raw TEXT,
spread_quote_raw TEXT,
oracle_data JSONB,
bids JSONB,
asks JSONB,
payload JSONB NOT NULL,
inserted_at TIMESTAMPTZ NOT NULL DEFAULT now(),
PRIMARY KEY (event_ts, id)
);
SELECT create_hypertable('dlob_hot_snapshot_ts', 'event_ts', if_not_exists => TRUE, migrate_data => TRUE);
CREATE UNIQUE INDEX IF NOT EXISTS dlob_hot_snapshot_ts_dedupe_idx
ON public.dlob_hot_snapshot_ts (event_ts, source, redis_key, payload_hash);
CREATE INDEX IF NOT EXISTS dlob_hot_snapshot_ts_market_ts_desc_idx
ON public.dlob_hot_snapshot_ts (market_type, market_index, event_ts DESC);
CREATE INDEX IF NOT EXISTS dlob_hot_snapshot_ts_source_market_ts_desc_idx
ON public.dlob_hot_snapshot_ts (source, market_type, market_index, event_ts DESC);
CREATE TABLE IF NOT EXISTS public.dlob_hot_derived_latest (
source TEXT NOT NULL,
market_type TEXT NOT NULL,
market_index INTEGER NOT NULL,
market_name TEXT NOT NULL,
is_indicative BOOLEAN NOT NULL DEFAULT FALSE,
ts_ms BIGINT NOT NULL,
slot BIGINT,
market_slot BIGINT,
mark_price NUMERIC,
oracle_price NUMERIC,
best_bid_price NUMERIC,
best_ask_price NUMERIC,
mid_price NUMERIC,
spread_quote NUMERIC,
spread_bps NUMERIC,
depth_levels INTEGER NOT NULL,
bid_levels INTEGER NOT NULL,
ask_levels INTEGER NOT NULL,
top_bid_size NUMERIC,
top_ask_size NUMERIC,
top_bid_notional NUMERIC,
top_ask_notional NUMERIC,
depth_bid_base NUMERIC NOT NULL DEFAULT 0,
depth_ask_base NUMERIC NOT NULL DEFAULT 0,
depth_bid_quote NUMERIC NOT NULL DEFAULT 0,
depth_ask_quote NUMERIC NOT NULL DEFAULT 0,
imbalance NUMERIC,
bids_norm JSONB NOT NULL DEFAULT '[]'::jsonb,
asks_norm JSONB NOT NULL DEFAULT '[]'::jsonb,
raw_payload_hash TEXT NOT NULL,
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
PRIMARY KEY (source, market_type, market_index, is_indicative)
);
CREATE INDEX IF NOT EXISTS dlob_hot_derived_latest_updated_at_idx
ON public.dlob_hot_derived_latest (updated_at DESC);
CREATE INDEX IF NOT EXISTS dlob_hot_derived_latest_source_market_idx
ON public.dlob_hot_derived_latest (source, market_type, market_index, updated_at DESC);
CREATE TABLE IF NOT EXISTS public.dlob_hot_derived_ts (
event_ts TIMESTAMPTZ NOT NULL,
id BIGSERIAL NOT NULL,
source TEXT NOT NULL,
market_type TEXT NOT NULL,
market_index INTEGER NOT NULL,
market_name TEXT NOT NULL,
is_indicative BOOLEAN NOT NULL DEFAULT FALSE,
ts_ms BIGINT NOT NULL,
slot BIGINT,
market_slot BIGINT,
mark_price NUMERIC,
oracle_price NUMERIC,
best_bid_price NUMERIC,
best_ask_price NUMERIC,
mid_price NUMERIC,
spread_quote NUMERIC,
spread_bps NUMERIC,
depth_levels INTEGER NOT NULL,
bid_levels INTEGER NOT NULL,
ask_levels INTEGER NOT NULL,
top_bid_size NUMERIC,
top_ask_size NUMERIC,
top_bid_notional NUMERIC,
top_ask_notional NUMERIC,
depth_bid_base NUMERIC NOT NULL DEFAULT 0,
depth_ask_base NUMERIC NOT NULL DEFAULT 0,
depth_bid_quote NUMERIC NOT NULL DEFAULT 0,
depth_ask_quote NUMERIC NOT NULL DEFAULT 0,
imbalance NUMERIC,
bids_norm JSONB NOT NULL DEFAULT '[]'::jsonb,
asks_norm JSONB NOT NULL DEFAULT '[]'::jsonb,
raw_payload_hash TEXT NOT NULL,
inserted_at TIMESTAMPTZ NOT NULL DEFAULT now(),
PRIMARY KEY (event_ts, id)
);
SELECT create_hypertable('dlob_hot_derived_ts', 'event_ts', if_not_exists => TRUE, migrate_data => TRUE);
CREATE UNIQUE INDEX IF NOT EXISTS dlob_hot_derived_ts_dedupe_idx
ON public.dlob_hot_derived_ts (event_ts, source, market_type, market_index, is_indicative, raw_payload_hash);
CREATE INDEX IF NOT EXISTS dlob_hot_derived_ts_market_ts_desc_idx
ON public.dlob_hot_derived_ts (market_type, market_index, event_ts DESC);
CREATE INDEX IF NOT EXISTS dlob_hot_derived_ts_source_market_ts_desc_idx
ON public.dlob_hot_derived_ts (source, market_type, market_index, event_ts DESC);
DO $$
BEGIN
PERFORM add_retention_policy('dlob_hot_snapshot_ts', INTERVAL '30 days');
EXCEPTION WHEN duplicate_object THEN NULL;
END $$;
DO $$
BEGIN
PERFORM add_retention_policy('dlob_hot_derived_ts', INTERVAL '180 days');
EXCEPTION WHEN duplicate_object THEN NULL;
END $$;
CREATE TABLE IF NOT EXISTS public.dlob_all_derived_latest (
source TEXT NOT NULL,
market_type TEXT NOT NULL,
market_index INTEGER NOT NULL,
market_name TEXT NOT NULL,
is_indicative BOOLEAN NOT NULL DEFAULT FALSE,
ts_ms BIGINT NOT NULL,
slot BIGINT,
market_slot BIGINT,
mark_price NUMERIC,
oracle_price NUMERIC,
best_bid_price NUMERIC,
best_ask_price NUMERIC,
mid_price NUMERIC,
spread_quote NUMERIC,
spread_bps NUMERIC,
depth_levels INTEGER NOT NULL,
bid_levels INTEGER NOT NULL,
ask_levels INTEGER NOT NULL,
top_bid_size NUMERIC,
top_ask_size NUMERIC,
top_bid_notional NUMERIC,
top_ask_notional NUMERIC,
depth_bid_base NUMERIC NOT NULL DEFAULT 0,
depth_ask_base NUMERIC NOT NULL DEFAULT 0,
depth_bid_quote NUMERIC NOT NULL DEFAULT 0,
depth_ask_quote NUMERIC NOT NULL DEFAULT 0,
imbalance NUMERIC,
bids_norm JSONB NOT NULL DEFAULT '[]'::jsonb,
asks_norm JSONB NOT NULL DEFAULT '[]'::jsonb,
raw_payload_hash TEXT NOT NULL,
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
PRIMARY KEY (source, market_type, market_index, is_indicative)
);
CREATE INDEX IF NOT EXISTS dlob_all_derived_latest_updated_at_idx
ON public.dlob_all_derived_latest (updated_at DESC);
CREATE INDEX IF NOT EXISTS dlob_all_derived_latest_source_market_idx
ON public.dlob_all_derived_latest (source, market_type, market_index, updated_at DESC);
CREATE TABLE IF NOT EXISTS public.dlob_all_derived_ts (
event_ts TIMESTAMPTZ NOT NULL,
id BIGSERIAL NOT NULL,
source TEXT NOT NULL,
market_type TEXT NOT NULL,
market_index INTEGER NOT NULL,
market_name TEXT NOT NULL,
is_indicative BOOLEAN NOT NULL DEFAULT FALSE,
ts_ms BIGINT NOT NULL,
slot BIGINT,
market_slot BIGINT,
mark_price NUMERIC,
oracle_price NUMERIC,
best_bid_price NUMERIC,
best_ask_price NUMERIC,
mid_price NUMERIC,
spread_quote NUMERIC,
spread_bps NUMERIC,
depth_levels INTEGER NOT NULL,
bid_levels INTEGER NOT NULL,
ask_levels INTEGER NOT NULL,
top_bid_size NUMERIC,
top_ask_size NUMERIC,
top_bid_notional NUMERIC,
top_ask_notional NUMERIC,
depth_bid_base NUMERIC NOT NULL DEFAULT 0,
depth_ask_base NUMERIC NOT NULL DEFAULT 0,
depth_bid_quote NUMERIC NOT NULL DEFAULT 0,
depth_ask_quote NUMERIC NOT NULL DEFAULT 0,
imbalance NUMERIC,
bids_norm JSONB NOT NULL DEFAULT '[]'::jsonb,
asks_norm JSONB NOT NULL DEFAULT '[]'::jsonb,
raw_payload_hash TEXT NOT NULL,
inserted_at TIMESTAMPTZ NOT NULL DEFAULT now(),
PRIMARY KEY (event_ts, id)
);
SELECT create_hypertable('dlob_all_derived_ts', 'event_ts', if_not_exists => TRUE, migrate_data => TRUE);
CREATE UNIQUE INDEX IF NOT EXISTS dlob_all_derived_ts_dedupe_idx
ON public.dlob_all_derived_ts (event_ts, source, market_type, market_index, is_indicative, raw_payload_hash);
CREATE INDEX IF NOT EXISTS dlob_all_derived_ts_market_ts_desc_idx
ON public.dlob_all_derived_ts (market_type, market_index, event_ts DESC);
CREATE INDEX IF NOT EXISTS dlob_all_derived_ts_source_market_ts_desc_idx
ON public.dlob_all_derived_ts (source, market_type, market_index, event_ts DESC);
DO $$
BEGIN
PERFORM add_retention_policy('dlob_all_derived_ts', INTERVAL '30 days');
EXCEPTION WHEN duplicate_object THEN NULL;
END $$;

View File

@@ -0,0 +1,63 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: dlob-hot-postgres-to-postgres-derived-writer
namespace: trade-r001-canary
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: dlob-hot-postgres-to-postgres-derived-writer
template:
metadata:
labels:
app.kubernetes.io/name: dlob-hot-postgres-to-postgres-derived-writer
spec:
imagePullSecrets:
- name: gitea-registry
containers:
- name: writer
image: gitea.mpabi.pl/trade/trade-dlob-server:hot-pg-events-20260320-205517
imagePullPolicy: IfNotPresent
command:
- node
- /lib/scripts/dlobHotPostgresToPostgresDerivedWriter.js
env:
- name: DLOB_SOURCE
value: mevnode_bot_hot_derived
- name: RAW_SOURCE
value: mevnode_bot_hot_raw
- name: DLOB_POLL_MS
value: "5000"
- name: NORMALIZED_DEPTH
value: "10"
- name: PRICE_PRECISION
value: "1000000"
- name: BASE_PRECISION
value: "1000000000"
- name: PGHOST
value: postgres
- name: PGPORT
value: "5432"
- name: PGUSER
valueFrom:
secretKeyRef:
name: trade-postgres
key: POSTGRES_USER
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: trade-postgres
key: POSTGRES_PASSWORD
- name: PGDATABASE
valueFrom:
secretKeyRef:
name: trade-postgres
key: POSTGRES_DB
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi

View File

@@ -0,0 +1,61 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: dlob-hot-redis-to-postgres-raw-writer
namespace: trade-r001-canary
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: dlob-hot-redis-to-postgres-raw-writer
template:
metadata:
labels:
app.kubernetes.io/name: dlob-hot-redis-to-postgres-raw-writer
spec:
imagePullSecrets:
- name: gitea-registry
containers:
- name: writer
image: gitea.mpabi.pl/trade/trade-dlob-server:hot-pg-events-20260320-205517
imagePullPolicy: IfNotPresent
command:
- node
- /lib/scripts/dlobHotRedisToPostgresRawWriter.js
env:
- name: DLOB_SOURCE
value: mevnode_bot_hot_raw
- name: REDIS_HOST
value: dlob-redis
- name: REDIS_PORT
value: "6379"
- name: REDIS_KEY_PREFIX
value: "dlob-hot:"
- name: DLOB_POLL_MS
value: "5000"
- name: PGHOST
value: postgres
- name: PGPORT
value: "5432"
- name: PGUSER
valueFrom:
secretKeyRef:
name: trade-postgres
key: POSTGRES_USER
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: trade-postgres
key: POSTGRES_PASSWORD
- name: PGDATABASE
valueFrom:
secretKeyRef:
name: trade-postgres
key: POSTGRES_DB
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi

View File

@@ -0,0 +1,130 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: dlob-publisher-hot
namespace: trade-r001-canary
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: dlob-publisher-hot
template:
metadata:
labels:
app.kubernetes.io/name: dlob-publisher-hot
spec:
imagePullSecrets:
- name: gitea-registry
containers:
- name: publisher
image: gitea.mpabi.pl/trade/trade-dlob-server:grpc-teardown-fix-20260402-113736
imagePullPolicy: IfNotPresent
command:
- node
- /lib/publishers/dlobPublisher.js
ports:
- name: http
containerPort: 8080
env:
- name: FETCH_CONNECT_TIMEOUT_MS
value: "15000"
- name: FETCH_HEADERS_TIMEOUT_MS
value: "300000"
- name: FETCH_BODY_TIMEOUT_MS
value: "300000"
- name: ENABLE_PERSISTENT_STORE
value: "true"
- name: DLOB_SOURCE
value: mevnode_bot_hot
- name: PRICE_PRECISION
value: "1000000"
- name: BASE_PRECISION
value: "1000000000"
- name: PERSISTENT_STATS_DEPTH
value: "10"
- name: PGHOST
value: postgres
- name: PGPORT
value: "5432"
- name: PGUSER
valueFrom:
secretKeyRef:
name: trade-postgres
key: POSTGRES_USER
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: trade-postgres
key: POSTGRES_PASSWORD
- name: PGDATABASE
valueFrom:
secretKeyRef:
name: trade-postgres
key: POSTGRES_DB
- name: PERP_MARKETS_TO_LOAD
value: "0,20,72"
- name: USE_GRPC
value: "true"
- name: USE_WEBSOCKET
value: "true"
- name: DISABLE_GPA_REFRESH
value: "true"
- name: GRPC_CLIENT
value: yellowstone
- name: GRPC_ENDPOINT
valueFrom:
secretKeyRef:
name: trade-dlob-rpc
key: GRPC_ENDPOINT
- name: TOKEN
valueFrom:
secretKeyRef:
name: trade-dlob-rpc
key: TOKEN
- name: RUNNING_LOCAL
value: "true"
- name: LOCAL_CACHE
value: "true"
- name: ENV
value: mainnet-beta
- name: USE_ORDER_SUBSCRIBER
value: "true"
- name: ELASTICACHE_HOST
value: dlob-redis
- name: ELASTICACHE_PORT
value: "6379"
- name: REDIS_CLIENT
value: DLOB_HOT
- name: ENDPOINT
valueFrom:
secretKeyRef:
name: trade-dlob-rpc
key: ENDPOINT
- name: WS_ENDPOINT
valueFrom:
secretKeyRef:
name: trade-dlob-rpc
key: WS_ENDPOINT
resources:
requests:
cpu: 250m
memory: 512Mi
limits:
cpu: "1"
memory: 1Gi
readinessProbe:
httpGet:
path: /startup
port: http
initialDelaySeconds: 120
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 30
livenessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 240
periodSeconds: 20
timeoutSeconds: 3
failureThreshold: 10

View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: dlob-redis
namespace: trade-r001-canary
spec:
type: ExternalName
externalName: redis-host.trade-infra.svc.cluster.local
ports:
- name: redis
port: 6379
targetPort: 6379

View File

@@ -15,6 +15,13 @@ spec:
envFrom:
- secretRef:
name: trade-postgres
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
command:
- sh
- -ec
@@ -38,6 +45,13 @@ spec:
value: drift_ticks
- name: CANDLES_FUNCTION
value: get_drift_candles
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
command:
- node
- /app/hasura-bootstrap.mjs

View File

@@ -11,6 +11,7 @@ resources:
- resourcequota.yaml
- limitrange.yaml
- postgres-alias-service.yaml
- dlob-redis-alias-service.yaml
- hasura-service.yaml
- hasura-deployment.yaml
- postgres-migrate-job.yaml
@@ -20,6 +21,9 @@ resources:
- trade-frontend-service.yaml
- trade-frontend-deployment.yaml
- trade-ingestor-deployment.yaml
- dlob-publisher-hot-deployment.yaml
- dlob-hot-redis-to-postgres-raw-writer-deployment.yaml
- dlob-hot-postgres-to-postgres-derived-writer-deployment.yaml
configMapGenerator:
- name: postgres-initdb

View File

@@ -15,6 +15,13 @@ spec:
envFrom:
- secretRef:
name: trade-postgres
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
command:
- sh
- -ec

View File

@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -euo pipefail
TARGET_HOST="${TARGET_HOST:-mevnode}"
TARGET_NAMESPACE="${TARGET_NAMESPACE:-trade-r001-canary}"
RPC_URL="${RPC_URL:-http://agave-rpc-host.trade-infra.svc.cluster.local:8899}"
WS_URL="${WS_URL:-ws://agave-ws-host.trade-infra.svc.cluster.local:8900}"
GRPC_URL="${GRPC_URL:-http://agave-grpc-host.trade-infra.svc.cluster.local:10000}"
ssh_target() {
ssh -o StrictHostKeyChecking=no "$TARGET_HOST" "$@"
}
TOKEN="$(ssh_target 'sudo cat /etc/agave/geyser.x_token')"
ssh_target "sudo k3s kubectl get ns ${TARGET_NAMESPACE} >/dev/null 2>&1 || sudo k3s kubectl create ns ${TARGET_NAMESPACE} >/dev/null"
ssh_target "sudo k3s kubectl -n ${TARGET_NAMESPACE} create secret generic trade-dlob-rpc \
--from-literal=ENDPOINT='${RPC_URL}' \
--from-literal=WS_ENDPOINT='${WS_URL}' \
--from-literal=GRPC_ENDPOINT='${GRPC_URL}' \
--from-literal=TOKEN='${TOKEN}' \
--dry-run=client -o yaml | sudo k3s kubectl apply -f - >/dev/null"
echo "Created trade-dlob-rpc in ${TARGET_NAMESPACE}"