From 6513af11c8c91f0a9f56ef23483f9056493daef4 Mon Sep 17 00:00:00 2001 From: Bitnami Bot Date: Thu, 11 Jan 2024 17:14:50 +0100 Subject: [PATCH] [bitnami/mongodb] Release 6.0.12-debian-11-r6 (#54682) Signed-off-by: Bitnami Containers --- bitnami/mongodb/6.0/debian-11/Dockerfile | 10 +-- .../opt/bitnami/.bitnami_components.json | 6 +- .../debian-11/prebuildfs/usr/sbin/run-script | 2 +- .../rootfs/opt/bitnami/scripts/libmongodb.sh | 26 +++---- .../rootfs/opt/bitnami/scripts/mongodb-env.sh | 6 +- bitnami/mongodb/README.md | 71 +++++++++++++++++++ 6 files changed, 97 insertions(+), 24 deletions(-) diff --git a/bitnami/mongodb/6.0/debian-11/Dockerfile b/bitnami/mongodb/6.0/debian-11/Dockerfile index 4273ccc1014d..61191368507d 100644 --- a/bitnami/mongodb/6.0/debian-11/Dockerfile +++ b/bitnami/mongodb/6.0/debian-11/Dockerfile @@ -7,10 +7,10 @@ ARG TARGETARCH LABEL com.vmware.cp.artifact.flavor="sha256:1e1b4657a77f0d47e9220f0c37b9bf7802581b93214fff7d1bd2364c8bf22e8e" \ org.opencontainers.image.base.name="docker.io/bitnami/minideb:bullseye" \ - org.opencontainers.image.created="2023-12-27T15:33:27Z" \ + org.opencontainers.image.created="2024-01-11T15:47:47Z" \ org.opencontainers.image.description="Application packaged by VMware, Inc" \ org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="6.0.12-debian-11-r5" \ + org.opencontainers.image.ref.name="6.0.12-debian-11-r6" \ org.opencontainers.image.title="mongodb" \ org.opencontainers.image.vendor="VMware, Inc." \ org.opencontainers.image.version="6.0.12" @@ -27,9 +27,9 @@ RUN install_packages ca-certificates curl libbrotli1 libcom-err2 libcurl4 libffi RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ COMPONENTS=( \ "mongodb-shell-2.1.1-0-linux-${OS_ARCH}-debian-11" \ - "yq-4.40.5-0-linux-${OS_ARCH}-debian-11" \ - "wait-for-port-1.0.7-4-linux-${OS_ARCH}-debian-11" \ - "render-template-1.0.6-4-linux-${OS_ARCH}-debian-11" \ + "yq-4.40.5-1-linux-${OS_ARCH}-debian-11" \ + "wait-for-port-1.0.7-5-linux-${OS_ARCH}-debian-11" \ + "render-template-1.0.6-5-linux-${OS_ARCH}-debian-11" \ "mongodb-6.0.12-2-linux-${OS_ARCH}-debian-11" \ ) ; \ for COMPONENT in "${COMPONENTS[@]}"; do \ diff --git a/bitnami/mongodb/6.0/debian-11/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/mongodb/6.0/debian-11/prebuildfs/opt/bitnami/.bitnami_components.json index 2a14dedb8ceb..3fb9261bbf03 100644 --- a/bitnami/mongodb/6.0/debian-11/prebuildfs/opt/bitnami/.bitnami_components.json +++ b/bitnami/mongodb/6.0/debian-11/prebuildfs/opt/bitnami/.bitnami_components.json @@ -15,18 +15,18 @@ "arch": "amd64", "distro": "debian-11", "type": "NAMI", - "version": "1.0.6-4" + "version": "1.0.6-5" }, "wait-for-port": { "arch": "amd64", "distro": "debian-11", "type": "NAMI", - "version": "1.0.7-4" + "version": "1.0.7-5" }, "yq": { "arch": "amd64", "distro": "debian-11", "type": "NAMI", - "version": "4.40.5-0" + "version": "4.40.5-1" } } \ No newline at end of file diff --git a/bitnami/mongodb/6.0/debian-11/prebuildfs/usr/sbin/run-script b/bitnami/mongodb/6.0/debian-11/prebuildfs/usr/sbin/run-script index b7a5bf1e50bf..4ca0f897277e 100755 --- a/bitnami/mongodb/6.0/debian-11/prebuildfs/usr/sbin/run-script +++ b/bitnami/mongodb/6.0/debian-11/prebuildfs/usr/sbin/run-script @@ -10,7 +10,7 @@ fi script=$1 exit_code="${2:-96}" -fail_if_not_present="${3:-y}" +fail_if_not_present="${3:-n}" if test -f "$script"; then sh $script diff --git a/bitnami/mongodb/6.0/debian-11/rootfs/opt/bitnami/scripts/libmongodb.sh b/bitnami/mongodb/6.0/debian-11/rootfs/opt/bitnami/scripts/libmongodb.sh index 3c6f40101f1d..9f18d67751cb 100644 --- a/bitnami/mongodb/6.0/debian-11/rootfs/opt/bitnami/scripts/libmongodb.sh +++ b/bitnami/mongodb/6.0/debian-11/rootfs/opt/bitnami/scripts/libmongodb.sh @@ -383,7 +383,7 @@ mongodb_start_bg() { fi # wait until the server is up and answering queries - if ! retry_while "mongodb_is_mongodb_started" "$MONGODB_MAX_TIMEOUT"; then + if ! retry_while "mongodb_is_mongodb_started" "$MONGODB_INIT_RETRY_ATTEMPTS" "$MONGODB_INIT_RETRY_DELAY"; then error "MongoDB did not start" exit 1 fi @@ -423,7 +423,7 @@ mongodb_stop() { info "Stopping MongoDB..." stop_service_using_pid "$MONGODB_PID_FILE" - if ! retry_while "is_mongodb_not_running" "$MONGODB_MAX_TIMEOUT"; then + if ! retry_while "is_mongodb_not_running" "$MONGODB_INIT_RETRY_ATTEMPTS" "$MONGODB_INIT_RETRY_DELAY"; then error "MongoDB failed to stop" exit 1 fi @@ -1003,7 +1003,7 @@ mongodb_configure_primary() { info "Configuring MongoDB primary node" wait-for-port --timeout 360 "$MONGODB_PORT_NUMBER" - if ! retry_while "mongodb_is_primary_node_initiated $node $port" "$MONGODB_MAX_TIMEOUT"; then + if ! retry_while "mongodb_is_primary_node_initiated $node $port" "$MONGODB_INIT_RETRY_ATTEMPTS" "$MONGODB_INIT_RETRY_DELAY"; then error "MongoDB primary node failed to get configured" exit 1 fi @@ -1024,7 +1024,7 @@ mongodb_wait_confirmation() { local -r port="${2:?port is required}" debug "Waiting until ${node}:${port} is added to the replica set..." - if ! retry_while "mongodb_node_currently_in_cluster ${node} ${port}" "$MONGODB_MAX_TIMEOUT"; then + if ! retry_while "mongodb_node_currently_in_cluster ${node} ${port}" "$MONGODB_INIT_RETRY_ATTEMPTS" "$MONGODB_INIT_RETRY_DELAY"; then error "Unable to confirm that ${node}:${port} has been added to the replica set!" exit 1 else @@ -1098,14 +1098,14 @@ mongodb_wait_for_node() { debug "Waiting for primary node..." info "Trying to connect to MongoDB server $host..." - if ! retry_while "wait-for-port --host $host --timeout 10 $port" "$MONGODB_MAX_TIMEOUT"; then + if ! retry_while "wait-for-port --host $host --timeout 10 $port" "$MONGODB_INIT_RETRY_ATTEMPTS" "$MONGODB_INIT_RETRY_DELAY"; then error "Unable to connect to host $host" exit 1 else info "Found MongoDB server listening at $host:$port !" fi - if ! retry_while "mongodb_is_node_available $host $port $user $password" "$MONGODB_MAX_TIMEOUT"; then + if ! retry_while "mongodb_is_node_available $host $port $user $password" "$MONGODB_INIT_RETRY_ATTEMPTS" "$MONGODB_INIT_RETRY_DELAY"; then error "Node $host did not become available" exit 1 else @@ -1130,7 +1130,7 @@ mongodb_wait_for_primary_node() { mongodb_wait_for_node "$host" "$port" "$user" "$password" debug "Waiting for primary host $host to be ready..." - if ! retry_while "mongodb_is_primary_node_up $host $port $user $password" "$MONGODB_MAX_TIMEOUT"; then + if ! retry_while "mongodb_is_primary_node_up $host $port $user $password" "$MONGODB_INIT_RETRY_ATTEMPTS" "$MONGODB_INIT_RETRY_DELAY"; then error "Unable to validate $host as primary node in the replica set scenario!" exit 1 else @@ -1158,7 +1158,7 @@ mongodb_configure_secondary() { info "Node currently in the cluster" else info "Adding node to the cluster" - if ! retry_while "mongodb_is_secondary_node_pending $node $port" "$MONGODB_MAX_TIMEOUT"; then + if ! retry_while "mongodb_is_secondary_node_pending $node $port" "$MONGODB_INIT_RETRY_ATTEMPTS" "$MONGODB_INIT_RETRY_DELAY"; then error "Secondary node did not get ready" exit 1 fi @@ -1166,14 +1166,14 @@ mongodb_configure_secondary() { # Ensure that secondary nodes do not count as voting members until they are fully initialized # https://docs.mongodb.com/manual/reference/method/rs.add/#behavior - if ! retry_while "mongodb_is_secondary_node_ready $node $port" "$MONGODB_MAX_TIMEOUT"; then + if ! retry_while "mongodb_is_secondary_node_ready $node $port" "$MONGODB_INIT_RETRY_ATTEMPTS" "$MONGODB_INIT_RETRY_DELAY"; then error "Secondary node did not get marked as secondary" exit 1 fi # Grant voting rights to node # https://docs.mongodb.com/manual/tutorial/modify-psa-replica-set-safely/ - if ! retry_while "mongodb_configure_secondary_node_voting $node $port" "$MONGODB_MAX_TIMEOUT"; then + if ! retry_while "mongodb_configure_secondary_node_voting $node $port" "$MONGODB_INIT_RETRY_ATTEMPTS" "$MONGODB_INIT_RETRY_DELAY"; then error "Secondary node did not get marked as secondary" exit 1 fi @@ -1208,7 +1208,7 @@ mongodb_configure_hidden() { info "Node currently in the cluster" else info "Adding hidden node to the cluster" - if ! retry_while "mongodb_is_hidden_node_pending $node $port" "$MONGODB_MAX_TIMEOUT"; then + if ! retry_while "mongodb_is_hidden_node_pending $node $port" "$MONGODB_INIT_RETRY_ATTEMPTS" "$MONGODB_INIT_RETRY_DELAY"; then error "Hidden node did not get ready" exit 1 fi @@ -1236,7 +1236,7 @@ mongodb_configure_arbiter() { info "Node currently in the cluster" else info "Configuring MongoDB arbiter node" - if ! retry_while "mongodb_is_arbiter_node_pending $node $port" "$MONGODB_MAX_TIMEOUT"; then + if ! retry_while "mongodb_is_arbiter_node_pending $node $port" "$MONGODB_INIT_RETRY_ATTEMPTS" "$MONGODB_INIT_RETRY_DELAY"; then error "Arbiter node did not get ready" exit 1 fi @@ -1277,7 +1277,7 @@ EOF mongodb_wait_until_sync_complete() { info "Waiting until initial data sync is complete..." - if ! retry_while "mongodb_is_not_in_sync" "$MONGODB_MAX_TIMEOUT" 1; then + if ! retry_while "mongodb_is_not_in_sync" "$MONGODB_INIT_RETRY_ATTEMPTS" "$MONGODB_INIT_RETRY_DELAY" 1; then error "Initial data sync did not finish after $MONGODB_MAX_TIMEOUT seconds" exit 1 else diff --git a/bitnami/mongodb/6.0/debian-11/rootfs/opt/bitnami/scripts/mongodb-env.sh b/bitnami/mongodb/6.0/debian-11/rootfs/opt/bitnami/scripts/mongodb-env.sh index de9a36d80bde..82494e9b9f47 100644 --- a/bitnami/mongodb/6.0/debian-11/rootfs/opt/bitnami/scripts/mongodb-env.sh +++ b/bitnami/mongodb/6.0/debian-11/rootfs/opt/bitnami/scripts/mongodb-env.sh @@ -25,7 +25,8 @@ export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" # variable will be overridden with the value specified in that file mongodb_env_vars=( MONGODB_MOUNTED_CONF_DIR - MONGODB_MAX_TIMEOUT + MONGODB_INIT_RETRY_ATTEMPTS + MONGODB_INIT_RETRY_DELAY MONGODB_PORT_NUMBER MONGODB_ENABLE_MAJORITY_READ MONGODB_DEFAULT_ENABLE_MAJORITY_READ @@ -106,7 +107,8 @@ export MONGODB_DAEMON_GROUP="mongo" # MongoDB configuration export MONGODB_MOUNTED_CONF_DIR="${MONGODB_MOUNTED_CONF_DIR:-${MONGODB_VOLUME_DIR}/conf}" -export MONGODB_MAX_TIMEOUT="${MONGODB_MAX_TIMEOUT:-35}" +export MONGODB_INIT_RETRY_ATTEMPTS="${MONGODB_INIT_RETRY_ATTEMPTS:-7}" +export MONGODB_INIT_RETRY_DELAY="${MONGODB_INIT_RETRY_DELAY:-5}" export MONGODB_DEFAULT_PORT_NUMBER="27017" export MONGODB_PORT_NUMBER="${MONGODB_PORT_NUMBER:-$MONGODB_DEFAULT_PORT_NUMBER}" export MONGODB_ENABLE_MAJORITY_READ="${MONGODB_ENABLE_MAJORITY_READ:-true}" diff --git a/bitnami/mongodb/README.md b/bitnami/mongodb/README.md index f558eea8537c..78db63e0857a 100644 --- a/bitnami/mongodb/README.md +++ b/bitnami/mongodb/README.md @@ -169,6 +169,77 @@ docker-compose up -d ## Configuration +### Environment variables + +| Name | Description | Default Value | Can be set | +|--------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------|------------| +| `$MONGODB_DISABLE_SERVICE` | Whether to disable the MongoDB service by default. | `no` | ✓ | +| `$MONGODB_VOLUME_DIR` | Persistence base directory | `$BITNAMI_VOLUME_DIR/mongodb` | | +| `$MONGODB_BASE_DIR` | MongoDB installation directory | `$BITNAMI_ROOT_DIR/mongodb` | | +| `$MONGODB_CONF_DIR` | MongoDB configuration directory | `$MONGODB_BASE_DIR/conf` | | +| `$MONGODB_LOG_DIR` | MongoDB logs directory | `$MONGODB_BASE_DIR/logs` | | +| `$MONGODB_DATA_DIR` | MongoDB data directory | `${MONGODB_VOLUME_DIR}/data` | | +| `$MONGODB_TMP_DIR` | MongoDB temporary directory | `$MONGODB_BASE_DIR/tmp` | | +| `$MONGODB_BIN_DIR` | MongoDB executables directory | `$MONGODB_BASE_DIR/bin` | | +| `$MONGODB_TEMPLATES_DIR` | Directory where the mongodb.conf template file is stored | `$MONGODB_BASE_DIR/templates` | | +| `$MONGODB_MONGOD_TEMPLATES_FILE` | Path to the mongodb.conf template file | `$MONGODB_TEMPLATES_DIR/mongodb.conf.tpl` | | +| `$MONGODB_CONF_FILE` | Path to MongoDB configuration file | `$MONGODB_CONF_DIR/mongodb.conf` | | +| `$MONGODB_KEY_FILE` | Path to the MongoDB replica set keyfile | `$MONGODB_CONF_DIR/keyfile` | | +| `$MONGODB_DB_SHELL_FILE` | Path to MongoDB dbshell file | `/.dbshell` | | +| `$MONGODB_RC_FILE` | Path to MongoDB rc file | `/.mongorc.js` | | +| `$MONGOSH_DIR` | Path to mongosh directory | `/.mongodb` | | +| `$MONGOSH_RC_FILE` | Path to mongosh rc file | `/.mongoshrc.js` | | +| `$MONGODB_PID_FILE` | Path to the MongoDB PID file | `$MONGODB_TMP_DIR/mongodb.pid` | | +| `$MONGODB_LOG_FILE` | Path to the MongoDB log file | `$MONGODB_LOG_DIR/mongodb.log` | | +| `$MONGODB_INITSCRIPTS_DIR` | Path to the MongoDB container init scripts directory | `/docker-entrypoint-initdb.d` | | +| `$MONGODB_DAEMON_USER` | MongoDB system user | `mongo` | | +| `$MONGODB_DAEMON_GROUP` | MongoDB system group | `mongo` | | +| `$MONGODB_MOUNTED_CONF_DIR` | Directory for including custom configuration files (that override the default generated ones) | `${MONGODB_VOLUME_DIR}/conf` | ✓ | +| `$MONGODB_INIT_RETRY_ATTEMPTS` | Maximum retries for checking the service initialization status | `7` | ✓ | +| `$MONGODB_INIT_RETRY_DELAY` | Time (in seconds) to wait between retries for checking the service initialization status | `5` | ✓ | +| `$MONGODB_DEFAULT_PORT_NUMBER` | MongoDB port set at build time | `27017` | | +| `$MONGODB_PORT_NUMBER` | MongoDB port | `$MONGODB_DEFAULT_PORT_NUMBER` | ✓ | +| `$MONGODB_ENABLE_MAJORITY_READ` | Enable majority read in MongoDB operations | `true` | ✓ | +| `$MONGODB_DEFAULT_ENABLE_MAJORITY_READ` | Enable majority read in MongoDB operations set at build time | `true` | ✓ | +| `$MONGODB_EXTRA_FLAGS` | Extra flags for MongoDB initialization | | ✓ | +| `$MONGODB_ENABLE_NUMACTL` | Execute commands using numactl | `false` | ✓ | +| `$MONGODB_SHELL_EXTRA_FLAGS` | Extra flags when using the mongodb client during initialization (useful when mounting init scripts) | | ✓ | +| `$MONGODB_ADVERTISED_HOSTNAME` | Hostname to use for advertising the MongoDB service | | ✓ | +| `$MONGODB_ADVERTISE_IP` | Whether advertised hostname is set to container ip | `false` | ✓ | +| `$MONGODB_ADVERTISED_PORT_NUMBER` | MongoDB advertised port number. It is recommended to pass this environment variable if you have a proxy port forwarding requests to container. | | ✓ | +| `$MONGODB_DISABLE_JAVASCRIPT` | Disable MongoDB server-side javascript execution | `no` | ✓ | +| `$MONGODB_ENABLE_JOURNAL` | Enable MongoDB journal | | ✓ | +| `$MONGODB_DEFAULT_ENABLE_JOURNAL` | Enable MongoDB journal at build time | `true` | | +| `$MONGODB_DISABLE_SYSTEM_LOG` | Disable MongoDB daemon system log | | ✓ | +| `$MONGODB_DEFAULT_DISABLE_SYSTEM_LOG` | Disable MongoDB daemon system log set at build time | `false` | | +| `$MONGODB_ENABLE_DIRECTORY_PER_DB` | Use a separate folder for storing each database data | | ✓ | +| `$MONGODB_DEFAULT_ENABLE_DIRECTORY_PER_DB` | Use a separate folder for storing each database data set at build time | `false` | | +| `$MONGODB_ENABLE_IPV6` | Use IPv6 for database connections | | ✓ | +| `$MONGODB_DEFAULT_ENABLE_IPV6` | Use IPv6 for database connections set at build time | `false` | | +| `$MONGODB_SYSTEM_LOG_VERBOSITY` | MongoDB daemon log level | | ✓ | +| `$MONGODB_DEFAULT_SYSTEM_LOG_VERBOSITY` | MongoDB daemon log level set at build time | `0` | | +| `$MONGODB_ROOT_USER` | User name for the MongoDB root user | `root` | ✓ | +| `$MONGODB_ROOT_PASSWORD` | Password for the MongoDB root user | | ✓ | +| `$MONGODB_USERNAME` | User to generate at initialization time | | ✓ | +| `$MONGODB_PASSWORD` | Password for the non-root user specified in MONGODB_USERNAME | | ✓ | +| `$MONGODB_DATABASE` | Name of the database to create at initialization time | | ✓ | +| `$MONGODB_METRICS_USERNAME` | User used for metrics collection, for example with mongodb_exporter | | ✓ | +| `$MONGODB_METRICS_PASSWORD` | Password for the non-root user specified in MONGODB_METRICS_USERNAME | | ✓ | +| `$MONGODB_EXTRA_USERNAMES` | Comma or semicolon separated list of extra users to be created. | | ✓ | +| `$MONGODB_EXTRA_PASSWORDS` | Comma or semicolon separated list of passwords for the users specified in MONGODB_EXTRA_USERNAMES. | | ✓ | +| `$MONGODB_EXTRA_DATABASES` | Comma or semicolon separated list of databases to create at initialization time for the users specified in MONGODB_EXTRA_USERNAMES. | | ✓ | +| `$ALLOW_EMPTY_PASSWORD` | Permit accessing MongoDB without setting any password | `no` | ✓ | +| `$MONGODB_REPLICA_SET_MODE` | MongoDB replica set mode. Can be one of primary, secondary or arbiter | | ✓ | +| `$MONGODB_DEFAULT_REPLICA_SET_NAME` | Name of the MongoDB replica set at build time | `replicaset` | | +| `$MONGODB_REPLICA_SET_NAME` | Name of the MongoDB replica set | `$MONGODB_DEFAULT_REPLICA_SET_NAME` | ✓ | +| `$MONGODB_REPLICA_SET_KEY` | MongoDB replica set key | | ✓ | +| `$MONGODB_INITIAL_PRIMARY_HOST` | Hostname of the replica set primary node (necessary for arbiter and secondary nodes) | | ✓ | +| `$MONGODB_INITIAL_PRIMARY_PORT_NUMBER` | Port of the replica set primary node (necessary for arbiter and secondary nodes) | `27017` | ✓ | +| `$MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD` | Primary node root user password (necessary for arbiter and secondary nodes) | | ✓ | +| `$MONGODB_INITIAL_PRIMARY_ROOT_USER` | Primary node root username (necessary for arbiter and secondary nodes) | `root` | ✓ | +| `$MONGODB_SET_SECONDARY_OK` | Mark node as readable. Necessary for cases where the PVC is lost | `no` | ✓ | + + ### Initializing a new instance When the container is executed for the first time, it will execute the files with extensions `.sh`, and `.js` located at `/docker-entrypoint-initdb.d`.