Update mongodb user configuration

- Update docs for azure cluster deployment template
- Update entrypoint for MongoDB to handle user configuration
  more efficiently
- remove `use admin` in js file, that is an invalid format
This commit is contained in:
Ahmed Muawia Khan 2018-02-26 14:45:21 +01:00
parent d977753831
commit 7cea7298f0
3 changed files with 9 additions and 9 deletions

View File

@ -102,7 +102,7 @@ Finally, you can deploy an ACS using something like:
$ az acs create --name <a made-up cluster name> \
--resource-group <name of resource group created earlier> \
--master-count 3 \
--agent-count 2 \
--agent-count 3 \
--admin-username ubuntu \
--agent-vm-size Standard_L4s \
--dns-prefix <make up a name> \
@ -225,4 +225,4 @@ CAUTION: You might end up deleting resources other than the ACS cluster.
Next, you can :doc: `run a BigchainDB node/cluster(BFT) <node-on-kubernetes>`
on your new Kubernetes cluster.
on your new Kubernetes cluster.

View File

@ -1,4 +1,4 @@
use admin;
db = db.getSiblingDB("admin");
db.createUser({
user: "MONGODB_ADMIN_USERNAME",
pwd: "MONGODB_ADMIN_PASSWORD",
@ -12,7 +12,7 @@ db.createUser({
}
]
});
use admin;
db = db.getSiblingDB("admin");
db.auth("MONGODB_ADMIN_USERNAME", "MONGODB_ADMIN_PASSWORD");
db.getSiblingDB("$external").runCommand({
createUser: 'BDB_USERNAME',

View File

@ -13,7 +13,7 @@ configure_mongo=true
MONGODB_CREDENTIALS_DIR=/tmp/mongodb
mongodb_admin_password=""
mongodb_admin_username=`printenv MONGODB_ADMIN_USERNAME || true`
mongodb_admin_password=`printenv MONGODB_ADMIN_PASSWORD || true`
mongodb_admin_password=""
bdb_username=`printenv BDB_USERNAME || true`
mdb_mon_username=`printenv MDB_MON_USERNAME || true`
@ -102,10 +102,10 @@ if [ -f ${MONGODB_CREDENTIALS_DIR}/mdb-admin-password ]; then
fi
# Only configure if all variables are set
if [[ -z "${mongodb_admin_username}" && \
-z "${mongodb_admin_password}" && \
-z "${bdb_username}" && \
-z "${mdb_mon_username}" ]]; then
if [[ -n "${mongodb_admin_username}" && \
-n "${mongodb_admin_password}" && \
-n "${bdb_username}" && \
-n "${mdb_mon_username}" ]]; then
sed -i "s|MONGODB_ADMIN_USERNAME|${mongodb_admin_username}|g" ${MONGODB_CONFIGURE_USERS_PATH}
sed -i "s|MONGODB_ADMIN_PASSWORD|${mongodb_admin_password}|g" ${MONGODB_CONFIGURE_USERS_PATH}
sed -i "s|BDB_USERNAME|${bdb_username}|g" ${MONGODB_CONFIGURE_USERS_PATH}