4.2.19-debian-10-r50 release

This commit is contained in:
Bitnami Bot 2022-04-21 21:28:58 +00:00 committed by Bitnami Containers
parent 2d5523b935
commit e0c6e2efeb
7 changed files with 71 additions and 54 deletions

View File

@ -9,10 +9,11 @@ ENV HOME="/" \
COPY prebuildfs /
# Install required system packages and dependencies
RUN install_packages acl ca-certificates curl gzip libc6 libcom-err2 libcurl4 libffi6 libgcc1 libgcrypt20 libgmp10 libgnutls30 libgpg-error0 libgssapi-krb5-2 libhogweed4 libidn2-0 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libldap-2.4-2 libnettle6 libnghttp2-14 libp11-kit0 libpcap0.8 libpsl5 librtmp1 libsasl2-2 libssh2-1 libssl1.1 libtasn1-6 libunistring2 numactl procps tar zlib1g
RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "mongodb-shell" "1.3.1-0" --checksum 13407d9f6a5ae6b0895faf702da3e919c03354349506b2bcf19da0a3545e7f8c
RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "yq" "4.24.5-0" --checksum bdae511963f6a46ad128f41f9a6f2eec8c56fbb4929619fcd54232edfec6209e
RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "wait-for-port" "1.0.1-10" --checksum 35c818ba3f4b5aae905959bc7d3a5e81fc63786e3c662b604612c0aa7fcda8fd
RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "render-template" "1.0.1-10" --checksum 97c2ae4b001c5937e888b920bee7b1a40a076680caac53ded6d10f6207d54565
RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "mongodb" "4.2.19-1" --checksum 3d763e80a87697b1c5a4231f2465e8dc1450b8f735379789ae4d1061792be811
RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "mongodb" "4.2.19-2" --checksum 3d763e80a87697b1c5a4231f2465e8dc1450b8f735379789ae4d1061792be811
RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "gosu" "1.14.0-7" --checksum d6280b6f647a62bf6edc74dc8e526bfff63ddd8067dcb8540843f47203d9ccf1
RUN apt-get update && apt-get upgrade -y && \
rm -r /var/lib/apt/lists /var/cache/apt/archives

View File

