TechnologyApril 21, 2022

How to Connect Temporal.io to Astra DB with Kubernetes

Melissa Herrera
Melissa HerreraCloud Solutions Engineer
Ranjan Melanta
Ranjan MelantaData Architect
How to Connect Temporal.io to Astra DB with Kubernetes
ASTRA_TOKEN=<your Astra token>
ASTRA_DATABASE_ID=<your DB ID>
docker-compose -f docker-compose-schema.yaml run temporal-admin-tools \
  -ep cql-proxy -k temporal setup-schema -v 0.0
docker-compose -f docker-compose-schema.yaml run temporal-admin-tools \
  -ep cql-proxy -k temporal update-schema -d schema/cassandra/temporal/versioned/

docker-compose -f docker-compose-schema.yaml run temporal-admin-tools \
  -ep cql-proxy -k temporal_visibility setup-schema -v 0.0
docker-compose -f docker-compose-schema.yaml run temporal-admin-tools \
  -ep cql-proxy -k temporal_visibility update-schema -d schema/cassandra/visibility/versioned/
2022-03-02T22:23:27.618Z INFO Validating connection to cassandra cluster. {"logging-call-at": "cqlclient.go:112"}

2022-03-02T22:42:53.526Z INFO Connection validation succeeded. {"logging-call-at": "cqlclient.go:118"}
2022-03-02T22:42:53.526Z INFO Starting schema setup {"config": {"SchemaFilePath":"","InitialVersion":"0.0","Overwrite":false,"DisableVersioning":false}, "logging-call-at": "setuptask.go:57"}
2022-03-02T22:42:53.526Z DEBUG Setting up version tables {"logging-call-at": "setuptask.go:67"}
2022-03-02T22:42:54.120Z DEBUG Current database schema version 1.6 is greater than initial schema version 0.0. Skip version upgrade {"logging-call-at": "setuptask.go:116"}
2022-03-02T22:42:54.120Z INFO Schema setup complete {"logging-call-at": "setuptask.go:131"}
 
token@cqlsh> use temporal;
token@cqlsh:temporal> desc tables;

history_node        tasks             cluster_metadata_info
cluster_membership  namespaces        cluster_metadata     
schema_version      namespaces_by_id  schema_update_history
executions          queue_metadata  
queue               history_tree    

token@cqlsh:temporal> use temporal_visibility ;
token@cqlsh:temporal_visibility> desc tables;

open_executions  schema_update_history  schema_version  closed_executions
% helm dependencies update
Getting updates for unmanaged Helm repositories...
...Successfully got an update from the "https://helm.elastic.co" chart repository
...Successfully got an update from the "https://grafana.github.io/helm-charts" chart repository
...Successfully got an update from the "https://prometheus-community.github.io/helm-charts" chart repository
...Successfully got an update from the "https://charts.helm.sh/incubator" chart repository
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "kong" chart repository
...Successfully got an update from the "datastax-examples-kong" chart repository
...Successfully got an update from the "bitnami" chart repository
Update Complete. ⎈Happy Helming!⎈
Saving 4 charts
Downloading cassandra from repo https://charts.helm.sh/incubator
Downloading prometheus from repo https://prometheus-community.github.io/helm-charts
Downloading elasticsearch from repo https://helm.elastic.co
Downloading grafana from repo <a href="https://grafana.github.io/helm-charts">https://grafana.github.io/helm-charts</a>
apiVersion: v1
kind: Secret
metadata:
 name: astra-secret
type: Opaque
data:
 ca.crt: LS0tLS1CRUdJTiBDRV...
 cert: LS0tLS1CRUdJTiBDR....
 key: LS0tLS1CRUdJTiBSU...
volumeMounts:
           ….
           - name: astra-secret
             mountPath: /etc/temporal/secret
             readOnly: true
volumes:
      …
       - name: astra-secret
         secret:
           secretName: astra-secret
           items:
             - key: cert
               path: cert
             - key: ca.crt
               path: ca.crt
             - key: key
               path: key
cassandra:
         disableInitialHostLookup: true
         tls:
           enableHostVerification: false
           enabled: true
           certFile: "/etc/temporal/secret/cert"
           keyFile: "/etc/temporal/secret/key"
           caFile: "/etc/temporal/secret/ca.crt"
         hosts: <your-host-name> //from your config.json file from secure connect bundle
         port: 29042
         keyspace: temporal //"temporal_visibility" for visibility section
         user: "token"
         password: "<your-astra-token>" //can be found in CSV file under "Token" from step 1
         existingSecret: ""
         replicationFactor: 3
         consistency:
           default:
             consistency: "local_quorum"
             serialConsistency: "local_serial"
helm install -f values/values.cassandra.yaml --set elasticsearch.enabled=false temporalastra . --timeout 900s
NAME: temporalastra
LAST DEPLOYED: Thu Mar  3 15:34:39 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
To verify that Temporal has started, run:
  kubectl --namespace=default get pods -l "app.kubernetes.io/instance=temporalastra"
kubectl --namespace=default get pods -l "app.kubernetes.io/instance=temporalastra"
NAME                                                  READY   STATUS    RESTARTS   AGE
temporalastra-admintools-5c5fb5f989-rhdrz           1/1     Running   0          14m
temporalastra-frontend-7767bcdddb-kxqsn             1/1     Running   0          14m
temporalastra-grafana-6bb965b6ff-5kdnq              1/1     Running   0          14m
temporalastra-history-5b798b4965-4sv6q              1/1     Running   0          14m
temporalastra-kube-state-metrics-84ff4fb4c8-lkjbr   1/1     Running   0          14m
temporalastra-matching-65b79bd899-xt6cb             1/1     Running   0          14m
temporalastra-web-7b6c8d64d7-xtqpb                  1/1     Running   0          14m
temporalastra-worker-6dc9568895-h6hkq               1/1     Running   0          14m
% kubectl exec -it services/temporalastra-admintools /bin/bash
bash-5.0# tctl --namespace test namespace re
Namespace test successfully registered.
$ kubectl port-forward services/temporalastra-frontend-headless 7233:7233
Forwarding from 127.0.0.1:7233 -> 7233
Forwarding from [::1]:7233 -> 7233
$ kubectl port-forward services/temporalastra-web 8088:8088
Forwarding from 127.0.0.1:8088 -> 8088
Forwarding from [::1]:8088 -> 8088
Discover more
DataStax Astra DBMicroservices
Share

One-stop Data API for Production GenAI

Astra DB gives JavaScript developers a complete data API and out-of-the-box integrations that make it easier to build production RAG apps with high relevancy and low latency.