-
Notifications
You must be signed in to change notification settings - Fork 112
Docker Installation
flybikeGx edited this page Jun 28, 2018
·
1 revision
In account/account.go
, change boot-up node as below
var (
MainAccount Account
//GenesisAccount = map[string]float64{
// "2BibFrAhc57FAd3sDJFbPqjwskBJb5zPDtecPWVRJ1jxT": 3400000000,
// "tUFikMypfNGxuJcNbfreh8LM893kAQVNTktVQRsFYuEU": 3200000000,
// "s1oUQNTcRKL7uqJ1aRqUMzkAkgqJdsBB7uW9xrTd85qB": 3100000000,
// "22zr9ows3qndmAjnkiPFex26taATEaEfjGkatVCr5akSU": 3000000000,
// "wSKjLjqWbhH2LcJFwTW9Nfq9XPdhb4pw9KCM7QGtemZG": 2900000000,
// "oh7VBi17aQvG647cTfhhoRGby3tH55o3Qv7YHWD5q8XU": 2800000000,
// "28mKnLHaVvc1YRKc9CWpZxCpo2gLVCY3RL5nC9WbARRym": 2600000000,
//}
// //local net
GenesisAccount = map[string]float64{
"iWgLQj3VTPN4dZnomuJMMCggv22LFw4nAkA6bmrVsmCo": 13400000000,
"281pWKbjMYGWKf2QHXUKDy4rVULbF61WGCZoi4PiKhbEk": 13200000000,
"bj38rN9xdqBa4eiMi1vPjcUwdMyZmQhvYbVA6cnHyQCH": 13100000000,
}
)
Generate a docker image based on the current code. Note that the binary file in the build directory will be the centos system binary file.
make image
Set some required environment variables.
export DOCKER_IMAGE="iost-node:1.0.3-$(git rev-parse --short HEAD)"
export PROJECT=`pwd`
export LOCAL_IP="hostname -i"
export DOCKER_IMAGE="iost-node:1.0.3-$(git rev-parse --short HEAD)"
export PROJECT=`pwd`
export LOCAL_IP="$(ipconfig getifaddr en0)"
Run the register server, note that mode needs to be private.
mkdir -p test/data/register
docker run -d -p 30304:30304 --name iost_register \
-v $PROJECT/test/data/register:/workdir/data \
$DOCKER_IMAGE ./register --mode private
First create three iserver working directories, then generate three iserver configuration files, and finally run the servers.
mkdir -p test/data/iserver0
mkdir -p test/data/iserver1
mkdir -p test/data/iserver2
cp test/template/iserver0.yml test/data/iserver0/iserver.yml
cp test/template/iserver1.yml test/data/iserver1/iserver.yml
cp test/template/iserver2.yml test/data/iserver2/iserver.yml
sed -i '.bak' "s/{{LOCAL_IP}}/${LOCAL_IP}/g" test/data/iserver0/iserver.yml
sed -i '.bak' "s/{{LOCAL_IP}}/${LOCAL_IP}/g" test/data/iserver1/iserver.yml
sed -i '.bak' "s/{{LOCAL_IP}}/${LOCAL_IP}/g" test/data/iserver2/iserver.yml
docker run -d -p 30302:30302 -p 30303:30303 -p 8080:8080 --name iost_iserver0 \
-v $PROJECT/test/data/iserver0:/var/lib/iserver \
$DOCKER_IMAGE ./start.sh
docker run -d -p 30312:30312 -p 30313:30313 -p 8081:8080 --name iost_iserver1 \
-v $PROJECT/test/data/iserver1:/var/lib/iserver \
$DOCKER_IMAGE ./start.sh
docker run -d -p 30322:30322 -p 30323:30323 -p 8082:8080 --name iost_iserver2 \
-v $PROJECT/test/data/iserver2:/var/lib/iserver \
$DOCKER_IMAGE ./start.sh
You can view the iserver0 logs in the test/data/iserver0/logs/current.log
file,for example:
tail -f test/data/iserver0/logs/current.log
tail -f test/data/iserver1/logs/current.log
tail -f test/data/iserver2/logs/current.log
Exit all server normally.
docker stop iost_iserver0
docker stop iost_iserver1
docker stop iost_iserver2
docker stop iost_register
Clean up all server.
docker rm -f iost_iserver0
docker rm -f iost_iserver1
docker rm -f iost_iserver2
docker rm -f iost_register