@ -11,7 +11,14 @@
"digest": "3d763e80a87697b1c5a4231f2465e8dc1450b8f735379789ae4d1061792be811",
"distro": "debian-10",
"type": "NAMI",
"version": "4.2.19-1"
"version": "4.2.19-2"
},
"mongodb-shell": {
"arch": "amd64",
"digest": "13407d9f6a5ae6b0895faf702da3e919c03354349506b2bcf19da0a3545e7f8c",
"distro": "debian-10",
"type": "NAMI",
"version": "1.3.1-0"
},
"render-template": {
"arch": "amd64",

View File

@ -23,14 +23,14 @@ mongodb_sharded_shard_currently_in_cluster() {
local -r replicaset="${1:?node is required}"
local result
result=$(mongodb_execute_print_output "$MONGODB_ROOT_USER" "$MONGODB_ROOT_PASSWORD" "admin" "$MONGODB_MONGOS_HOST" "$MONGODB_MONGOS_PORT_NUMBER" <<EOF
result=$(
mongodb_execute_print_output "$MONGODB_ROOT_USER" "$MONGODB_ROOT_PASSWORD" "admin" "$MONGODB_MONGOS_HOST" "$MONGODB_MONGOS_PORT_NUMBER" <<EOF
db.adminCommand({ listShards: 1 })
EOF
)
grep -q "id.*$replicaset" <<< "$result"
)
grep -q "id.*$replicaset" <<<"$result"
}
###############
# Initialize MongoDB (mongod) service with sharded configuration
# Globals:
@ -105,7 +105,7 @@ mongodb_sharded_validate() {
local error_code=0
if ! (mongodb_validate); then
error_code=1
error_code=1
fi
# Auxiliary functions
@ -116,39 +116,39 @@ mongodb_sharded_validate() {
if [[ -z "$MONGODB_SHARDING_MODE" ]]; then
print_validation_error "You need to speficy one of the sharding modes: mongos, shardsvr or configsvr"
fi
if [[ "$MONGODB_SHARDING_MODE" = "mongos" ]] || { [[ "$MONGODB_SHARDING_MODE" = "shardsvr" ]] && [[ "$MONGODB_REPLICA_SET_MODE" = "primary" ]] ;}; then
if [[ "$MONGODB_SHARDING_MODE" = "mongos" ]] || { [[ "$MONGODB_SHARDING_MODE" = "shardsvr" ]] && [[ "$MONGODB_REPLICA_SET_MODE" = "primary" ]]; }; then
if [[ -z "$MONGODB_ROOT_PASSWORD" ]]; then
print_validation_error "Missing root password for the Config Server. Set MONGODB_ROOT_PASSWORD"
print_validation_error "Missing root password for the Config Server. Set MONGODB_ROOT_PASSWORD"
fi
fi
if [[ "$MONGODB_SHARDING_MODE" =~ (shardsvr|configsvr) ]]; then
if [[ -z "$MONGODB_REPLICA_SET_MODE" ]]; then
print_validation_error "Sharding requires setting replica set mode. Set MONGODB_REPLICA_SET_MODE"
print_validation_error "Sharding requires setting replica set mode. Set MONGODB_REPLICA_SET_MODE"
fi
fi
if [[ "$MONGODB_SHARDING_MODE" = "mongos" ]]; then
if [[ -z "$MONGODB_CFG_PRIMARY_HOST" ]]; then
print_validation_error "Missing primary host for the Config Server. Set MONGODB_CFG_PRIMARY_HOST"
print_validation_error "Missing primary host for the Config Server. Set MONGODB_CFG_PRIMARY_HOST"
fi
if [[ -z "$MONGODB_CFG_REPLICA_SET_NAME" ]]; then
print_validation_error "Missing replica set name for the Config Server. Set MONGODB_CFG_REPLICA_SET_NAME"
print_validation_error "Missing replica set name for the Config Server. Set MONGODB_CFG_REPLICA_SET_NAME"
fi
if [[ -z "$MONGODB_REPLICA_SET_KEY" ]]; then
print_validation_error "Missing replica set key for the Config Server. Set MONGODB_REPLICA_SET_KEY"
print_validation_error "Missing replica set key for the Config Server. Set MONGODB_REPLICA_SET_KEY"
fi
fi
if [[ "$MONGODB_SHARDING_MODE" = "shardsvr" ]] && [[ "$MONGODB_REPLICA_SET_MODE" = "primary" ]]; then
if [[ -z "$MONGODB_MONGOS_HOST" ]]; then
print_validation_error "Missing mongos host for registration. Set MONGODB_MONGOS_HOST"
print_validation_error "Missing mongos host for registration. Set MONGODB_MONGOS_HOST"
fi
fi
if [[ "$MONGODB_SHARDING_MODE" = "configsvr" ]]; then
if [[ "$MONGODB_REPLICA_SET_MODE" = "arbiter" ]]; then
print_validation_error "Arbiters are not allowed in Config Server replicasets"
print_validation_error "Arbiters are not allowed in Config Server replicasets"
fi
fi
@ -212,11 +212,12 @@ mongodb_sharded_is_join_shard_pending() {
local -r password="${5:?password is required}"
local result
result=$(mongodb_execute_print_output "$user" "$password" "admin" "$mongos_host" "$mongos_port" <<EOF
result=$(
mongodb_execute_print_output "$user" "$password" "admin" "$mongos_host" "$mongos_port" <<EOF
sh.addShard("$shard_connection_string")
EOF
)
grep -q "\"ok\" : 1" <<< "$result"
)
grep -q "ok: 1" <<<"$result"
}
########################
@ -237,20 +238,20 @@ mongodb_sharded_configure_replica_set() {
mongodb_restart
case "$MONGODB_REPLICA_SET_MODE" in
"primary" )
if [[ "$MONGODB_SHARDING_MODE" =~ ^(configsvr|shardsvr)$ ]]; then
mongodb_sharded_reconfigure_svr_primary "$node"
fi
;;
"secondary")
mongodb_configure_secondary "$node" "$MONGODB_PORT_NUMBER"
;;
"arbiter")
mongodb_configure_arbiter "$node" "$MONGODB_PORT_NUMBER"
;;
"dynamic")
# Do nothing
;;
"primary")
if [[ "$MONGODB_SHARDING_MODE" =~ ^(configsvr|shardsvr)$ ]]; then
mongodb_sharded_reconfigure_svr_primary "$node"
fi
;;
"secondary")
mongodb_configure_secondary "$node" "$MONGODB_PORT_NUMBER"
;;
"arbiter")
mongodb_configure_arbiter "$node" "$MONGODB_PORT_NUMBER"
;;
"dynamic")
# Do nothing
;;
esac
if [[ "$MONGODB_REPLICA_SET_MODE" = "secondary" ]]; then
@ -270,11 +271,12 @@ mongodb_sharded_configure_replica_set() {
mongodb_sharded_initiate_svr_primary() {
mongodb_sharded_is_svr_initiated() {
local result
result=$(mongodb_execute_print_output "" "" "" "127.0.0.1" <<EOF
result=$(
mongodb_execute_print_output "" "" "" "127.0.0.1" <<EOF
rs.initiate({"_id":"$MONGODB_REPLICA_SET_NAME", "protocolVersion":1, "members":[{"_id":0,"host":"127.0.0.1:$MONGODB_PORT_NUMBER"}]})
EOF
)
grep -q "\"ok\" : 1" <<< "$result"
grep -q "ok: 1" <<<"$result"
}
mongodb_start_bg
@ -301,11 +303,12 @@ mongodb_sharded_is_svr_primary_reconfigured() {
local -r node="${1:?node is required}"
local result
result=$(mongodb_execute_print_output "root" "$MONGODB_ROOT_PASSWORD" "admin" "$node" "$MONGODB_PORT_NUMBER" <<EOF
result=$(
mongodb_execute_print_output "root" "$MONGODB_ROOT_PASSWORD" "admin" "$node" "$MONGODB_PORT_NUMBER" <<EOF
rs.reconfig({"_id":"$MONGODB_REPLICA_SET_NAME","configsvr": $([[ "$MONGODB_SHARDING_MODE" = "configsvr" ]] && echo "true" || echo "false"),"protocolVersion":1,"members":[{"_id":0,"host":"$node:$MONGODB_PORT_NUMBER","priority":5}]})
EOF
)
grep -q "\"ok\" : 1" <<< "$result"
)
grep -q "ok: 1" <<<"$result"
}
########################

View File

@ -783,12 +783,12 @@ EOF
# Code 23 is considered OK
# It indicates that the node is already initialized
if grep -q "\"code\" : 23" <<<"$result"; then
if grep -q "already initialized" <<<"$result"; then
warn "Node already initialized."
return 0
fi
if ! grep -q "\"ok\" : 1" <<<"$result"; then
if ! grep -q "ok: 1" <<<"$result"; then
warn "Problem initiating replica set
request: rs.initiate({\"_id\":\"$MONGODB_REPLICA_SET_NAME\", \"members\":[{\"_id\":0,\"host\":\"$node:$port\",\"priority\":5}]})
response: $result"
@ -812,7 +812,7 @@ mongodb_set_dwc() {
db.adminCommand({"setDefaultRWConcern" : 1, "defaultWriteConcern" : {"w" : "majority"}})
EOF
)
if grep -q "\"ok\" : 1" <<<"$result"; then
if grep -q "ok: 1" <<<"$result"; then
debug 'Setting Default Write Concern to {"setDefaultRWConcern" : 1, "defaultWriteConcern" : {"w" : "majority"}}'
return 0
else
@ -848,11 +848,11 @@ EOF
# Error code 103 is considered OK
# It indicates a possibly desynced configuration, which will become resynced when the secondary joins the replicaset
# Note: Error NewReplicaSetConfigurationIncompatible rejects the node addition so we need to filter it out
if { grep -q "\"code\" : 103" <<<"$result"; } && ! { grep -q "NewReplicaSetConfigurationIncompatible" <<<"$result"; }; then
if { grep -q "code: 103" <<<"$result"; } && ! { grep -q "NewReplicaSetConfigurationIncompatible" <<<"$result"; }; then
warn "The ReplicaSet configuration is not aligned with primary node's configuration. Starting secondary node so it syncs with ReplicaSet..."
return 0
fi
grep -q "\"ok\" : 1" <<<"$result"
grep -q "ok: 1" <<<"$result"
}
########################
@ -908,7 +908,7 @@ EOF
)
debug "$result"
grep -q "\"ok\" : 1" <<<"$result"
grep -q "ok: 1" <<<"$result"
}
########################
@ -937,11 +937,11 @@ EOF
# Error code 103 is considered OK.
# It indicates a possiblely desynced configuration,
# which will become resynced when the hidden joins the replicaset.
if grep -q "\"code\" : 103" <<<"$result"; then
if grep -q "code: 103" <<<"$result"; then
warn "The ReplicaSet configuration is not aligned with primary node's configuration. Starting hidden node so it syncs with ReplicaSet..."
return 0
fi
grep -q "\"ok\" : 1" <<<"$result"
grep -q "ok: 1" <<<"$result"
}
########################
@ -967,7 +967,7 @@ mongodb_is_arbiter_node_pending() {
rs.addArb('$node:$port')
EOF
)
grep -q "\"ok\" : 1" <<<"$result"
grep -q "ok: 1" <<<"$result"
}
########################
@ -1060,7 +1060,7 @@ mongodb_is_node_available() {
db.getUsers()
EOF
)
if ! grep -q "\"user\" :" <<<"$result"; then
if ! grep -q "user:" <<<"$result"; then
# If no password was provided on first run
# it may be the case that DB is up but has no users
[[ -z $password ]] && grep -q "\[\ \]" <<<"$result"
@ -1242,11 +1242,11 @@ mongodb_is_not_in_sync() {
result=$(
mongodb_execute_print_output "$MONGODB_INITIAL_PRIMARY_ROOT_USER" "$MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD" "admin" "$MONGODB_INITIAL_PRIMARY_HOST" "$MONGODB_INITIAL_PRIMARY_PORT_NUMBER" <<EOF
db.printSlaveReplicationInfo()
db.printSecondaryReplicationInfo()
EOF
)
grep -q -E "^[[:space:]]*0 secs" <<<"$result"
grep -q -E "'0 secs" <<<"$result"
}
########################
@ -1289,7 +1289,7 @@ mongodb_node_currently_in_cluster() {
rs.status().members
EOF
)
grep -q -E "\"${node}:${port}\"" <<<"$result"
grep -q -E "'${node}:${port}'" <<<"$result"
}
########################
@ -1470,7 +1470,7 @@ mongodb_is_file_external() {
# version
#########################
mongodb_get_version() {
mongo --version 2>/dev/null | grep 'shell version v' | sed 's/.* v//g'
mongod --version 2>/dev/null | awk -F\" '/"version"/ {print $4}'
}
########################
@ -1582,7 +1582,7 @@ mongodb_execute_print_output() {
fi
[[ -n "$database" ]] && args+=("$database")
"$MONGODB_BIN_DIR/mongo" "${args[@]}"
"$MONGODB_BIN_DIR/mongosh" "${args[@]}"
}
########################
@ -1641,5 +1641,5 @@ mongodb_execute() {
fi
[[ -n "$database" ]] && args+=("$database")
"$MONGODB_BIN_DIR/mongo" "${args[@]}"
"$MONGODB_BIN_DIR/mongosh" "${args[@]}"
}

View File

@ -96,6 +96,8 @@ export MONGODB_CONF_FILE="$MONGODB_CONF_DIR/mongodb.conf"
export MONGODB_KEY_FILE="$MONGODB_CONF_DIR/keyfile"
export MONGODB_DB_SHELL_FILE="/.dbshell"
export MONGODB_RC_FILE="/.mongorc.js"
export MONGOSH_DIR="/.mongodb"
export MONGOSH_RC_FILE="/.mongoshrc.js"
export MONGODB_PID_FILE="$MONGODB_TMP_DIR/mongodb.pid"
export MONGODB_LOG_FILE="$MONGODB_LOG_DIR/mongodb.log"
export MONGODB_INITSCRIPTS_DIR="/docker-entrypoint-initdb.d"

View File

@ -28,6 +28,10 @@ render-template "$MONGODB_MONGOS_TEMPLATES_FILE" > "$MONGODB_MONGOS_CONF_FILE"
touch "$MONGODB_DB_SHELL_FILE" && chmod g+rw "$MONGODB_DB_SHELL_FILE"
# Create .mongorc.js file to avoid error message
touch "$MONGODB_RC_FILE" && chmod g+rw "$MONGODB_RC_FILE"
# Create .mongoshrc.js file to avoid error message
touch "$MONGOSH_RC_FILE" && chmod g+rw "$MONGOSH_RC_FILE"
# Create .mongodb folder to avoid error message
mkdir "$MONGOSH_DIR" && chmod g+rwX "$MONGOSH_DIR"
chmod g+w "$MONGODB_CONF_FILE"
chmod g+w "$MONGODB_MONGOS_CONF_FILE"
# Redirect all logging to stdout

View File

@ -47,7 +47,7 @@ Learn more about the Bitnami tagging policy and the difference between rolling t
* [`5.0`, `5.0-debian-10`, `5.0.7`, `5.0.7-debian-10-r8`, `latest` (5.0/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-mongodb/blob/5.0.7-debian-10-r8/5.0/debian-10/Dockerfile)
* [`4.4`, `4.4-debian-10`, `4.4.13`, `4.4.13-debian-10-r49` (4.4/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-mongodb/blob/4.4.13-debian-10-r49/4.4/debian-10/Dockerfile)
* [`4.2`, `4.2-debian-10`, `4.2.19`, `4.2.19-debian-10-r49` (4.2/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-mongodb/blob/4.2.19-debian-10-r49/4.2/debian-10/Dockerfile)
* [`4.2`, `4.2-debian-10`, `4.2.19`, `4.2.19-debian-10-r50` (4.2/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-mongodb/blob/4.2.19-debian-10-r50/4.2/debian-10/Dockerfile)
Subscribe to project updates by watching the [bitnami/mongodb GitHub repo](https://github.com/bitnami/bitnami-docker-mongodb).