mongodb/mongo/bootstrap.sh
Martin Donnelly 8f89fe12d7 init
2018-04-04 22:13:47 +01:00

33 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
#if []; then
# Import the MongoDB public key (was #7F0CEB10) (3.2.0 = EA312927)
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
# Set up the list files
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
# Update to get the MongoDB packages
apt-get update
# Install specific version of mongodb
apt-get install -y mongodb-org=3.2.1 mongodb-org-server=3.2.1 mongodb-org-shell=3.2.1 mongodb-org-mongos=3.2.1 mongodb-org-tools=3.2.1
# Pin that specific version so it doesn't get updated by apt-get
echo "mongodb-org hold" | dpkg --set-selections
echo "mongodb-org-server hold" | dpkg --set-selections
echo "mongodb-org-shell hold" | dpkg --set-selections
echo "mongodb-org-mongos hold" | dpkg --set-selections
echo "mongodb-org-tools hold" | dpkg --set-selections
# Generate our trial certificates
mkdir /vagrant/mongo/keys
openssl req -subj '/CN=Comcarde-Developer/O=Comcarde Engineer Developer Cert/C=UK' -newkey rsa:2048 -new -x509 -days 365 -nodes -out /vagrant/mongo/keys/mongodb-cert.crt -keyout /vagrant/mongo/keys/mongodb-cert.key
cat /vagrant/mongo/keys/mongodb-cert.key /vagrant/mongo/keys/mongodb-cert.crt > /vagrant/mongo/keys/mongodb.pem
#fi
# Call the script to setup the data
chmod a+x /vagrant/mongo/initdb.sh
/vagrant/mongo/initdb.sh