version: '3.9' services: cassandra_server: container_name: cassandra build: context: ./cassandra args: CASSANDRA_TAG: ${CASSANDRA_TAG} image: emqx-cassandra restart: always environment: CASSANDRA_BROADCAST_ADDRESS: "1.2.3.4" CASSANDRA_RPC_ADDRESS: "0.0.0.0" HEAP_NEWSIZE: "128M" MAX_HEAP_SIZE: "2048M" volumes: - ./certs:/certs #ports: # - "9042:9042" # - "9142:9142" command: - /bin/bash - -c - | /opt/cassandra/bin/cassandra -f -R > /cassandra.log & /opt/cassandra/bin/cqlsh -u cassandra -p cassandra -e "CREATE KEYSPACE mqtt WITH REPLICATION = { 'class':'SimpleStrategy','replication_factor':1};" while [[ $$? -ne 0 ]];do sleep 5; /opt/cassandra/bin/cqlsh -u cassandra -p cassandra -e "CREATE KEYSPACE mqtt WITH REPLICATION = { 'class':'SimpleStrategy','replication_factor':1};"; done /opt/cassandra/bin/cqlsh -u cassandra -p cassandra -e "describe keyspaces;" tail -f /cassandra.log networks: - emqx_bridge