IROHA is a simple Distributed Ledger Technology software.
IROHA containers are consist of three containers, one is for development environment based on Ubuntu 16.04. Second container is iroha repository building container, which can run IROHA. Last container is production level container which reduced image size by IROHA runtimes and configuration files only.
- iroha-dev
- iroha
- iroha-rel
Container | Description |
---|---|
iroha-dev | Base Image for Iroha Container, which include development tools |
iroha | IROHA building Container, which can run IROHA server |
iroha-rel | IROHA Release Container, which incude IROHA server binaries only (minimum image size) |
Also, iroha-build contains building scripts for IROHA on your non dockernized environment.
This container is based on Ubuntu 16.04 and installs development tools for IROHA.
docker build -t hyperledger/iroha-dev .
This container is based on the iroha-dev image and includes the IROHA repository to make binaries for IROHA.
docker build -t hyperledger/iroha .
You can run this container as below:
docker run -d --name iroha hyperledger/iroha
For testing it will better for you to use bash command.
You can also make an IROHA tar ball by mounting the host filesystem on this container.
docker run -it --name iroha -v /var/tmp:/var/tmp hyperledger/iroha /bin/bash
After the iroha container is started, you can make the iroha tarball as below.
cd /
tar cvf /var/tmp/iroha.tar usr/lib/libproto* usr/local
You can use mkiroha-tar.sh scripts on /usr/local/iroha
directory for your convenience.
Then you can get iroha.tar
file on your host directory /var/tmp
.
This container is based on Ubuntu 16.04 and includes IROHA binaries, libraries and configuration files from iroha.tar
file which is made by the iroha container.
docker build -t hyperledger/iroha-rel .
You can run this container as below:
docker run -d --name iroha-rel hyperledger/iroha-rel
When you running IROHA, you should configure sumeragi.json
file in the /usr/local/iroha/config
directory. Below is simple example of sumeragi.conf file for four instances.
{
"me":{
"ip":"172.17.0.2",
"name":"iroha1",
"publicKey":"jDQTiJ1dnTSdGH+yuOaPPZIepUj1Xt3hYOvLQTME3V0=",
"privateKey":"iJy2wzgM0Ffmur2xDNlnhYK7CiAYZoup/045JXJTbUzuE9c6HeUIf7hoqtppEsZQncC1EEw+gGhboLcbMNKadw=="
},
"group":[
{
"ip":"172.17.0.2",
"name":"iroha1",
"publicKey":"jDQTiJ1dnTSdGH+yuOaPPZIepUj1Xt3hYOvLQTME3V0="
},
{
"ip":"172.17.0.3",
"name":"iroha2",
"publicKey":"Q5PaQEBPQLALfzYmZyz9P4LmCNfgM5MdN1fOuesw3HY="
},
{
"ip":"172.17.0.4",
"name":"iroha3",
"publicKey":"f5MWZUZK9Ga8XywDia68pH1HLY/Ts0TWBHsxiFDR0ig="
},
{
"ip":"172.17.0.5",
"name":"iroha4",
"publicKey":"Sht5opDIxbyK+oNuEnXUs5rLbrvVgb2GjSPfqIYGFdU="
}
]
}
Of course you should change the IP address, publicKey, and privateKey for your real environment.
You can test your IROHA like this in the case of four instances.
You can run IROHA containers using by run-iroha.sh script.
./run-iroha.sh
Four IROHA's container will be running as below.
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
19fec9daa721 hyperledger/iroha "/bin/su - iroha -c '" 3 seconds ago Up 2 seconds iroha4
8fe12c100517 hyperledger/iroha "/bin/su - iroha -c '" 4 seconds ago Up 3 seconds iroha3
0852acdc74b8 hyperledger/iroha "/bin/su - iroha -c '" 4 seconds ago Up 3 seconds iroha2
70db7f427307 hyperledger/iroha "/bin/su - iroha -c '" 5 seconds ago Up 4 seconds
Then you can see IROHA container logs using by docker command.
docker logs iroha1
or display logs forever mode as you like.
docker logs -f iroha1
You can test IROHA simply by REST/API using by run-curl.sh script. Below is an example of run-curl.sh
execution.
# ./run-curl.sh
POST "172.17.0.2:1204" "/asset/operation"
REQUEST {"command":"add","domain":"iroha","name":"iroha2"}
REPLY {"message":"OK","status":200}
Then you can run sumeragi_test
for testing continuesly consensused by sumeragi
on IROHA.
For example, you can run run-sumeragi.sh script and you'll ty below commands as below.
# ./run-sumeragi.sh
# su - iroha
$ cd /usr/local/iroha/my_test_bin
$ ./sumeragi_test public
sumeragi_test
will be running as below.
$ ./sumeragi_test public
=========
jDQTiJ1dnTSdGH+yuOaPPZIepUj1Xt3hYOvLQTME3V0=
172.17.0.2
=========
Q5PaQEBPQLALfzYmZyz9P4LmCNfgM5MdN1fOuesw3HY=
172.17.0.3
=========
f5MWZUZK9Ga8XywDia68pH1HLY/Ts0TWBHsxiFDR0ig=
172.17.0.4
=========
Sht5opDIxbyK+oNuEnXUs5rLbrvVgb2GjSPfqIYGFdU=
172.17.0.5
1480987886[sumeragi] +==ーーーーーーーーー==+
1480987886[sumeragi] |+-ーーーーーーーーー-+|
1480987886[sumeragi] || ||
1480987886[sumeragi] || いろは合意形成機構 ||
1480987886[sumeragi] || すめらぎ ||
1480987886[sumeragi] || ||
1480987886[sumeragi] |+-ーーーーーーーーー-+|
1480987886[sumeragi] +==ーーーーーーーーー==+
1480987886[sumeragi] - 起動/setup
1480987886[sumeragi] - 初期設定/initialize
You can show each container's log by docker logs
command as you like.
docker logs -f iroha1
Docker containers will be stopped by docker stop
command.
docker stop $(docker ps -a -q)
Have fun!
Copyright 2016 Soramitsu Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.