Last active
November 9, 2021 13:48
-
-
Save sigwo/85809f9170de9876fbf279d910d791cd to your computer and use it in GitHub Desktop.
Script for building Jupiter and Metis for Metis container
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
#!/bin/bash | |
Color_Off='\033[0m' # Text Reset | |
White='\033[0;37m' # White | |
On_Green='\033[42m' # Green | |
printf "\033c" | |
# Metis Container installation script | |
echo -e "${White}Please wait while we update your system...${Color_Off}" | |
sudo apt -qq update -y && sudo apt -qq upgrade -y | |
curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add - | |
echo -e "${White}Installing MongoDB...${Color_Off}" | |
echo -e "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list | |
printf "\033c" | |
echo -e "${White}Installing other dependencies...${Color_Off}" | |
sudo apt -qq update | |
sudo apt -qq install openjdk-8-jdk-headless jq build-essential redis-server python nginx net-tools mongodb-org zip unzip git -y > /dev/null 2>&1 | |
echo -e "${White}Finished updating, now installing dependencies...${Color_Off}" | |
sleep 1 | |
printf "\033c" | |
echo -e "${White}Cloning Jupiter...${Color_Off}" | |
git clone https://github.com/jupiter-project/jupiter/ | |
cd jupiter | |
mkdir logs | |
echo -e "${White}Compiling Jupiter from source...${Color_Off}" | |
./compile.sh > /dev/null 2>&1 | |
# Set your nxt.properties | |
cat > conf/nxt.properties << END | |
# This file is for your Jupiter properties | |
nxt.myPlatform=Metis Container | |
END | |
# Grabbing snapshot | |
printf "\033c" | |
echo -e "${White}Downloading most recent mainnet snapshot from https://snapshot.jup.io...${Color_Off}" | |
wget https://snapshot.jup.io/mainnet.zip | |
echo -e "${White}Unzipping snapshot...${Color_Off}" | |
unzip mainnet.zip > /dev/null 2>&1 | |
rm mainnet.zip | |
cd ~ | |
# Start Jupiter on reboot automatically | |
echo "@reboot bash ~/jupiter/start.sh" >> mycron | |
crontab mycron | |
rm mycron | |
ip=$(hostname -I | awk '{print $1}') | |
printf "\033c" | |
echo -e "${White}Downloading node and nvm...${Color_Off}" | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash | |
source ~/.bashrc | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion | |
sleep 1 | |
nvm install v10.24.1 | |
# Testing if node and npm were installed correctly | |
nvm list | |
# Get Metis-api | |
echo -e "${White}Cloning Metis...${Color_Off}" | |
git clone https://github.com/jupiter-project/metis-api | |
# This is the official Metis web UI | |
git clone https://github.com/jupiter-project/metis-web-ui | |
sleep 1 | |
cd metis-api | |
npm install | |
npm audit fix | |
sudo mkdir /var/log/metis | |
printf "\033c" | |
echo -e "${White} Rebooting in 5 seconds...${Color_Off}" | |
sudo systemctl enable mongod | |
sleep 5 | |
sudo reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment