From 9445647be56152f0fba11a5950a33c93854bd80c Mon Sep 17 00:00:00 2001 From: "krish7919 (Krish)" Date: Tue, 22 Aug 2017 17:26:15 +0200 Subject: [PATCH] MongoDB data dir config change --- k8s/mongodb/container/docker_build_and_push.bash | 4 ++-- k8s/mongodb/container/mongod.conf.template | 2 +- k8s/mongodb/container/mongod_entrypoint.bash | 5 +++++ k8s/mongodb/mongo-ss.yaml | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/k8s/mongodb/container/docker_build_and_push.bash b/k8s/mongodb/container/docker_build_and_push.bash index 44806682..ce861040 100755 --- a/k8s/mongodb/container/docker_build_and_push.bash +++ b/k8s/mongodb/container/docker_build_and_push.bash @@ -1,5 +1,5 @@ #!/bin/bash -docker build -t bigchaindb/mongodb:3.0 . +docker build -t bigchaindb/mongodb:3.1 . -docker push bigchaindb/mongodb:3.0 +docker push bigchaindb/mongodb:3.1 diff --git a/k8s/mongodb/container/mongod.conf.template b/k8s/mongodb/container/mongod.conf.template index 089313d5..2ad36344 100644 --- a/k8s/mongodb/container/mongod.conf.template +++ b/k8s/mongodb/container/mongod.conf.template @@ -76,7 +76,7 @@ setParameter: authenticationMechanisms: MONGODB-X509,SCRAM-SHA-1 storage: - dbPath: /data/db + dbPath: /data/db/main indexBuildRetry: true journal: enabled: true diff --git a/k8s/mongodb/container/mongod_entrypoint.bash b/k8s/mongodb/container/mongod_entrypoint.bash index fddddf9a..c9f7b027 100755 --- a/k8s/mongodb/container/mongod_entrypoint.bash +++ b/k8s/mongodb/container/mongod_entrypoint.bash @@ -88,6 +88,11 @@ sed -i "s|REPLICA_SET_NAME|${REPLICA_SET_NAME}|g" ${MONGODB_CONF_FILE_PATH} # add the hostname and ip to hosts file echo "${MONGODB_IP} ${MONGODB_FQDN}" >> $HOSTS_FILE_PATH +# create the directory if it does not exist, where MongoDB can store the data +# and config files; this assumes that the data directory is mounted at +# /data/db/main and the config directory is mounted at /data/configdb +mkdir -p /data/db/main /data/configdb/main + # start mongod echo "INFO: starting mongod..." diff --git a/k8s/mongodb/mongo-ss.yaml b/k8s/mongodb/mongo-ss.yaml index f872c288..4bc3cfa2 100644 --- a/k8s/mongodb/mongo-ss.yaml +++ b/k8s/mongodb/mongo-ss.yaml @@ -21,7 +21,7 @@ spec: terminationGracePeriodSeconds: 10 containers: - name: mongodb - image: bigchaindb/mongodb:3.0 + image: bigchaindb/mongodb:3.1 imagePullPolicy: IfNotPresent env: - name: MONGODB_FQDN @@ -104,4 +104,4 @@ spec: - name: ca-auth secret: secretName: ca-auth - defaultMode: 0400 \ No newline at end of file + defaultMode: 0400