#!/bin/bash
MONGO_PORT="4002"
MONGO_BIN="/opt/hth/embedded/bin/mongo"
MONGO_DB_NAME="hth_production"
LOGS_PATH="/var/log/hth/create_mongodb_users.log"
# Add user
#
# $1 - db
# $2 - username
# $3 - password
mongo_add_root_user(){
cat <<EOF
use admin;
db.createUser({user: "${1}",pwd: "${2}",roles: [ "root" ]});
EOF
}
mongo_add_db_user() {
cat <<EOF
use $1;
db.createUser({user: "${2}",pwd: "${3}",roles: [ { role: "dbOwner", db: "${1}"}]});
EOF
}
show_admin_users() {
cat <<-EOF
use admin;
show users;
EOF
}
read -p "Enter username for Helix TeamHub MongoDB admin: " admin_username
read -s -p "Enter password for Helix TeamHub MongoDB admin: " admin_password
mongo_add_root_user $admin_username $admin_password | $MONGO_BIN --port $MONGO_PORT >> $LOGS_PATH 2>&1
echo
read -p "Enter username for Helix TeamHub MongoDB user: " hth_username
read -s -p "Enter password for Helix TeamHub MongoDB user: " hth_password
mongo_add_db_user $MONGO_DB_NAME $hth_username $hth_password | $MONGO_BIN --port $MONGO_PORT >> $LOGS_PATH 2>&1
echo
exit 0
# |
Change |
User |
Description |
Committed |
|
#1
|
23695 |
Jen Bottom |
Adding some cluster configuration, and changing the location of the HTH setup with a separate Helix Core VM (combo) |
|
|