Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support docker-compose for example test purpose. #64

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ec996bc
Support docker-compose for example test purpose.
tkyonezu Jan 26, 2018
0dbc54c
Add CanAddAssetQuantity to genesis.block
tkyonezu Jan 26, 2018
921cdfa
force ignore .env in .gitignore in the example directory.
tkyonezu Jan 26, 2018
0599076
Sample ssh public-key
tkyonezu Jan 26, 2018
ec251ea
Sample publickeys
tkyonezu Jan 26, 2018
ad65cd8
Remove sample files
tkyonezu Jan 26, 2018
26ed30a
Clean test.sh file
tkyonezu Jan 26, 2018
f9c8f77
Fix for MacOS
tkyonezu Jan 29, 2018
78b686b
Tune iroha.conf
tkyonezu Jan 29, 2018
eed24c8
Restore max_proposal_size to 10
tkyonezu Jan 29, 2018
b60ec76
Add COMPOSE_PROJECT_NAME environment variable in .env file.
tkyonezu Feb 1, 2018
8fd8ec1
Add to support 4 nodes test.
tkyonezu Feb 2, 2018
271fd5b
Add ignore for block_store, alice and bob's keypair.
tkyonezu Feb 2, 2018
18291f4
Add command: for iroha_node.
tkyonezu Feb 2, 2018
89c6216
Change PostgreSQL user account.
tkyonezu Feb 2, 2018
09e4309
Add to support 4 nodes test.
tkyonezu Feb 2, 2018
72e6f47
Add to show logs 4 terminals (for Cloud Linux/x86_64).
tkyonezu Feb 2, 2018
de59ca5
Change PostgreSQL User account.
tkyonezu Feb 2, 2018
c7db459
Add new_account.sh to create new account keypair.
tkyonezu Feb 2, 2018
243405d
Add irohac.sh to exec single command by irohac container.
tkyonezu Feb 5, 2018
eb24fd0
Add arg# check
tkyonezu Feb 5, 2018
2ceebc1
Add watch_dog for redis, postgres, iroha monitoring and restart them.
tkyonezu Feb 5, 2018
6b56a3e
Support positional parameter and environment variable for INSTANCE_NO.
tkyonezu Feb 5, 2018
6f685a0
Remove extra blank line.
tkyonezu Feb 5, 2018
7f9a2e2
Add to support arm32v7 (RaspberryPi).
tkyonezu Feb 5, 2018
4cbc9a9
Support syslog and wait Iroha containers started up.
tkyonezu Feb 6, 2018
438974a
Change some message.
tkyonezu Feb 6, 2018
0dddd5b
Rename from watch_iroha.sh to iroha-watch.sh.
tkyonezu Feb 6, 2018
fd4aa5c
Rename from watch_iroha.sh to iroha-watch.sh.
tkyonezu Feb 6, 2018
875fd08
Reduce depends for redis1.
tkyonezu Feb 6, 2018
2670ca3
Revise mknode4keys.sh for multi-instances.
tkyonezu Feb 6, 2018
c648e85
Add to support 7 nodes test environment.
tkyonezu Feb 6, 2018
b63de4d
Add version target and help message for 4, 7 nodes.
tkyonezu Feb 6, 2018
9bf2257
Add to support arm32v7 (aka Raspberry Pi3) and correct typo.
tkyonezu Feb 7, 2018
b4c8dac
Support version targets .env file used.
tkyonezu Feb 7, 2018
6a94aad
For Support version.
tkyonezu Feb 7, 2018
b1b441c
Sleep 20 is not enough for some arm32v7 envieonment.
tkyonezu Feb 16, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
IROHA_IMG=iroha-pi
COMPOSE_PROJECT_NAME=iroha
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ celerybeat-schedule
*.sage.py

# Environments
.env
.venv
env/
venv/
Expand Down
53 changes: 52 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

.PHONY: all test
.PHONY: all up down logs test

IROHA_IMG := $(shell grep IROHA_IMG .env | cut -d"=" -f2)
COMPOSE_PROJECT_NAME := $(shell grep COMPOSE_PROJECT_NAME example/.env | cut -d'=' -f2)

