fix: MongoDB init
This commit is contained in:
@@ -49,6 +49,7 @@ services:
|
|||||||
mongo-init:
|
mongo-init:
|
||||||
<<: *default
|
<<: *default
|
||||||
image: mongo:${MONGO_VERSION:-8.0.13}
|
image: mongo:${MONGO_VERSION:-8.0.13}
|
||||||
|
restart: on-failure
|
||||||
depends_on:
|
depends_on:
|
||||||
mongo1:
|
mongo1:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@@ -66,11 +67,13 @@ services:
|
|||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
set -e
|
set -e
|
||||||
echo "Waiting for MongoDB node to be ready..."
|
echo "Waiting for MongoDB nodes to be ready..."
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
mongosh \
|
mongosh \
|
||||||
--host "mongodb://$${MONGO_INITDB_ROOT_USERNAME}:$${MONGO_INITDB_ROOT_PASSWORD}@$${MONGO_HOST}:$${MONGO_PORT_1}" \
|
--host "$${MONGO_HOST}:$${MONGO_PORT_1}" \
|
||||||
|
--username "$${MONGO_INITDB_ROOT_USERNAME}" \
|
||||||
|
--password "$${MONGO_INITDB_ROOT_PASSWORD}" \
|
||||||
--authenticationDatabase admin \
|
--authenticationDatabase admin \
|
||||||
--eval "
|
--eval "
|
||||||
const config = {
|
const config = {
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ services:
|
|||||||
mongo-init:
|
mongo-init:
|
||||||
<<: *default
|
<<: *default
|
||||||
image: mongo:${MONGO_VERSION:-8.0.13}
|
image: mongo:${MONGO_VERSION:-8.0.13}
|
||||||
|
restart: on-failure
|
||||||
depends_on:
|
depends_on:
|
||||||
mongo1:
|
mongo1:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@@ -85,7 +86,9 @@ services:
|
|||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
mongosh \
|
mongosh \
|
||||||
--host "mongodb://$${MONGO_INITDB_ROOT_USERNAME}:$${MONGO_INITDB_ROOT_PASSWORD}@$${MONGO_HOST}:$${MONGO_PORT_1}" \
|
--host "$${MONGO_HOST}:$${MONGO_PORT_1}" \
|
||||||
|
--username "$${MONGO_INITDB_ROOT_USERNAME}" \
|
||||||
|
--password "$${MONGO_INITDB_ROOT_PASSWORD}" \
|
||||||
--authenticationDatabase admin \
|
--authenticationDatabase admin \
|
||||||
--eval "
|
--eval "
|
||||||
const config = {
|
const config = {
|
||||||
|
|||||||
Reference in New Issue
Block a user