From 66b300f6387e0027888b0b2e013166c30c755117 Mon Sep 17 00:00:00 2001 From: u1 Date: Tue, 6 Jan 2026 00:19:10 +0000 Subject: [PATCH] feat(hasura): add bootstrap job (track tables/functions) --- kustomize/base/hasura/job-bootstrap.yaml | 51 ++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 kustomize/base/hasura/job-bootstrap.yaml diff --git a/kustomize/base/hasura/job-bootstrap.yaml b/kustomize/base/hasura/job-bootstrap.yaml new file mode 100644 index 0000000..7b6126a --- /dev/null +++ b/kustomize/base/hasura/job-bootstrap.yaml @@ -0,0 +1,51 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: hasura-bootstrap + annotations: + argocd.argoproj.io/sync-wave: "2" +spec: + backoffLimit: 5 + template: + spec: + restartPolicy: OnFailure + initContainers: + - name: wait-db + image: postgres:16 + imagePullPolicy: IfNotPresent + envFrom: + - secretRef: + name: trade-postgres + command: + - sh + - -ec + - | + export PGPASSWORD="$POSTGRES_PASSWORD" + until pg_isready -h postgres -U "$POSTGRES_USER" -d "$POSTGRES_DB"; do sleep 1; done + until psql -h postgres -U "$POSTGRES_USER" -d "$POSTGRES_DB" -v ON_ERROR_STOP=1 -c "select 1 from public.drift_ticks limit 1" >/dev/null 2>&1; do sleep 1; done + containers: + - name: hasura-bootstrap + image: node:20-slim + imagePullPolicy: IfNotPresent + env: + - name: HASURA_URL + value: http://hasura:8080 + - name: HASURA_ADMIN_SECRET + valueFrom: + secretKeyRef: + name: trade-hasura + key: HASURA_GRAPHQL_ADMIN_SECRET + - name: TICKS_TABLE + value: drift_ticks + - name: CANDLES_FUNCTION + value: get_drift_candles + command: ["node", "/app/hasura-bootstrap.mjs"] + volumeMounts: + - name: script + mountPath: /app/hasura-bootstrap.mjs + subPath: hasura-bootstrap.mjs + readOnly: true + volumes: + - name: script + configMap: + name: hasura-bootstrap-script