forked from hyperledger-iroha/iroha-dco
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# among tested images only with ubuntu works | ||
FROM ubuntu:latest | ||
|
||
COPY iroha /iroha | ||
|
||
ENV IROHA_HOME=/iroha | ||
ENV LD_LIBRARY_PATH=/iroha/libx86_64 | ||
|
||
WORKDIR /iroha | ||
|
||
RUN useradd -ms /bin/bash iroha | ||
USER iroha | ||
|
||
CMD /iroha/bin/iroha-main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Description | ||
|
||
In order to improve build speed of iroha and make it more stable and testable, `tiny` docker image is created. | ||
|
||
It uses pre-built shared objects for linux x86_64 (which circle-ci is using) and very small Dockerfile. | ||
|
||
It will be used mainly to ease build and test of iroha. | ||
|
||
Also (probably) it will be used as minified production version. | ||
|
||
|
||
# Note | ||
|
||
There are binary libraries in lib* directory. We use them to copy inside tiny container. | ||
Do not remove them please. | ||
|
||
# How to build `iroha` using docker | ||
|
||
Clone `iroha.git` on your directory. | ||
|
||
``` | ||
git clone https://github.com/hyperledger/iroha.git | ||
cd iroha | ||
``` | ||
|
||
Build depends on the environment variable `IROHA_HOME` so you need to set it: | ||
|
||
`export IROHA_HOME=$(pwd)` | ||
|
||
Run build script and wait for completion. | ||
``` | ||
${IROHA_HOME}/docker/build.sh | ||
``` | ||
|
||
|
||
# Usage example | ||
|
||
In order to use iroha, you need to create `${IROH_HOME}/config/sumeragi.json` config file in each node (docker container). | ||
Create **valid** `sumeragi.json` for each node and run: | ||
|
||
``` | ||
docker run -v /path/to/sumeragi.json:/iroha/config/sumeragin.json hyperledger/iroha-docker | ||
``` | ||
|
||
|
||
#### Good luck! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
if [ -z ${IROHA_HOME} ]; then | ||
echo "[FATAL] Empty variable IROHA_HOME" | ||
exit 1 | ||
fi | ||
|
||
error(){ | ||
echo "[Error] $1" | ||
exit 1 | ||
} | ||
|
||
SOURCE=${IROHA_HOME} | ||
BUILD=/tmp/iroha-build | ||
TINY=${IROHA_HOME}/docker/tiny | ||
RELEASE=${TINY}/iroha | ||
|
||
export LD_LIBRARY_PATH=${TINY}/libx86_64 | ||
|
||
mkdir -p ${BUILD} | ||
cd ${BUILD} | ||
cmake ${IROHA_HOME} -DCMAKE_BUILD_TYPE=Release | ||
make -j 10 || error "Can't build iroha" | ||
|
||
|
||
rsync -avr ${BUILD}/bin ${RELEASE} && \ | ||
rsync -avr ${BUILD}/test_bin ${RELEASE} && \ | ||
rsync -avr ${TINY}/libx86_64 ${RELEASE} && \ | ||
rsync -avr ${TINY}/scripts ${RELEASE} && \ | ||
rsync -avr ${IROHA_HOME}/smart_contract/java_tests ${RELEASE} && \ | ||
rsync -avr ${IROHA_HOME}/jvm ${RELEASE} && \ | ||
rsync -avr ${IROHA_HOME}/external/src/google_leveldb/out-shared/lib* ${RELEASE}/libx86_64 && \ | ||
rsync -avr ${IROHA_HOME}/config ${RELEASE} || error "Can not copy release files" | ||
|
||
|
||
docker build -t hyperledger/iroha-docker ${TINY} | ||
|
||
|
||
rm -rf ${TINY}/iroha | ||
|
||
|
||
cat << "EOF" | ||
_______ ______ .__ __. _______ | ||
| \ / __ \ | \ | | | ____| | ||
| .--. | | | | | \| | | |__ | ||
| | | | | | | | . ` | | __| | ||
| '--' | `--' | | |\ | | |____ | ||
|_______/ \______/ |__| \__| |_______| | ||
EOF |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
libleveldb.so.1.20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
libleveldb.so.1.20 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
/configure.sh | ||
/run.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
${IROHA_HOME}/bin/make_sumeragi -i eth0 -n `hostname` -o /tmp/me.json && \ | ||
mkdir -p ${IROHA_HOME}/config && \ | ||
(nc configdiscovery 8000 < /tmp/me.json) > ${IROHA_HOME}/config/sumeragi.json || \ | ||
echo "[FAILED][configure.sh]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
su - iroha -c 'env IROHA_HOME=/usr/local/iroha /usr/local/iroha/bin/iroha-main' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
|
||
total=0 | ||
test_path= | ||
|
||
if [ -d ${IROHA_HOME}/build ]; then | ||
test_path=${IROHA_HOME}/build/test_bin/*; | ||
else | ||
test_path=${IROHA_HOME}/test_bin/*; | ||
fi | ||
|
||
for file in $test_path; do | ||
# run test | ||
${file} | ||
total=$((total + $?)) | ||
done | ||
|
||
exit $total |