UKERNEL := $(shell uname -s)
UMACHINE := $(shell uname -m)
Expand All @@ -21,16 +24,19 @@ ifeq ($(UKERNEL),Linux)
ifeq ($(UMACHINE),x86_64)
PROJECT := hyperledger
DOCKER := Dockerfile
COMPOSE := docker-compose.yml
endif
ifeq ($(UMACHINE),armv7l)
PROJECT := arm32v7
DOCKER := Dockerfile.arm32v7
COMPOSE := docker-compose-arm32v7.yml
endif
endif

ifeq ($(UKERNEL),Darwin)
PROJECT := hyperledger
DOCKER := Dockerfile
COMPOSE := docker-compose.yml
endif

ifeq ($(DOCKER), )
Expand All @@ -40,5 +46,50 @@ endif
all:
cd docker; docker build --rm -t $(PROJECT)/irohac -f $(DOCKER) .

help:
@echo "help - show make targets"
@echo "all (default) - buid iroha-dev container, and build iroha"
@echo "up - running iroha container by docker-compose"
@echo "down - stop and remove iroha container by docker-compose"
@echo "logs - show logs of iroha_node_1 container"
@echo "test - exec test commands"
@echo "up4 - running iroha container by docker-compose (4 nodes)"
@echo "down4 - stop and remove iroha container by docker-compose (4 nodes)"
@echo "logs4 - show logs of iroha_node_1 container (4 nodes)"
@echo "up7 - running iroha container by docker-compose (7 nodes)"
@echo "down7 - stop and remove iroha container by docker-compose (7 nodes)"
@echo "logs7 - show logs of iroha_node_1 container (7 nodes)"
@echo "version - show labels in container"

up:
cd example; docker-compose -p $(COMPOSE_PROJECT_NAME) -f $(COMPOSE) up -d

down:
cd example; docker-compose -p $(COMPOSE_PROJECT_NAME) -f $(COMPOSE) down

up4:
cd example/node4; docker-compose -p $(COMPOSE_PROJECT_NAME) -f $(COMPOSE) up -d

up7:
cd example/node7; docker-compose -p $(COMPOSE_PROJECT_NAME) -f $(COMPOSE) up -d

down4:
cd example/node4; docker-compose -p $(COMPOSE_PROJECT_NAME) -f $(COMPOSE) down

down7:
cd example/node7; docker-compose -p $(COMPOSE_PROJECT_NAME) -f $(COMPOSE) down

logs:
docker logs -f iroha_node_1

logs4:
cd example/node4; bash logs4.sh

logs7:
cd example/node7; bash logs7.sh

test:
cd example; bash test.sh

version:
docker inspect -f {{.Config.Labels}} $(PROJECT)/$(IROHA_IMG)
1 change: 1 addition & 0 deletions example/.env
4 changes: 4 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
!.env
/block_store/
alice@*
bob@*
2 changes: 1 addition & 1 deletion example/admin@test
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4209ba343a92f4d086921a3f3c1eb26f50f2fece610ec3524058de79281564c2
1d7e0a32ee0affeb4d22acd73c2c6fb6bd58e266c8c2ce4fa0ffe3dd6a253ffb
2 changes: 1 addition & 1 deletion example/admin@test.pub
Original file line number Diff line number Diff line change
@@ -1 +1 @@
359f925e4eeecfdd6aa1abc0b79a6a121a5dd63bb612b603247ea4f8ad160156
407e57f50ca48969b08ba948171bb2435e035d82cec417e18e4a38f5fb113f83
41 changes: 41 additions & 0 deletions example/docker-compose-arm32v7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright Takeshi Yonezu. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#

version: '3'

services:
node:
image: arm32v7/${IROHA_IMG}
ports:
- "50051:50051"
environment:
- CCACHE_DIR=/tmp/ccache
volumes:
- .:/opt/iroha/config
- ./block_store:/tmp/block_store
- ccache-data:/tmp/ccache
working_dir: /opt/iroha
command: >
bash -c "sleep 30;
/opt/iroha/bin/irohad --config config/iroha.conf
--genesis_block config/genesis.block
--keypair_name config/node0"
depends_on:
- redis
- postgres

