bigchaindb/k8s/scripts/configure_mdb.sh
Ahmed Muawia Khan d977753831 Automate MongoDB user creation for prod/test deployments
- Currently, we had to manually log into the MongoDB container
  and create users, this change will configure the relevant users
  from a single script `configure_mdb.sh`
- Improvements can be done but keeping it minimal for the workshop
2018-02-26 03:37:43 +01:00

11 lines
529 B
Bash
Executable File

#!/bin/bash
[ -z $1 ] && echo "Please specify MongoDB instance name!!"
MONGODB_INSTANCE_NAME=$1
if [[ -n "$MONGODB_INSTANCE_NAME" ]]; then
/usr/local/bin/kubectl exec -it "${MONGODB_INSTANCE_NAME}"\-ss\-0 -- bash -c "if [[ -f /tmp/configure_mongo && -n \$(cat /tmp/configure_mongo) ]]; then /usr/bin/mongo --host localhost --port \$(printenv MONGODB_PORT) --ssl --sslCAFile /etc/mongod/ca/ca.pem --sslPEMKeyFile /etc/mongod/ssl/mdb-instance.pem < /configure_mdb_users.js; fi"
else
echo "Skipping configuration!!!"
fi