bitnami / containers

Bitnami container images
https://bitnami.com
Other
3.45k stars 4.91k forks source link

[bitnami/scylladb] Cannot change data center name with SCYLLADB_DATACENTER #74999

Open siavasht opened 6 days ago

siavasht commented 6 days ago

Name and Version

bitnami/scylladb

What architecture are you using?

amd64

What steps will reproduce the bug?

  1. Create a container based on the latest scylladb image and tweak the data center name with SCYLLADB_DATACENTER environment variable.
    # docker run -d --name scylladb -e SCYLLADB_DATACENTER=dc1 bitnami/scylladb:latest
  2. Get data center with cqlsh
    
    # docker exec -it scylladb cqlsh --user cassandra --password cassandra

Warning: Using a password on the command line interface can be insecure. Recommendation: use the credentials file to securely provide the password.

WARNING: cqlsh was built against 5.0.0, but this server is 3.0.8. All features may not work! Connected to My Cluster at 127.0.0.1:9042 [cqlsh 6.2.0 | Cassandra 3.0.8 | CQL spec 3.3.1 | Native protocol v4] Use HELP for help. cassandra@cqlsh> select data_center from system.local;

data_center

datacenter1

(1 rows)


### What is the expected behavior?

Expected to see `dc1 as the name for the local data center.

### What do you see instead?

The name is the default `datacenter1` value.

### Additional information

Looking at `cassandra-rackdc.properties` file inside the container, the value for `dc` is set correctly but the line is commented (same for `rack`). Seems like `cassandra_setup_rack_dc()` function in `libscylladb.sh` scripts doesn't remove comments from the line. One way maybe to remove leading `#` and spaces from the line:

diff --git a/bitnami/scylladb/6.0/debian-12/rootfs/opt/bitnami/scripts/libscylladb.sh b/bitnami/scylladb/6.0/debian-12/rootfs/opt/bitnami/scripts/libscylladb.sh index 7bf0faedc22..18987e6c589 100644 --- a/bitnami/scylladb/6.0/debian-12/rootfs/opt/bitnami/scripts/libscylladb.sh +++ b/bitnami/scylladb/6.0/debian-12/rootfs/opt/bitnami/scripts/libscylladb.sh @@ -797,8 +797,8 @@ cassandra_setup_common_ports() { ######################### cassandra_setup_rack_dc() { if ! cassandra_is_file_external "${DB_MOUNTED_RACKDC_PATH}"; then

javsalgar commented 5 days ago

Hi!

Thank you so much for reporting. As you spotted the issue, would you like to submit a PR with the proposed solution?

siavasht commented 5 days ago

Hi. Sure! Submitted the patch in #75036.

I also spotted another issue with env variables and added a fix in separate commit.

carrodher commented 5 days ago

Thank you for opening this issue and submitting the associated Pull Request. Our team will review and provide feedback. Once the PR is merged, the issue will automatically close.

Your contribution is greatly appreciated!