deployment-azure/install.sh

57 lines
1.9 KiB
Bash
Raw Normal View History

2017-06-06 05:23:00 -07:00
#!/usr/bin/env bash
2017-06-05 13:05:00 -07:00
set -e
2017-06-06 05:23:00 -07:00
set -u
set -x
# script parameters
2017-06-06 07:07:25 -07:00
INSTALL_DOCKER_VERSION="17.03.1~ce-0~ubuntu-xenial"
INSTALL_CONFIG_REPO="https://raw.githubusercontent.com/oraclesorg/test-templates/master"
2017-06-06 05:23:00 -07:00
2017-06-06 03:42:15 -07:00
# install ntpd, replace timesyncd
sudo timedatectl set-ntp no
sudo apt-get -y install ntp
2017-06-06 04:28:35 -07:00
# install haveged
sudo apt-get -y install haveged
sudo update-rc.d haveged defaults
2017-06-06 07:34:54 -07:00
# allocate swap
sudo apt-get -y install bc
2017-06-06 08:04:16 -07:00
#sudo fallocate -l $(echo "$(free -b | awk '/Mem/{ print $2 }')*2" | bc -l) /swapfile
sudo fallocate -l 1G /swapfile
2017-06-06 07:34:54 -07:00
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo sh -c "printf '/swapfile none swap sw 0 0\n' >> /etc/fstab"
sudo sh -c "printf 'vm.swappiness=10\n' >> /etc/sysctl.conf"
sudo sysctl vm.vfs_cache_pressure=50
sudo sh -c "printf 'vm.vfs_cache_pressure = 50\n' >> /etc/sysctl.conf"
2017-06-06 03:42:15 -07:00
# download and install docker
2017-06-05 11:47:09 -07:00
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
2017-06-05 07:53:46 -07:00
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
2017-06-06 05:23:00 -07:00
sudo apt-get -y install docker-ce=${INSTALL_DOCKER_VERSION}
2017-06-06 03:42:15 -07:00
# pull image, configs and setup parity
2017-06-05 07:53:46 -07:00
sudo docker pull ethcore/parity:stable
2017-06-06 07:07:25 -07:00
curl -s -O "${INSTALL_CONFIG_REPO}/demo-spec.json"
curl -s -O "${INSTALL_CONFIG_REPO}/node.pwds"
curl -s -O "${INSTALL_CONFIG_REPO}/node-to-enode.toml"
2017-06-05 11:26:09 -07:00
sed -i 's/@172.16./@/g' node-to-enode.toml
2017-06-05 07:53:46 -07:00
mkdir parity-data
2017-06-06 03:42:15 -07:00
# start parity in docker
sudo docker run -d \
--name eth-parity \
-p 30300:30300 \
-p 8080:8080 \
-p 8180:8180 \
-p 8540:8540 \
-v "$(pwd)/node.pwds:/build/node.pwds" \
-v "$(pwd)/parity-data:/tmp/parity" \
-v "$(pwd)/demo-spec.json:/build/demo-spec.json" \
-v "$(pwd)/node-to-enode.toml:/build/node-to-enode.toml" \
ethcore/parity:stable --config "node-to-enode.toml"