mirror of
https://github.com/bitnami/containers.git
synced 2026-10-17 18:23:14 +02:00
[bitnami/cassandra] Release 5.0.8-debian-12-r5 (#94304)
Signed-off-by: Bitnami Bot <bitnami.bot@broadcom.com>
This commit is contained in:
@@ -8,7 +8,7 @@ ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security"
|
||||
ARG TARGETARCH
|
||||
|
||||
LABEL org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \
|
||||
org.opencontainers.image.created="2026-05-22T09:12:02Z" \
|
||||
org.opencontainers.image.created="2026-06-03T14:43:46Z" \
|
||||
org.opencontainers.image.description="Application packaged by Broadcom, Inc." \
|
||||
org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/cassandra/README.md" \
|
||||
org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/cassandra" \
|
||||
@@ -36,12 +36,12 @@ RUN --mount=type=secret,id=downloads_url,env=SECRET_DOWNLOADS_URL \
|
||||
for COMPONENT in "${COMPONENTS[@]}"; do \
|
||||
if [ ! -f "${COMPONENT}.tar.gz" ]; then \
|
||||
curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \
|
||||
curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \
|
||||
fi ; \
|
||||
sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \
|
||||
sha256sum -c "/opt/bitnami/checksums/${COMPONENT}.tar.gz.sha256" ; \
|
||||
tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner ; \
|
||||
rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \
|
||||
done
|
||||
rm -rf "${COMPONENT}".tar.gz ; \
|
||||
done ; \
|
||||
rm -rf /opt/bitnami/checksums ;
|
||||
RUN apt-get update && apt-get upgrade -y && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
||||
RUN chmod g+rwX /opt/bitnami
|
||||
@@ -55,7 +55,7 @@ RUN /opt/bitnami/scripts/cassandra/postunpack.sh
|
||||
RUN /opt/bitnami/scripts/java/postunpack.sh
|
||||
ENV APP_VERSION="5.0.8" \
|
||||
BITNAMI_APP_NAME="cassandra" \
|
||||
IMAGE_REVISION="3" \
|
||||
IMAGE_REVISION="5" \
|
||||
JAVA_HOME="/opt/bitnami/java" \
|
||||
PATH="/opt/bitnami/python/bin:/opt/bitnami/java/bin:/opt/bitnami/cassandra/bin:$PATH"
|
||||
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
cffef5c8d096cffd9f9af336aa54b306db406d3f51f8d9c460a223dc405d29e6 cassandra-5.0.8-0-linux-amd64-debian-12.tar.gz
|
||||
+1
@@ -0,0 +1 @@
|
||||
af5d015b8969629041f073f5b5af65553d7bd650555b31d1bdcc8d7284f80dd3 cassandra-5.0.8-0-linux-arm64-debian-12.tar.gz
|
||||
+1
@@ -0,0 +1 @@
|
||||
f57e392ddf7e3026a3fe3df1f7b790b815c161f8a024b8c1e0f90d2b0519f0d2 jre-11.0.31-11-1-linux-amd64-debian-12.tar.gz
|
||||
+1
@@ -0,0 +1 @@
|
||||
9c3f321524f50f03055d9406bd72d60e31e31b5ae9a910272e525ec9dcf1f0d1 jre-11.0.31-11-1-linux-arm64-debian-12.tar.gz
|
||||
+1
@@ -0,0 +1 @@
|
||||
6fb6f7b48255c8479886c09b56e8a020692a6c95cdb6d53f0ddb2f80c0e58835 python-3.11.15-13-linux-amd64-debian-12.tar.gz
|
||||
+1
@@ -0,0 +1 @@
|
||||
9803219b1922af24dedb411b93aab649a14229925e6f8bbbfa0729107d96d8b7 python-3.11.15-13-linux-arm64-debian-12.tar.gz
|
||||
@@ -139,3 +139,40 @@ wait_for_log_entry() {
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
########################
|
||||
# Creates a secure temporary file containing the provided secret
|
||||
# Arguments:
|
||||
# $1 - secret to write to the temporary file
|
||||
# Returns:
|
||||
# String
|
||||
#########################
|
||||
credential_to_temp_file() {
|
||||
local secret="$1"
|
||||
local tmp_file
|
||||
|
||||
# Use mktemp with a specific prefix for easier debugging if something lingers
|
||||
if ! tmp_file=$(mktemp "${TMPDIR:-/tmp}/at.cred.XXXXXXXX"); then
|
||||
echo "Error: Failed to create temp file" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Restrict permissions before writing the secret
|
||||
chmod 0600 "$tmp_file"
|
||||
# Write secret and ensure it's flushed to disk
|
||||
printf "%s" "$secret" > "$tmp_file"
|
||||
# Output the filename so the caller can capture it
|
||||
echo "$tmp_file"
|
||||
}
|
||||
|
||||
########################
|
||||
# Cleans up temporary files created by credential_to_temp_file
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# None
|
||||
#########################
|
||||
cleanup_credentials() {
|
||||
debug "Cleaning up temporary files containing credentials"
|
||||
rm -rf "${TMPDIR:-/tmp}"/at.cred.*
|
||||
}
|
||||
|
||||
@@ -131,6 +131,7 @@ relativize() {
|
||||
# -d|--dir-mode - mode for files.
|
||||
# -u|--user - user
|
||||
# -g|--group - group
|
||||
# -n|--no-dereference - do not follow symlinks (use for runtime root chown of daemon-writable dirs)
|
||||
# Returns:
|
||||
# None
|
||||
#########################
|
||||
@@ -140,6 +141,7 @@ configure_permissions_ownership() {
|
||||
local file_mode=""
|
||||
local user=""
|
||||
local group=""
|
||||
local follow_symlinks="yes"
|
||||
|
||||
# Validate arguments
|
||||
shift 1
|
||||
@@ -161,6 +163,9 @@ configure_permissions_ownership() {
|
||||
shift
|
||||
group="${1:?missing group}"
|
||||
;;
|
||||
-n | --no-dereference)
|
||||
follow_symlinks="no"
|
||||
;;
|
||||
*)
|
||||
echo "Invalid command line flag $1" >&2
|
||||
return 1
|
||||
@@ -169,22 +174,29 @@ configure_permissions_ownership() {
|
||||
shift
|
||||
done
|
||||
|
||||
# -L: follow symlinks and emits the target path
|
||||
# This is dangerous at runtime, given a co-located lower-privileged process with write access
|
||||
# to the target path can redirect the chown/chmod to arbitrary paths. Example:
|
||||
# Lower-privileged process run: ln -s /etc /tmp/etc
|
||||
# Then, setup.sh runs: configure_permissions_ownership --dir-mode 775 /tmp
|
||||
local find_L_flag=(); [[ "$follow_symlinks" == "yes" ]] && find_L_flag=("-L")
|
||||
# -h: changes symlink inode ownership without touching the target.
|
||||
local chown_flags=(); [[ "$follow_symlinks" == "no" ]] && chown_flags=("-h")
|
||||
read -r -a filepaths <<<"$paths"
|
||||
for p in "${filepaths[@]}"; do
|
||||
if [[ -e "$p" ]]; then
|
||||
find -L "$p" -printf ""
|
||||
if [[ -n $dir_mode ]]; then
|
||||
find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode"
|
||||
find "${find_L_flag[@]}" "$p" -not -type l -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode"
|
||||
fi
|
||||
if [[ -n $file_mode ]]; then
|
||||
find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode"
|
||||
find "${find_L_flag[@]}" "$p" -not -type l -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode"
|
||||
fi
|
||||
if [[ -n $user ]] && [[ -n $group ]]; then
|
||||
find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}"
|
||||
find "${find_L_flag[@]}" "$p" -print0 | xargs -r -0 chown "${chown_flags[@]}" "${user}:${group}"
|
||||
elif [[ -n $user ]] && [[ -z $group ]]; then
|
||||
find -L "$p" -print0 | xargs -r -0 chown "${user}"
|
||||
find "${find_L_flag[@]}" "$p" -print0 | xargs -r -0 chown "${chown_flags[@]}" "${user}"
|
||||
elif [[ -z $user ]] && [[ -n $group ]]; then
|
||||
find -L "$p" -print0 | xargs -r -0 chgrp "${group}"
|
||||
find "${find_L_flag[@]}" "$p" -print0 | xargs -r -0 chgrp "${chown_flags[@]}" "${group}"
|
||||
fi
|
||||
else
|
||||
stderr_print "$p does not exist"
|
||||
|
||||
@@ -116,6 +116,8 @@ export CASSANDRA_INITSCRIPTS_BOOT_LOG_FILE="${DB_LOG_DIR}/cassandra_init_scripts
|
||||
export DB_INITSCRIPTS_BOOT_LOG_FILE="$CASSANDRA_INITSCRIPTS_BOOT_LOG_FILE"
|
||||
export CASSANDRA_PID_FILE="${DB_TMP_DIR}/cassandra.pid"
|
||||
export DB_PID_FILE="$CASSANDRA_PID_FILE"
|
||||
export CASSANDRA_INIT_SEMAPHORE="${DB_VOLUME_DIR}/.cassandra-init"
|
||||
export DB_INIT_SEMAPHORE="$CASSANDRA_INIT_SEMAPHORE"
|
||||
export PATH="${DB_BIN_DIR}:${BITNAMI_ROOT_DIR}/common/bin:${BITNAMI_ROOT_DIR}/python/bin:${BITNAMI_ROOT_DIR}/java/bin:$PATH"
|
||||
|
||||
# System users (when running with a privileged user)
|
||||
|
||||
@@ -11,6 +11,7 @@ set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
# Load Generic Libraries
|
||||
. /opt/bitnami/scripts/libfile.sh
|
||||
. /opt/bitnami/scripts/libvalidations.sh
|
||||
. /opt/bitnami/scripts/libos.sh
|
||||
. /opt/bitnami/scripts/libcassandra.sh
|
||||
@@ -25,6 +26,8 @@ cassandra_validate
|
||||
cassandra_validate_tls
|
||||
# Ensure 'daemon' user exists when running as 'root'
|
||||
am_i_root && ensure_user_exists "$DB_DAEMON_USER" --group "$DB_DAEMON_GROUP"
|
||||
# Ensure we clean up temporary files when this script ends
|
||||
trap cleanup_credentials EXIT
|
||||
# Ensure Cassandra is initialized
|
||||
cassandra_initialize
|
||||
|
||||
|
||||
@@ -63,15 +63,10 @@ cassandra_setup_client_ssl() {
|
||||
|
||||
mkdir -p "$(dirname "${DB_SSL_CERT_FILE}")"
|
||||
|
||||
# Avoid passing keystore passwords as arguments to keytool, to avoid leaking them given
|
||||
# Avoid passing keystore passwords as arguments to keytool, to avoid leaking them
|
||||
# given a local observer with /proc read access can read them
|
||||
# Instead, we can read them from temporary files
|
||||
local keystore_password_file
|
||||
keystore_password_file="$(mktemp)"
|
||||
chmod 0600 "$keystore_password_file"
|
||||
echo "$DB_KEYSTORE_PASSWORD" > "$keystore_password_file"
|
||||
# shellcheck disable=SC2064
|
||||
trap "rm -f $keystore_password_file" RETURN ERR INT TERM
|
||||
keystore_password_file="$(credential_to_temp_file "$DB_KEYSTORE_PASSWORD")"
|
||||
|
||||
if [[ "${JAVA_FIPS_MODE:-}" == "restricted" ]]; then
|
||||
keytool -importkeystore -srckeystore "${DB_KEYSTORE_LOCATION}" \
|
||||
@@ -766,11 +761,10 @@ cassandra_change_cassandra_password() {
|
||||
|
||||
if (echo "ALTER USER cassandra WITH PASSWORD \$\$${escaped_password}\$\$;" | cassandra_execute_with_retries "$retries" "$sleep_time" "$user" "$old_password"); then
|
||||
debug "ALTER USER command executed. Trying to log in"
|
||||
# ScyllaDB uses 127.0.0.1 explicitly to keep cqlsh on the loopback interface
|
||||
# and avoid the topology-aware reconnect to the pod IP during first-boot init.
|
||||
local cql_host=""
|
||||
[[ "$DB_FLAVOR" = "scylladb" ]] && cql_host="127.0.0.1"
|
||||
wait_for_cql_access "$user" "$new_password" "$cql_host" "$retries" "$sleep_time"
|
||||
# The CQL port is bound to loopback during first-boot credential seeding, so
|
||||
# verify the new password over 127.0.0.1. This also keeps cqlsh on the loopback
|
||||
# interface and avoids the topology-aware reconnect to the pod IP.
|
||||
wait_for_cql_access "$user" "$new_password" "127.0.0.1" "$retries" "$sleep_time"
|
||||
info "Password updated successfully"
|
||||
fi
|
||||
}
|
||||
@@ -901,15 +895,13 @@ cassandra_initialize() {
|
||||
am_i_root && chown -R "$DB_DAEMON_USER:$DB_DAEMON_GROUP" "$dir"
|
||||
done
|
||||
|
||||
if ! is_dir_empty "$DB_DATA_DIR"; then
|
||||
info "Deploying $DB_FLAVOR with persisted data"
|
||||
else
|
||||
info "Deploying $DB_FLAVOR from scratch"
|
||||
__credential_seeding() {
|
||||
if [[ "$DB_FLAVOR" = "scylladb" ]]; then
|
||||
# ScyllaDB 2025.4.5+ (PR #22532): keep cqlsh on loopback during first-boot init.
|
||||
# Otherwise, cqlsh reconnects to the pod IP (via system.local), blocked by the ensure_superuser_is_created gate.
|
||||
cassandra_start_bg "$DB_FIRST_BOOT_LOG_FILE" "" "" "--broadcast-rpc-address 127.0.0.1"
|
||||
else
|
||||
cassandra_yaml_set "rpc_address" "127.0.0.1"
|
||||
cassandra_start_bg "$DB_FIRST_BOOT_LOG_FILE"
|
||||
fi
|
||||
if is_boolean_yes "$DB_PASSWORD_SEEDER"; then
|
||||
@@ -921,10 +913,10 @@ cassandra_initialize() {
|
||||
wait_for_superuser_log_entry "$DB_FIRST_BOOT_LOG_FILE" "$DB_PEER_CQL_MAX_RETRIES" "$DB_PEER_CQL_SLEEP_TIME"
|
||||
wait_for_cql_access "cassandra" "cassandra" "127.0.0.1" "$DB_PEER_CQL_MAX_RETRIES" "$DB_PEER_CQL_SLEEP_TIME"
|
||||
else
|
||||
# Check that all peers are ready
|
||||
for peer in ${DB_PEERS//,/ }; do
|
||||
wait_for_cql_access "cassandra" "cassandra" "$peer" "$DB_PEER_CQL_MAX_RETRIES" "$DB_PEER_CQL_SLEEP_TIME"
|
||||
done
|
||||
# Wait for all peers to be ready before changing the password
|
||||
wait_for_peers_ready "$DB_PEERS" "$DB_PEER_CQL_MAX_RETRIES" "$DB_PEER_CQL_SLEEP_TIME"
|
||||
# Ensure the local auth subsystem is ready (over loopback) before altering it.
|
||||
wait_for_cql_access "cassandra" "cassandra" "127.0.0.1" "$DB_PEER_CQL_MAX_RETRIES" "$DB_PEER_CQL_SLEEP_TIME"
|
||||
fi
|
||||
# Setup user
|
||||
if [[ "$DB_USER" = "cassandra" ]]; then
|
||||
@@ -934,19 +926,23 @@ cassandra_initialize() {
|
||||
fi
|
||||
|
||||
cassandra_execute_startup_cql
|
||||
touch "$CASSANDRA_INIT_SEMAPHORE"
|
||||
else
|
||||
info "Non-seeder node. Waiting for synchronization"
|
||||
# ScyllaDB uses 127.0.0.1 explicitly to keep cqlsh on the loopback interface
|
||||
# and avoid the topology-aware reconnect to the pod IP during first-boot init.
|
||||
local cql_host=""
|
||||
[[ "$DB_FLAVOR" = "scylladb" ]] && cql_host="127.0.0.1"
|
||||
wait_for_cql_access "$DB_USER" "$DB_PASSWORD" "$cql_host" "$DB_PEER_CQL_MAX_RETRIES" "$DB_PEER_CQL_SLEEP_TIME"
|
||||
fi
|
||||
# ScyllaDB is started with '--broadcast-rpc-address 127.0.0.1' for init only;
|
||||
# stop it so the entrypoint can start it cleanly with the real address.
|
||||
if [[ "$DB_FLAVOR" = "scylladb" ]]; then
|
||||
cassandra_stop
|
||||
wait_for_cql_access "$DB_USER" "$DB_PASSWORD" "127.0.0.1" "$DB_PEER_CQL_MAX_RETRIES" "$DB_PEER_CQL_SLEEP_TIME"
|
||||
fi
|
||||
cassandra_stop
|
||||
[[ "$DB_FLAVOR" = "cassandra" && "$DB_ENABLE_REMOTE_CONNECTIONS" = "true" ]] && cassandra_yaml_set "rpc_address" "0.0.0.0"
|
||||
}
|
||||
|
||||
if is_dir_empty "$DB_DATA_DIR"; then
|
||||
info "Deploying $DB_FLAVOR from scratch"
|
||||
__credential_seeding
|
||||
elif [[ ! -f "$CASSANDRA_INIT_SEMAPHORE" ]] && is_boolean_yes "$DB_PASSWORD_SEEDER"; then
|
||||
warn "The init semaphore is absent: the seed pod was interrupted between start and credential seeding. Re-running seeding against the persisted data."
|
||||
__credential_seeding
|
||||
else
|
||||
info "Deploying $DB_FLAVOR with persisted data"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1269,6 +1265,55 @@ wait_for_cql_access() {
|
||||
fi
|
||||
}
|
||||
|
||||
########################
|
||||
# Wait until all cluster peers report Up/Normal (UN) via gossip (nodetool status)
|
||||
# This is used during first-boot credential seeding instead of connecting to each
|
||||
# peer over CQL with the default credentials, which would require exposing the
|
||||
# default superuser on the network.
|
||||
# Globals:
|
||||
# BITNAMI_DEBUG
|
||||
# DB_*
|
||||
# Arguments:
|
||||
# 1 - Comma/space separated list of peers (default: $DB_PEERS)
|
||||
# 2 - Maximum number of retries (default: $DB_PEER_CQL_MAX_RETRIES)
|
||||
# 3 - Sleep time between retries (default: $DB_PEER_CQL_SLEEP_TIME)
|
||||
# Returns:
|
||||
# None
|
||||
#########################
|
||||
wait_for_peers_ready() {
|
||||
local -r peers="${1:-$DB_PEERS}"
|
||||
local -r retries="${2:-$DB_PEER_CQL_MAX_RETRIES}"
|
||||
local -r sleep_time="${3:-$DB_PEER_CQL_SLEEP_TIME}"
|
||||
|
||||
local peer peer_ip
|
||||
for peer in ${peers//,/ }; do
|
||||
peer_ip="$(dns_lookup "$peer" "v4")"
|
||||
[[ -z "$peer_ip" ]] && peer_ip="$peer"
|
||||
info "Waiting for peer $peer to reach Up/Normal (UN) status"
|
||||
|
||||
check_peer_un() {
|
||||
# Using legacy RMI URL parsing to avoid URISyntaxException: 'Malformed IPv6 address at index 7: rmi://[127.0.0.1]:7199' error
|
||||
# https://community.datastax.com/questions/13764/java-version-for-cassandra-3113.html
|
||||
local -r check_cmd=("nodetool" "-Dcom.sun.jndi.rmiURLParsing=legacy")
|
||||
local -r check_args=("status" "--port" "$DB_JMX_PORT_NUMBER")
|
||||
local -r check_regex="UN\s*(${peer}|${peer_ip})"
|
||||
|
||||
local output="/dev/null"
|
||||
if [[ "$BITNAMI_DEBUG" = "true" ]]; then
|
||||
output="/dev/stdout"
|
||||
fi
|
||||
|
||||
"${check_cmd[@]}" "${check_args[@]}" | grep -E "${check_regex}" >"${output}"
|
||||
}
|
||||
|
||||
if ! retry_while check_peer_un "$retries" "$sleep_time"; then
|
||||
error "Peer $peer did not reach Up/Normal (UN) status"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
info "All peers reached Up/Normal (UN) status"
|
||||
}
|
||||
|
||||
########################
|
||||
# Check if Cassandra is running
|
||||
# Globals:
|
||||
|
||||
@@ -159,6 +159,7 @@ The following tables list the main variables you can set.
|
||||
| `CASSANDRA_FIRST_BOOT_LOG_FILE` | Path to the Cassandra first boot log file | `${DB_LOG_DIR}/cassandra_first_boot.log` |
|
||||
| `CASSANDRA_INITSCRIPTS_BOOT_LOG_FILE` | Path to the Cassandra init scripts log file | `${DB_LOG_DIR}/cassandra_init_scripts_boot.log` |
|
||||
| `CASSANDRA_PID_FILE` | Path to the Cassandra pid file | `${DB_TMP_DIR}/cassandra.pid` |
|
||||
| `CASSANDRA_INIT_SEMAPHORE` | Path to the Cassandra init semaphore file | `${DB_VOLUME_DIR}/.cassandra-init` |
|
||||
| `CASSANDRA_DAEMON_USER` | Cassandra system user | `cassandra` |
|
||||
| `CASSANDRA_DAEMON_GROUP` | Cassandra system group | `cassandra` |
|
||||
| `CASSANDRA_CONF_DIR` | Cassandra configuration directory | `${DB_BASE_DIR}/conf` |
|
||||
|
||||
Reference in New Issue
Block a user