From d2789693e0f7f8348c62247734da2f06489bcc7c Mon Sep 17 00:00:00 2001 From: Monet Lee Date: Thu, 31 Oct 2024 16:48:55 +0800 Subject: [PATCH 1/3] fix: improve mongo init command in docker. --- docker-compose.yaml | 2 +- scripts/mongo-init.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 580fe57..5bb0d9a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -6,7 +6,7 @@ services: mongo: image: "${MONGO_IMAGE}" container_name: mongo - command: ["/bin/bash", "-c", "/docker-entrypoint-initdb.d/mongo-init.sh; docker-entrypoint.sh mongod --wiredTigerCacheSizeGB 1 --auth"] + command: ["/bin/bash", "-c", "docker-entrypoint.sh mongod --wiredTigerCacheSizeGB 1 --auth & /docker-entrypoint-initdb.d/mongo-init.sh; wait"] volumes: - "${DATA_DIR}/components/mongodb/data/db:/data/db" - "${DATA_DIR}/components/mongodb/data/logs:/data/logs" diff --git a/scripts/mongo-init.sh b/scripts/mongo-init.sh index 25bb2d6..968bc08 100755 --- a/scripts/mongo-init.sh +++ b/scripts/mongo-init.sh @@ -11,6 +11,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +echo "before running mongosh..." + mongosh < Date: Thu, 31 Oct 2024 17:27:54 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 5bb0d9a..967fea1 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -6,7 +6,7 @@ services: mongo: image: "${MONGO_IMAGE}" container_name: mongo - command: ["/bin/bash", "-c", "docker-entrypoint.sh mongod --wiredTigerCacheSizeGB 1 --auth & /docker-entrypoint-initdb.d/mongo-init.sh; wait"] + command: ["/bin/bash", "-c", "docker-entrypoint.sh mongod --wiredTigerCacheSizeGB 1 --auth; /docker-entrypoint-initdb.d/mongo-init.sh; wait"] volumes: - "${DATA_DIR}/components/mongodb/data/db:/data/db" - "${DATA_DIR}/components/mongodb/data/logs:/data/logs" From 7d4e9fe017634fe2e037014481c1dbb23b6c9a28 Mon Sep 17 00:00:00 2001 From: Monet Lee Date: Thu, 31 Oct 2024 17:33:52 +0800 Subject: [PATCH 3/3] update. --- docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 967fea1..5bb0d9a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -6,7 +6,7 @@ services: mongo: image: "${MONGO_IMAGE}" container_name: mongo - command: ["/bin/bash", "-c", "docker-entrypoint.sh mongod --wiredTigerCacheSizeGB 1 --auth; /docker-entrypoint-initdb.d/mongo-init.sh; wait"] + command: ["/bin/bash", "-c", "docker-entrypoint.sh mongod --wiredTigerCacheSizeGB 1 --auth & /docker-entrypoint-initdb.d/mongo-init.sh; wait"] volumes: - "${DATA_DIR}/components/mongodb/data/db:/data/db" - "${DATA_DIR}/components/mongodb/data/logs:/data/logs"