Building Cassandra container
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.
Building 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
- Create the following files:
- cassandra/Dockerfile
FROM cassandra:5.0.5 # 1. Fix JVM Logging (Added double-colon before file rotation options) RUN echo "-Xlog:gc=info,heap*=info:file=/var/log/cassandra/gc.log::filecount=10,filesize=10485760" >> /etc/cassandra/jvm17-server.options # 2. Fix "HEAP_NEWSIZE“ RUN sed -i 's/^HEAP_NEWSIZE=.*/#HEAP_NEWSIZE=/' /etc/cassandra/cassandra-env.sh # 3. Optional configuration tuning RUN sed -i -e 's/^#commitlog_segment_size:.*/commitlog_segment_size: 192MiB/' \ /etc/cassandra/cassandra.yamlSHELL - cassandra/docker-compose.ymlChange mem_limit,MAX_HEAP_SIZE,HEAP_NEWSIZE as needed.
version: '2.4' 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: trueSHELL
- cassandra/Dockerfile
- Build the image by running the following command:
docker compose build --no-cache cassandraSHELL - Start Cassandra by running the following command within the Cassandra folder:
docker compose up -dSHELL - 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'SHELL