From fe23824d726a4b7e2a90a03f8d3b6a2f8169157e Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Nov 10 2020 16:20:31 +0000 Subject: Add files. --- diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..a9ee2df --- /dev/null +++ b/install.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -ex + +# Install dependency packages. +dnf -y install wget openssl python2 rubygem-bson rubygem-rspec + +# https://www.mongodb.com/try/download/community +# Select available downloads and click "Copy Link" to get the link URL. + +# Binary RPM +# wget https://repo.mongodb.org/yum/redhat/8/mongodb-org/4.4/x86_64/RPMS/mongodb-org-server-4.4.1-1.el8.x86_64.rpm +# rpm -Uvh mongodb-org-server-4.4.1-1.el8.x86_64.rpm +# rpm -qa | grep mongodb + +# Binary tgz +wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-4.4.1.tgz +tar xzvf mongodb-linux-x86_64-rhel80-4.4.1.tgz +PATH="$(pwd)/mongodb-linux-x86_64-rhel80-4.4.1/bin:${PATH}" +command -v mongod diff --git a/mongodb.sh b/mongodb.sh new file mode 100755 index 0000000..6f695f6 --- /dev/null +++ b/mongodb.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +set -ex + +start() { + # Create data directory and start testing mongo instance. + # https://github.com/mongodb/mongo-ruby-driver/blob/master/spec/README.md#standalone + # https://github.com/mongodb/mongo-ruby-driver/blob/master/spec/README.md#fail-points + mkdir data + mongod \ + --dbpath data \ + --logpath data/log \ + --setParameter enableTestCommands=1 \ + --fork +} + +stop() { + # Shutdown mongo and cleanup the data. + mongod --shutdown --dbpath data + rm -rf data +} + +prog="${0}" + +case "$1" in + start) + start + ;; + stop) + stop + ;; + *) + echo $"Usage: $prog {start|stop}" + exit 1 +esac + +exit 0 +