# version: "3.9" # optional since v1.27.0 networks: spaceandtime: ipam: config: - subnet: 172.20.0.0/24 # static ip management required for cassandra web, as this does not work with docker dns services: cass1: image: cassandra:4.0.4 # latest lts version as of 31.05.2022 container_name: cass1 hostname: cass1 healthcheck: test: ["CMD", "cqlsh", "-e", "describe keyspaces" ] interval: 10s timeout: 10s start_period: 50s retries: 10 networks: spaceandtime: ipv4_address: 172.20.0.6 ports: - "9042:9042" volumes: - ./cqlsh:/root/.cassandra - ./startup:/tmp/startup - ./data/cass1:/var/lib/cassandra - ./etc/cass1:/etc/cassandra # currently not needed as this is configured with the below env variables environment: &environment MAX_HEAP_SIZE: 1024M HEAP_NEWSIZE: 1024M CASSANDRA_SEEDS: "cass1,cass2" CASSANDRA_CLUSTER_NAME: SolarSystem CASSANDRA_DC: Mars CASSANDRA_RACK: West CASSANDRA_ENDPOINT_SNITCH: GossipingPropertyFileSnitch CASSANDRA_NUM_TOKENS: 128 restart: always cass2: image: cassandra:4.0.4 # latest lts version as of 31.05.2022 container_name: cass2 hostname: cass2 healthcheck: test: ["CMD", "cqlsh", "-e", "describe keyspaces" ] interval: 10s timeout: 10s start_period: 50s retries: 10 networks: spaceandtime: ipv4_address: 172.20.0.7 ports: - "9043:9042" volumes: - ./cqlsh:/root/.cassandra - ./startup:/tmp/startup - ./data/cass2:/var/lib/cassandra - ./etc/cass2:/etc/cassandra environment: *environment depends_on: cass1: condition: service_healthy # service_healthy --> sometimes not working, alternativly restart always policy below restart: always cass3: image: cassandra:4.0.4 # latest lts version as of 31.05.2022 container_name: cass3 hostname: cass3 healthcheck: test: ["CMD", "cqlsh", "-e", "describe keyspaces" ] interval: 10s timeout: 10s start_period: 50s retries: 10 networks: spaceandtime: ipv4_address: 172.20.0.8 ports: - "9044:9042" volumes: - ./cqlsh:/root/.cassandra - ./startup:/tmp/startup - ./data/cass3:/var/lib/cassandra - ./etc/cass3:/etc/cassandra environment: *environment depends_on: cass2: condition: service_healthy # service_healthy --> sometimes not working, alternativly restart always policy below restart: always cass_startup_client: image: cassandra:4.0.4 # latest lts version as of 31.05.2022 container_name: cass_startup_client hostname: cass_startup_client networks: spaceandtime: ipv4_address: 172.20.0.11 volumes: - ./cqlsh:/root/.cassandra - ./startup:/tmp/startup - ./data/cass_startup_client:/var/lib/cassandra - ./etc/cass_startup_client:/etc/cassandra environment: *environment depends_on: cass1: condition: service_healthy # service_healthy --> sometimes not working, alternativly restart always policy below cass2: condition: service_healthy # service_healthy --> sometimes not working, alternativly restart always policy below cass3: condition: service_healthy command: bash -c "/tmp/startup/setup/setup_db.sh && /tmp/startup/setup/setup_likedFrom.sh" cassweb: image: ruby:2.4.1 # latest stable version as of 31.05.2022 container_name: cassweb hostname: cassweb command: bash -c "gem install cassandra-web && cassandra-web --hosts '172.20.0.6, 172.20.0.7, 172.20.0.8' --port '9042' --username 'cassandra' --password 'cassandra'" networks: spaceandtime: ipv4_address: 172.20.0.9 ports: - "3000:3000" depends_on: cass1: condition: service_healthy # service_healthy --> sometimes not working, alternativly restart always policy below cass2: condition: service_healthy # service_healthy --> sometimes not working, alternativly restart always policy below cass3: condition: service_healthy # service_healthy --> sometimes not working, alternativly restart always policy below cass_startup_client: condition: service_started restart: always