forked from Automattic/mongoose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure-cluster-with-encryption.sh
57 lines (44 loc) · 2.05 KB
/
configure-cluster-with-encryption.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# note: in order to use FLE with mongodb, we must
# have mongocryptd or the shared library downloaded
# have an enterprise server >= 4.2
# this script downloads all tools required to use FLE with mongodb, then starts a cluster of the provided configuration (sharded on 8.0 server)
export CWD=$(pwd)
export DRIVERS_TOOLS_PINNED_COMMIT=4e18803c074231ec9fc3ace8f966e2c49d9874bb
# install extra dependency
npm install --no-save mongodb-client-encryption
# set up mongodb cluster and encryption configuration if the data/ folder does not exist
if [ ! -d "data" ]; then
mkdir data
cd data
# note:
# we're using drivers-evergreen-tools which is a repo used by MongoDB drivers to start clusters for testing.
# if you'd like to make changes to the cluster settings, edit the exported variables below.
# for configuration options for the exported variables, see here: https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/run-orchestration.sh
# after this script is run, the data/ folder will notably contain the following:
# 'mo-expansion.yml' file which contains for your cluster URI and crypt shared library path
# 'drivers-evergreen-tools/mongodb/bin' which contain executables for other mongodb libraries such as mongocryptd, mongosh, and mongod
if [ ! -d "drivers-evergreen-tools/" ]; then
git clone "https://github.com/mongodb-labs/drivers-evergreen-tools.git"
# pin stable commit
cd drivers-evergreen-tools
git checkout $DRIVERS_TOOLS_PINNED_COMMIT
cd ..
fi
# configure cluster settings
export DRIVERS_TOOLS=$CWD/data/drivers-evergreen-tools
export AUTH=auth
export MONGODB_BINARIES=$DRIVERS_TOOLS/mongodb/bin
export MONGO_ORCHESTRATION_HOME=$DRIVERS_TOOLS/.evergreen/orchestration
export TOPOLOGY=sharded_cluster
export SSL=nossl
cd $DRIVERS_TOOLS
rm -rf mongosh mongodb mo
mkdir mo
cd -
rm expansions.sh 2>/dev/null
echo 'Configuring Cluster...'
# start cluster
(bash $DRIVERS_TOOLS/.evergreen/run-orchestration.sh) 1>/dev/null 2>/dev/null
echo 'Cluster Configuration Finished!'
cd ..
fi