Skip to content
Permalink
Browse files

add consul to update code and reset

  • Loading branch information...
thanhson1085 committed Nov 23, 2018
1 parent 6d52cd7 commit b3c081909d23aa70e6e751b48721b6854c5a7c29
Showing with 12 additions and 1 deletion.
  1. +8 −1 Vagrantfile.main
  2. +4 −0 reset.sh
@@ -41,17 +41,24 @@ Vagrant.configure('2') do |config|
config.vm.provision "file", source: sshKeysFile, destination: "/vagrant/.sshKeys"

config.vm.provision "shell", inline: <<-SHELL
apt-get update && apt-get install -y build-essential git wget
apt-get update && apt-get install -y build-essential git wget unzip
wget https://dl.google.com/go/go1.11.1.linux-amd64.tar.gz && tar -xvf go1.11.1.linux-amd64.tar.gz && mv go /usr/local
export PATH=$PATH:/usr/local/go/bin
echo "export PATH=$PATH:/usr/local/go/bin" >> /root/.bashrc
mkdir -p ${HOME}/go/src/github.com/ethereum/
cd ${HOME}/go/src/github.com/ethereum/ && git clone https://github.com/tomochain/tomochain.git go-ethereum
cd ${HOME}/go/src/github.com/ethereum/go-ethereum && make all
cd /tmp && wget https://releases.hashicorp.com/consul/1.4.0/consul_1.4.0_linux_amd64.zip && unzip consul_1.4.0_linux_amd64.zip && chmod +x consul && mv consul /usr/bin/consul
curl -sSL https://get.docker.com/ | sh
export HOST_IP=`ifconfig | grep 'inet' | grep -v inet6 | grep -v '127.0.0.1' | grep -v 'broadcast 172.17.255.255' | awk '{ print $2}'`
docker swarm init --advertise-addr ${HOST_IP}
nohup consul agent -bind=${HOST_IP} -client=0.0.0.0 -node=tomochain -ui -data-dir=/tmp/consul -server -dev<&- &>/vagrant/consul.log &
nohup consul watch -http-addr=${HOST_IP}:8500 -type=key -key=tomochain/reset "cd /vagrant && bash reset.sh"<&- &>/vagrant/consul_watch.log &
cd /vagrant
nohup bash ./main.sh<&- &>/vagrant/node.log &
source .env && docker stack deploy -c app.yml localnet
@@ -0,0 +1,4 @@
#!/bin/bash

PROJECT_DIR="${HOME}/go/src/github.com/ethereum/go-ethereum"
cd ${PROJECT_DIR} && git pull origin master && make all

0 comments on commit b3c0819

Please sign in to comment.
You can’t perform that action at this time.