These procedures are intended for users with Docker knowledge. We do not provide Docker support, just provide guidelines on how to use it with our product. For more information about Docker, see https://docs.docker.com/

Cassandra provides the primary data persistence layer for Teamwork Cloud.

Preparing Cassandra image

Please check the correct component version in the Third-Party Component Compatibility page and edit the Cassandra and Java versions in the configuration files.

To build a Cassandra image


  1. Create the following files:
    1. cassandra/Dockerfile
      FROM cassandra:5.0.5
      
      # 1. JVM 17 Logging
      RUN echo "-Xlog:gc=info,heap*=info:file=/var/log/cassandra/gc.log::filecount=10,filesize=10485760" >> /etc/cassandra/jvm17-server.options
      
      # 2. Optional configuration tuning
      RUN sed -i -e 's/^#commitlog_segment_size:.*/commitlog_segment_size: 192MiB/' \
          /etc/cassandra/cassandra.yaml
      CODE
    2. cassandra/docker-compose.yml
      Change mem_limit, MAX_HEAP_SIZE, and HEAP_NEWSIZE as needed.
      services:
        cassandra:
          build: .
          container_name: cassandra
          image: localhost/twc_cassandra:latest
          mem_limit: 2g
          ports:
            - "9042:9042"
            - "9160:9160"
          environment:
            - CASSANDRA_SEEDS=cassandra
            - CASSANDRA_LISTEN_ADDRESS=cassandra
            - MAX_HEAP_SIZE=1000M
            - HEAP_NEWSIZE=100M
          volumes:
            - ../data/cassandra/cassandra_data:/var/lib/cassandra
            - ../data/cassandra/cassandra_logs:/var/log/cassandra
          networks:
            - twc-net
          healthcheck:
            test: ["CMD", "cqlsh", "-e", "describe keyspaces"]
            interval: 5s
            timeout: 5s
            retries: 60
      
      networks:
        twc-net:
          external: true
      CODE
  2. Build the image by running the following command:
    cd cassandra;
    docker compose build --no-cache cassandra
    CODE
  3. Start Cassandra by running the following command within the Cassandra folder:
    docker compose up -d
    CODE
  4. Run a health check by executing the following command to check if Cassandra is operational:
    docker exec -it cassandra bash -c 'cqlsh -e "describe keyspaces" && nodetool status && nodetool version'
    CODE


Stopping Service:

To stop the running service, navigate to the service directory and run 

cd twc/cassandra;
docker compose down
CODE