Astra + Lagom

Connect your existing Lagom app to Astra

Follow me on GitHub

How I Connected A Lagom App To Astra

Lagom was actually the first framework migration I was involved with here at Datastax. Following ankitp1342 lead I supported the full migration from a single 3 node Datastax Enterprise on-prem to multi-cluster multi-tentant infrastructure on Astra. This application has been migrated and running on Astra (AWS) for over 3 months now. Recently however a few Lagom developers responded on a GitHub Issue I created to ask Lagom to update their base driver version to 3.8 or higher. Java based cassandra applications need the cassandra 3.8 or hire driver to connect to Astra. Thank you vcanuel for the change details and motivation to add this blog page.

First we must update dependencies in pom.xml:


      <!-- -->

Next we need to unpack the Astra Secure Bundle and gather some connection details found within:

stevenmatison@smatison-rmbp16 secure-connect-12413de1-f1a2-4171-9dfb-7df93b64cb55 % ls -al          
total 64
drwxr-xr-x@  10 stevenmatison  staff    320 Nov 24 09:25 .
drwx------@ 431 stevenmatison  staff  13792 Mar 19 08:55 ..
-rw-------@   1 stevenmatison  staff   1460 Nov 24 08:34 ca.crt
-rw-------@   1 stevenmatison  staff   1464 Nov 24 08:34 cert
-rw-r--r--@   1 stevenmatison  staff   3719 Nov 24 08:34 cert.pfx
-rw-r--r--@   1 stevenmatison  staff    476 Nov 24 08:34 config.json
-rw-r--r--@   1 stevenmatison  staff    193 Nov 24 08:34 cqlshrc
-rw-r--r--@   1 stevenmatison  staff   2812 Nov 24 08:34 identity.jks
-rw-------@   1 stevenmatison  staff   1675 Nov 24 08:34 key
-rw-r--r--@   1 stevenmatison  staff   1522 Nov 24 08:34 trustStore.jks

Next checkout the contents of config.json:

stevenmatison@smatison-rmbp16 secure-connect-12413de1-f1a2-4171-9dfb-7df93b64cb55 % cat config.json 
  "host": "",
  "port": 32220,
  "keyspace": "petclinic",
  "localDC": "dc-1",
  "caCertLocation": "./ca.crt",
  "keyLocation": "./key",
  "certLocation": "./cert",
  "keyStoreLocation": "./identity.jks",
  "keyStorePassword": "iT4MjPX78Rcxm9W0n",
  "trustStoreLocation": "./trustStore.jks",
  "trustStorePassword": "4wv2UDpH5CN7yam6M",
  "csvLocation": "./data",
  "pfxCertPassword": "myY9e216n8PTDwbJW"

Apply values in lagom configs:

cassandra.default {

  contact-points = ${?CASSANDRA_CONTACT_POINTS}

  authentication {
    username = ${?CASSANDRA_USERNAME}
    password = ${?CASSANDRA_PASSWORD}

  ssl {
    truststore.path = ${?CASSANDRA_TRUSTSTORE_PATH}
    truststore.password = ${?CASSANDRA_TRUSTSTORE_PASSWORD}
    keystore.path = ${?CASSANDRA_KEYSTORE_PATH}
    keystore.password = ${?CASSANDRA_KEYSTORE_PASSWORD}

//Those values are environment variables
// for example: CASSANDRA_CONTACT_POINTS= http://[host]:[port] where host/port is from config.json above

How can I help you with Astra?


Find me over on the Astra Slack to ask me any questions about Astra. Also let’s chat if you have something kewl you did with Astra and you want me to feature it in my blog. Look below or to the right for more ways to find me.