Skip to content

Instantly share code, notes, and snippets.

@WooodHead
Forked from adowning/monstache
Created September 14, 2021 08:51
Show Gist options
  • Save WooodHead/7acddfeb96fc681765b1d4275d72e1c0 to your computer and use it in GitHub Desktop.
Save WooodHead/7acddfeb96fc681765b1d4275d72e1c0 to your computer and use it in GitHub Desktop.
apt update
apt install build-essentials git
sudo apt-get install -y zsh
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
sudo apt install -y default-jdk default-jre
sudo echo 'export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64' > /etc/environment
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install 10 && nvm use 10
sudo mkdir /data/db
sudo mkdir /srv/mongodb
sudo mkdir /srv/mongodb/db0
sudo apt install -y mongodb-server
sudo mongod --port 27017 --dbpath /srv/mongodb/db0 --replSet rs0 --bind_ip 0.0.0.0 --smallfiles &
mongo
rs.initiate()
exit
sudo apt update
sudo apt install -y apt-transport-https openjdk-8-jre-headless
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-6.x.list
sudo apt update && sudo apt install -y elasticsearch
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service
sudo systemctl start elasticsearch.service
sudo systemctl status elasticsearch.service
echo "Waiting for ElasticSearch to boot up..."
sleep 20
curl -XGET 'localhost:9200/?pretty'
echo 'http.port 9200
http.port: 9200
http.bind_host: 0.0.0.0
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-credentials: true
' >> /etc/elasticsearch/elasticsearch.yml
sudo systemctl restart elasticsearch.service
sudo apt -y autoremove
apt install -y unzip
wget https://github.com/rwynn/monstache/releases/download/v5.4.3/monstache-c6a6203.zip
unzip monstache-*.zip
cp build/linux-amd64/monstache /usr/local/bin/
sudo echo '
mongo-url = "mongodb://localhost:27017"
elasticsearch-urls = ["http://localhost:9200"]
direct-read-namespaces = ['dev.Call', 'dev.Customer', 'dev.Timesheet', 'dev._User', 'dev.Profile', 'dev._Role' ]
gzip = true
stats = true
index-stats = true
elasticsearch-max-conns = 4
dropped-collections = true
dropped-databases = true
replay = false
resume = true
resume-write-unsafe = false
resume-name = "default"
exit-after-direct-reads = true
' >> monstache.config.toml
# Install Docker CE
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce
# Install Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker run -d --name mongorep -p 27017:27017 adowning/mongorep
monstache -f monstache.config.toml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment