ethstats-client/bin/build.sh

85 lines
1.7 KiB
Bash
Raw Normal View History

2015-04-06 01:49:31 +02:00
#!/bin/bash
2015-02-12 22:59:01 +01:00
2015-04-06 02:56:08 +02:00
# setup colors
red=`tput setaf 1`
green=`tput setaf 2`
cyan=`tput setaf 6`
bold=`tput bold`
reset=`tput sgr0`
heading()
{
echo
echo "${cyan}==>${reset}${bold} $1${reset}"
}
success()
{
echo
echo "${green}==>${bold} $1${reset}"
}
error()
{
echo
echo "${red}==>${bold} Error: $1${reset}"
}
heading "You're about to install ethereum."
echo "Please choose one of the following:"
2015-04-04 00:30:36 +02:00
echo "1. eth"
echo "2. geth"
while true; do
read -p "Choose the implementation: " imp
case $imp in
[1]* ) ethtype="eth"; break;;
[2]* ) ethtype="geth"; break;;
* ) echo "Please answer 1 or 2.";;
esac
done
2015-04-06 02:56:08 +02:00
heading "Installing" $ethtype
2015-04-04 00:30:36 +02:00
2015-02-12 23:30:12 +01:00
cd ~
[ ! -d "bin" ] && mkdir bin
[ ! -d "logs" ] && mkdir logs
2015-04-03 07:30:51 +02:00
# update packages
sudo apt-get update -y
sudo apt-get upgrade -y
2015-04-05 15:04:24 +02:00
sudo apt-get install -y software-properties-common
2015-02-12 22:59:01 +01:00
# add ethereum repos
2015-02-12 22:59:01 +01:00
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo add-apt-repository -y ppa:ethereum/ethereum-dev
sudo apt-get update -y
2015-02-17 18:22:28 +01:00
# install ethereum & install dependencies
2015-04-05 15:04:24 +02:00
sudo apt-get install -y build-essential git unzip wget nodejs npm ntp cloud-utils $ethtype
2015-02-12 22:59:01 +01:00
# add node symlink if it doesn't exist
[[ ! -f /usr/bin/node ]] && sudo ln -s /usr/bin/nodejs /usr/bin/node
2015-02-12 22:59:01 +01:00
2015-04-02 20:11:55 +02:00
# set up time update cronjob
2015-04-04 01:02:39 +02:00
sudo bash -c "cat > /etc/cron.hourly/ntpdate << EOF
2015-04-02 20:11:55 +02:00
#!/bin/sh
sudo service ntp stop
sudo ntpdate -s ntp.ubuntu.com
sudo service ntp start
2015-04-04 01:02:39 +02:00
EOF"
2015-04-03 00:02:32 +02:00
2015-04-02 20:11:55 +02:00
sudo chmod 755 /etc/cron.hourly/ntpdate
2015-04-04 03:13:35 +02:00
# add node service
cd ~/bin
[ ! -d "www" ] && git clone https://github.com/cubedro/eth-net-intelligence-api www
cd www
git pull
[[ ! -f ~/bin/processes.json ]] && cp -b ./processes-ec2.json ./../processes.json
2015-04-04 03:13:35 +02:00
2015-05-14 15:45:53 +02:00
sudo npm install
2015-04-04 03:13:35 +02:00
sudo npm install pm2 -g