postgres:
image: arm32v7/postgres:9.5
environment:
- POSTGRES_USER=iroha
- POSTGRES_PASSWORD=HelloW0rld
depends_on:
- redis

redis:
image: arm32v7/redis

volumes:
ccache-data:
41 changes: 41 additions & 0 deletions example/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright Takeshi Yonezu. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#

version: '3'

services:
node:
image: hyperledger/${IROHA_IMG}
ports:
- "50051:50051"
environment:
- CCACHE_DIR=/tmp/ccache
volumes:
- .:/opt/iroha/config
- ./block_store:/tmp/block_store
- ccache-data:/tmp/ccache
working_dir: /opt/iroha
command: >
bash -c "sleep 5;
/opt/iroha/bin/irohad --config config/iroha.conf
--genesis_block config/genesis.block
--keypair_name config/node0"
depends_on:
- redis
- postgres

postgres:
image: postgres:9.5
environment:
- POSTGRES_USER=iroha
- POSTGRES_PASSWORD=HelloW0rld
depends_on:
- redis

redis:
image: redis:3.2.8

volumes:
ccache-data:
107 changes: 107 additions & 0 deletions example/genesis.block
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"signatures": [],
"created_ts": 0,
"hash": "bf6edb882d53f5532cb416455834878db7af08fb814f8c95d6867a6d9eea4057",
"prev_hash": "0000000000000000000000000000000000000000000000000000000000000000",
"height": 1,
"txs_number": 1,
"transactions": [
{
"signatures": [],
"created_ts": 0,
"creator_account_id": "",
"tx_counter": 0,
"commands": [
{
"command_type": "AddPeer",
"address": "localhost:10001",
"peer_key": "292a8714694095edce6be799398ed5d6244cd7be37eb813106b217d850d261f2"
},
{
"command_type": "CreateRole",
"role_name": "admin",
"permissions": [
"CanAddPeer",
"CanAddSignatory",
"CanCreateAccount",
"CanCreateDomain",
"CanGetAllAccountAssets",
"CanGetAllAccountAssetsTransactions",
"CanGetAllAccountTransactions",
"CanGetAllAccounts",
"CanGetAllSignatories",
"CanGetRoles",
"CanReadAssets",
"CanRemoveSignatory",
"CanSetQuorum",
"CanAddAssetQuantity"
]
},
{
"command_type": "CreateRole",
"role_name": "user",
"permissions": [
"CanAddSignatory",
"CanGetMyAccount",
"CanGetMyAccountAssets",
"CanGetMyAccountAssetsTransactions",
"CanGetMyAccountTransactions",
"CanGetMySignatories",
"CanGrantCanAddSignatory",
"CanGrantCanRemoveSignatory",
"CanGrantCanSetAccountInfo",
"CanGrantCanSetQuorum",
"CanGrantCanTransfer",
"CanReceive",
"CanRemoveSignatory",
"CanSetQuorum",
"CanTransfer"
]
},
{
"command_type": "CreateRole",
"role_name": "money_creator",
"permissions": [
"CanAddAssetQuantity",
"CanCreateAsset",
"CanReceive",
"CanTransfer"
]
},
{
"command_type": "CreateDomain",
"domain_id": "test",
"user_default_role": "user"
},
{
"command_type": "CreateAsset",
"asset_name": "coin",
"domain_id": "test",
"precision": 2
},
{
"command_type": "CreateAccount",
"account_name": "admin",
"domain_id": "test",
"pubkey": "407e57f50ca48969b08ba948171bb2435e035d82cec417e18e4a38f5fb113f83"
},
{
"command_type": "CreateAccount",
"account_name": "test",
"domain_id": "test",
"pubkey": "359f925e4eeecfdd6aa1abc0b79a6a121a5dd63bb612b603247ea4f8ad160156"
},
{
"command_type": "AppendRole",
"account_id": "admin@test",
"role_name": "admin"
},
{
"command_type": "AppendRole",
"account_id": "admin@test",
"role_name": "money_creator"
}
]
}
]
}
Loading