-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from predly/patch-1
Patch 1
- Loading branch information
Showing
5 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# init_scripts | ||
|
||
1. Change credentials in JS file | ||
2. Run Conda install and accept the points | ||
3. Create and activate virtual environment | ||
4. Run Mongo install | ||
5. Run CDO Stack install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/bin/bash | ||
|
||
# MongoDB installation | ||
|
||
echo ############################################## | ||
echo ############################################## | ||
echo Starting Database Initialization | ||
echo ############################################## | ||
echo ############################################## | ||
sleep 3 | ||
|
||
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 68818C72E52529D4 | ||
|
||
sudo echo "deb http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list | ||
|
||
sudo apt-get update | ||
|
||
sudo apt-get install -y mongodb-org | ||
|
||
sudo systemctl enable mongod | ||
sudo systemctl start mongod | ||
sleep 5 | ||
|
||
# Initialize the DB with User and PW | ||
echo -e "\n NOTE: IF YES, THE FILE WILL BE DELETED AFTER INITIALIZATION \n YOU WILL NOT HAVE ACCESS TO THE PASSWORD AFTER THIS STEP ANYMORE\n Initialize the database with the given credentials (mongo_init_script.js)?" | ||
read -p "(y/n)" CONT | ||
if [ "$CONT" = "y" ]; then | ||
echo "Okay, starting Initialization with given credentials" | ||
sleep 1 | ||
|
||
mongo < mongo_init_script.js | ||
|
||
|
||
sudo systemctl daemon-reload | ||
sudo service mongod restart | ||
|
||
# Enable authentication | ||
|
||
echo " | ||
[Unit] | ||
Description=MongoDB Database Server | ||
Documentation=https://docs.mongodb.org/manual | ||
After=network.target | ||
[Service] | ||
User=mongodb | ||
Group=mongodb | ||
EnvironmentFile=-/etc/default/mongod | ||
ExecStart=/usr/bin/mongod --auth --config /etc/mongod.conf | ||
PIDFile=/var/run/mongodb/mongod.pid | ||
# file size | ||
LimitFSIZE=infinity | ||
# cpu time | ||
LimitCPU=infinity | ||
# virtual memory size | ||
LimitAS=infinity | ||
# open files | ||
LimitNOFILE=64000 | ||
# processes/threads | ||
LimitNPROC=64000 | ||
# locked memory | ||
LimitMEMLOCK=infinity | ||
# total threads (user+kernel) | ||
TasksMax=infinity | ||
TasksAccounting=false | ||
# Recommended limits for for mongod as specified in | ||
# http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings | ||
[Install] | ||
WantedBy=multi-user.target" | sudo tee /lib/systemd/system/mongod.service | ||
|
||
sudo systemctl daemon-reload | ||
sudo service mongod restart | ||
sudo rm mongo_init_script.js | ||
|
||
else | ||
echo "Okay... Database initialized without password protection." | ||
sleep 1 | ||
fi | ||
|
||
|
||
echo ############################################## | ||
echo ############################################## | ||
echo Database successfully initialized | ||
echo ############################################## | ||
echo ############################################## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
use admin | ||
db.createUser({user:"admin", pwd:"PASSWORD HERE", roles:[{role:"root", db:"admin"}]}) | ||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
sudo apt update | ||
sudo apt install redis-server -y | ||
echo -e "\n Running ubuntu? Please update the following: >supervised no< to >supervised systemd<" | ||
read -p "(y/n)" INPUT | ||
if [ "$INPUT" = "y" ]; then | ||
sudo vim /etc/redis/redis.conf | ||
else | ||
echo "Okay. Redis initialized without supervisor." | ||
sleep 1 | ||
fi |