From 3171d7af1fd0646a75479bcd737f35b791a39f47 Mon Sep 17 00:00:00 2001 From: Douglas Thomson Date: Wed, 17 May 2023 17:30:04 +0100 Subject: [PATCH 1/2] Enabling the configuration of the hostname during initialization. Done via the environment variable MONGODB_LOCALHOST_NAME Signed-off-by: Douglas Thomson --- .../debian-11/rootfs/opt/bitnami/scripts/libmongodb.sh | 8 ++++---- .../debian-11/rootfs/opt/bitnami/scripts/mongodb-env.sh | 2 ++ .../debian-11/rootfs/opt/bitnami/scripts/libmongodb.sh | 8 ++++---- .../debian-11/rootfs/opt/bitnami/scripts/mongodb-env.sh | 2 ++ bitnami/mongodb/README.md | 2 ++ 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/bitnami/mongodb/5.0/debian-11/rootfs/opt/bitnami/scripts/libmongodb.sh b/bitnami/mongodb/5.0/debian-11/rootfs/opt/bitnami/scripts/libmongodb.sh index 81a1893a3aaa2..b5b16f0c83218 100644 --- a/bitnami/mongodb/5.0/debian-11/rootfs/opt/bitnami/scripts/libmongodb.sh +++ b/bitnami/mongodb/5.0/debian-11/rootfs/opt/bitnami/scripts/libmongodb.sh @@ -667,7 +667,7 @@ mongodb_create_user() { [[ -z "$database" ]] && query="db.getSiblingDB(db.stats().db).createUser({ user: '$user', pwd: '$password', roles: [{role: 'readWrite', db: db.getSiblingDB(db.stats().db).stats().db }] })" # Create user, discarding mongo CLI output for clean logs info "Creating user '$user'..." - mongodb_execute "$MONGODB_ROOT_USER" "$MONGODB_ROOT_PASSWORD" "" "127.0.0.1" <<<"$query" + mongodb_execute "$MONGODB_ROOT_USER" "$MONGODB_ROOT_PASSWORD" "" "$MONGODB_LOCALHOST_NAME" <<<"$query" } ######################## @@ -684,7 +684,7 @@ mongodb_create_users() { if [[ -n "$MONGODB_ROOT_PASSWORD" ]] && ! [[ "$MONGODB_REPLICA_SET_MODE" =~ ^(secondary|arbiter|hidden) ]]; then info "Creating $MONGODB_ROOT_USER user..." - mongodb_execute "" "" "" "127.0.0.1" < Date: Mon, 12 Jun 2023 10:37:10 +0100 Subject: [PATCH 2/2] Update bitnami/mongodb/README.md Signed-off-by: Douglas Thomson <36892985+dtrts@users.noreply.github.com> --- bitnami/mongodb/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bitnami/mongodb/README.md b/bitnami/mongodb/README.md index 6fafc95062c78..70ac04524ce04 100644 --- a/bitnami/mongodb/README.md +++ b/bitnami/mongodb/README.md @@ -579,7 +579,8 @@ Before starting the cluster you need to generate PEM certificates as required by Another option would be to use letsencrypt certificates; the required configuration steps for that scenario are left as an exercise for the user and are beyond the scope of this README. -The hostname used during initialization can be configured using `MONGODB_LOCALHOST_NAME`. Use this to provide a vaild domain for your certificate. Preferably this hostname should be routed back to `127.0.0.1` through the hosts file. If not possible then progress can be made bybinding the mongo server to the correct ip, or all ips, in the configuration. +The hostname used during initialization can be configured using `MONGODB_LOCALHOST_NAME`. Use this to provide a valid domain for your certificate. Preferably this hostname should be routed back to `127.0.0.1` through the hosts file. If not possible then progress can be made by binding the MongoDB server to the correct IP, or all IPs, in the `mongodb.conf` configuration file. +https://www.mongodb.com/docs/manual/reference/configuration-options/#mongodb-setting-net.bindIp #### Generating self-signed certificates