Files
scylladb/dist/docker/docker-entrypoint.py
Michael Litvak 25fb3b49fa dist/docker: add dc and rack arguments
add --dc and --rack commandline arguments to the scylla docker image, to
allow starting a node with a specified dc and rack names in a simple
way.

This is useful mostly for small examples and demonstrations of starting
multiple nodes with different racks, when we prefer not to bother with
editing configuration files. The ability to assign nodes to different
racks is especially important with RF=Rack enforcing.

The previous method to achieve this is to set the snitch to
GossipingPropertyFileSnitch and provide a configuration file in
/etc/scylla/cassandra-rackdc.properties with the name of the dc and
rack.

The new dc and rack parameters are implemented similarly by using the
snitch GossipingPropertyFileSnitch and writing the dc and rack values to
the rackdc properties file. We don't support passing the parameters
together with a different snitch, or when mounting a properties file
from the host, because we don't want to overwrite it.

Example:
docker run -d --name scylla1 scylladb/scylla --dc my_dc1 --rack my_rack1

Fixes scylladb/scylladb#23423

Closes scylladb/scylladb#25607
2025-08-24 17:48:07 +03:00

36 lines
906 B
Python
Executable File

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import signal
import subprocess
import scyllasetup
import logging
import commandlineparser
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG, format="%(message)s")
supervisord = None
def signal_handler(signum, frame):
supervisord.send_signal(signum)
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
try:
arguments, extra_arguments = commandlineparser.parse()
setup = scyllasetup.ScyllaSetup(arguments, extra_arguments=extra_arguments)
setup.developerMode()
setup.cpuSet()
setup.io()
setup.cqlshrc()
setup.write_rackdc_properties()
setup.arguments()
setup.set_housekeeping()
supervisord = subprocess.Popen(["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"])
supervisord.wait()
except Exception:
logging.exception('failed!')