mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00

* Support for secure TLS communication in MongoDB, MongoDB Monitoring Agent and MongoDB Backup Agent - Move from Golang to Bash for entrypoint program - Update image tag to 2.0 for Backup and Monitoring Agents and to 3.4.4 for MongoDB - Add documentation * changed title & rewrote Step 1 of workflow.rst * copy-edited ca-installation.rst * copy-edited & modified structure of workflow.rst * moved repeated Easy-RSA install & config docs to new page * edited the sentences describing the Easy-RSA dirs * copy-edited the page about generating server certificate * copy-edited the page about generating client certificate * renamed page to 'How to Set Up a Self-Signed Certificate Authority' * copy-edited page about how to revoke a certificate * Comments on how to uniquely name all instances in the cluster * Added comments about the other questions when setting up a CA * Added note about one Agent Api Key per Cloud Manager backup * docs: clarified instructions for generating server CSR * docs: added back 'from your PKI infrastructure' * docs: fixed step & added step re/ FQDNs & certs in workflow.rst * docs: added note re/ the Distinguished Name * Update docs for env vars setup * docs: added tip: how to get help with the easyrsa command
92 lines
2.5 KiB
Bash
Executable File
92 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
MONGODB_PORT=""
|
|
MONGODB_KEY_FILE_PATH=""
|
|
#MONGODB_KEY_FILE_PASSWORD=""
|
|
MONGODB_CA_FILE_PATH=""
|
|
MONGODB_CRL_FILE_PATH=""
|
|
REPLICA_SET_NAME=""
|
|
MONGODB_FQDN=""
|
|
MONGODB_IP=""
|
|
|
|
while [[ $# -gt 1 ]]; do
|
|
arg="$1"
|
|
case $arg in
|
|
--mongodb-port)
|
|
MONGODB_PORT="$2"
|
|
shift
|
|
;;
|
|
--mongodb-key-file-path)
|
|
MONGODB_KEY_FILE_PATH="$2"
|
|
shift
|
|
;;
|
|
--mongodb-key-file-password)
|
|
# TODO(Krish) move this to a mapped file later
|
|
MONGODB_KEY_FILE_PASSWORD="$2"
|
|
shift
|
|
;;
|
|
--mongodb-ca-file-path)
|
|
MONGODB_CA_FILE_PATH="$2"
|
|
shift
|
|
;;
|
|
--mongodb-crl-file-path)
|
|
MONGODB_CRL_FILE_PATH="$2"
|
|
shift
|
|
;;
|
|
--replica-set-name)
|
|
REPLICA_SET_NAME="$2"
|
|
shift
|
|
;;
|
|
--mongodb-fqdn)
|
|
MONGODB_FQDN="$2"
|
|
shift
|
|
;;
|
|
--mongodb-ip)
|
|
MONGODB_IP="$2"
|
|
shift
|
|
;;
|
|
*)
|
|
echo "Unknown option: $1"
|
|
exit 1
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
# sanity checks
|
|
if [[ -z "${REPLICA_SET_NAME}" || \
|
|
-z "${MONGODB_PORT}" || \
|
|
-z "${MONGODB_FQDN}" || \
|
|
-z "${MONGODB_IP}" || \
|
|
-z "${MONGODB_KEY_FILE_PATH}" || \
|
|
-z "${MONGODB_CA_FILE_PATH}" || \
|
|
-z "${MONGODB_CRL_FILE_PATH}" ]] ; then
|
|
#-z "${MONGODB_KEY_FILE_PASSWORD}" || \
|
|
echo "Empty parameters detected. Exiting!"
|
|
exit 2
|
|
fi
|
|
|
|
MONGODB_CONF_FILE_PATH=/etc/mongod.conf
|
|
HOSTS_FILE_PATH=/etc/hosts
|
|
|
|
# configure the mongod.conf file
|
|
sed -i "s|MONGODB_PORT|${MONGODB_PORT}|g" ${MONGODB_CONF_FILE_PATH}
|
|
sed -i "s|MONGODB_KEY_FILE_PATH|${MONGODB_KEY_FILE_PATH}|g" ${MONGODB_CONF_FILE_PATH}
|
|
#sed -i "s|MONGODB_KEY_FILE_PASSWORD|${MONGODB_KEY_FILE_PASSWORD}|g" ${MONGODB_CONF_FILE_PATH}
|
|
sed -i "s|MONGODB_CA_FILE_PATH|${MONGODB_CA_FILE_PATH}|g" ${MONGODB_CONF_FILE_PATH}
|
|
sed -i "s|MONGODB_CRL_FILE_PATH|${MONGODB_CRL_FILE_PATH}|g" ${MONGODB_CONF_FILE_PATH}
|
|
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
|
|
|
|
# start mongod
|
|
echo "INFO: starting mongod..."
|
|
|
|
# TODO Uncomment the first exec command and use it instead of the second one
|
|
# after https://github.com/docker-library/mongo/issues/172 is resolved. Check
|
|
# for other bugs too.
|
|
#exec /entrypoint.sh mongod --config ${MONGODB_CONF_FILE_PATH}
|
|
exec /usr/bin/mongod --config ${MONGODB_CONF_FILE_PATH}
|