aboutsummaryrefslogtreecommitdiffstats
path: root/distribution/cassandra/docker-entrypoint.sh
diff options
context:
space:
mode:
Diffstat (limited to 'distribution/cassandra/docker-entrypoint.sh')
-rw-r--r--distribution/cassandra/docker-entrypoint.sh46
1 files changed, 9 insertions, 37 deletions
diff --git a/distribution/cassandra/docker-entrypoint.sh b/distribution/cassandra/docker-entrypoint.sh
index a42d498e..34825bd2 100644
--- a/distribution/cassandra/docker-entrypoint.sh
+++ b/distribution/cassandra/docker-entrypoint.sh
@@ -4,13 +4,13 @@ set -e
# first arg is `-f` or `--some-option`
# or there are no args
if [ "$#" -eq 0 ] || [ "${1#-}" != "$1" ]; then
- set -- cassandra -f "$@"
+ set -- cassandra -f "$@"
fi
# allow the container to be started with `--user`
if [ "$1" = 'cassandra' -a "$(id -u)" = '0' ]; then
- chown -R cassandra /var/lib/cassandra /var/log/cassandra "$CASSANDRA_CONFIG"
- exec gosu cassandra "$BASH_SOURCE" "$@"
+ chown -R cassandra /var/lib/cassandra /var/log/cassandra "$CASSANDRA_CONFIG"
+ exec gosu cassandra "$BASH_SOURCE" "$@"
fi
_ip_address() {
@@ -33,45 +33,17 @@ if [ "$1" = 'cassandra' ]; then
CASSANDRA_LISTEN_ADDRESS="$(_ip_address)"
fi
- : ${CASSANDRA_BROADCAST_ADDRESS="$CASSANDRA_LISTEN_ADDRESS"}
+echo "#############################################"
+echo "############## Update music.cql #############"
+echo "#############################################"
if [ "$CASSANDRA_BROADCAST_ADDRESS" = 'auto' ]; then
CASSANDRA_BROADCAST_ADDRESS="$(_ip_address)"
fi
- : ${CASSANDRA_BROADCAST_RPC_ADDRESS:=$CASSANDRA_BROADCAST_ADDRESS}
-
- if [ -n "${CASSANDRA_NAME:+1}" ]; then
- : ${CASSANDRA_SEEDS:="cassandra"}
+ if [ "${MUSIC_REPLICATION_FACTOR}" ]; then
+ sed -ri 's/REPLICATION_FACTOR/'${MUSIC_REPLICATION_FACTOR}'/' "$f"
fi
- : ${CASSANDRA_SEEDS:="$CASSANDRA_BROADCAST_ADDRESS"}
-
- sed -ri 's/(- seeds:).*/\1 "'"$CASSANDRA_SEEDS"'"/' "$CASSANDRA_CONFIG/cassandra.yaml"
-
- for yaml in \
- broadcast_address \
- broadcast_rpc_address \
- cluster_name \
- endpoint_snitch \
- listen_address \
- num_tokens \
- rpc_address \
- start_rpc \
- ; do
- var="CASSANDRA_${yaml^^}"
- val="${!var}"
- if [ "$val" ]; then
- sed -ri 's/^(# )?('"$yaml"':).*/\2 '"$val"'/' "$CASSANDRA_CONFIG/cassandra.yaml"
- fi
- done
-
- for rackdc in dc rack; do
- var="CASSANDRA_${rackdc^^}"
- val="${!var}"
- if [ "$val" ]; then
- sed -ri 's/^('"$rackdc"'=).*/\1 '"$val"'/' "$CASSANDRA_CONFIG/cassandra-rackdc.properties"
- fi
- done
-fi
+done
echo "#############################################"
echo "############## Update music.cql #############"