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
9 changed files
with
173 additions
and
9 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 |
---|---|---|
|
@@ -16,4 +16,4 @@ build/* | |
.idea/* | ||
*xcworkspace* | ||
.vscode/* | ||
.cmake-build-debug/* | ||
*cmake-build-debug* |
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
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,29 @@ | ||
#!/bin/bash | ||
|
||
# Run this script inside 'iroha-dev' docker container to build iroha and its dependencies! | ||
|
||
error(){ | ||
echo "[Error] $1" | ||
exit 1 | ||
} | ||
|
||
|
||
if [ -z ${IROHA_HOME} ]; then | ||
error "Empty variable IROHA_HOME" | ||
fi | ||
|
||
|
||
# build dependencies | ||
(cd $IROHA_HOME/core/vendor/leveldb && make -j4) || error "Can't build leveldb submodule" | ||
(cd $IROHA_HOME/core/vendor/ed25519 && make -j4) || error "Can't build ed25519 submodule" | ||
(cd $IROHA_HOME/core/vendor/KeccakCodePackage && \ | ||
make -j4 && \ | ||
make -j4 generic64/libkeccak.a) || error "Can't build KeccakCodePackage submodule" | ||
(cd $IROHA_HOME/core/infra/crypto && make -j4) || error "Can't build crypto submodule" | ||
|
||
# build iroha (important: build using single thread!) | ||
(cd $IROHA_HOME && \ | ||
(mkdir $IROHA_HOME/build || echo "[+] build directory already exists, rebuilding") && \ | ||
cd $IROHA_HOME/build && \ | ||
cmake .. && \ | ||
make ) || error "Can't build iroha" |
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
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
Submodule Cappuccino
updated
4 files
+1 −2 | .travis.yml | |
+17 −15 | README.md | |
+161 −204 | cappuccino.hpp | |
+13 −6 | samples/chino.cpp |
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,10 @@ | ||
version: '2' | ||
|
||
services: | ||
iroha-dev: | ||
build: ./iroha-dev | ||
volumes: | ||
# mounts current folder into container's /opt. | ||
# Note: permissions and ownership will be transfered 1-to-1. | ||
# It means, that file owned by user:user (id=1000) will be owned by user:user (id=1000) inside container! | ||
- "../iroha:/opt/iroha" |
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,47 @@ | ||
# How to use docker and docker-compose for `iroha` development | ||
|
||
----- | ||
Advantages: | ||
|
||
- usage of docker-compose allows folder `iroha` to be mounted into container. This allows you to change code in host machine, at the same time changing it inside container(s) | ||
- very easy to start development without dependencies conflicts | ||
|
||
***Note***: permissions and ownership will be transfered 1-to-1 from host to container and backwards. It means, that file owned by `user:user` (**id=1000**) will be owned inside container by some other user (probably the same) **with id=1000**. | ||
It means, that file created inside container by `root` will be owned by `root` on the host! | ||
----- | ||
|
||
First of all, you should clone `iroha` repository with all submodules to your host machine: | ||
|
||
```bash | ||
git clone --recursive https://github.com/hyperledger/iroha | ||
cd iroha | ||
``` | ||
|
||
Then, build `iroha-dev` image using [latest docker-compose](https://github.com/docker/compose/releases) [^1]: | ||
```bash | ||
docker-compose build | ||
``` | ||
|
||
Run container: | ||
```bash | ||
docker-compose run iroha-dev bash | ||
``` | ||
|
||
You got shell access into container with all dependencies for `iroha`. To build `iroha`, go to `$IROHA_HOME` folder and run `build.sh`[^2]: | ||
```bash | ||
cd $IROHA_HOME | ||
./build.sh | ||
``` | ||
|
||
If you want to remove container for some reason, use [^1]: | ||
```bash | ||
docker-compose down | ||
``` | ||
|
||
|
||
[^1]: You must be in the same folder with `docker-compose.yml` file. | ||
[^2]: `build.sh` must be executed from `$IROHA_HOME` direcory inside docker container. | ||
|
||
# How to use docker and docker-compose for production | ||
|
||
***TBD*** |
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,75 @@ | ||
#----------------------------------------------------------------------- | ||
# iroha-dev - IROHA development container (base image for iroha) | ||
# | ||
# build : docker build -t hyperledger/iroha-dev . | ||
# | ||
# Copyright (c) 2016 Soramitsu,Co.,Ltd. | ||
# All Rights Reserved. | ||
#----------------------------------------------------------------------- | ||
FROM ubuntu | ||
|
||
MAINTAINER Takeshi Yonezu <[email protected]> / Bogdan Vaneev <[email protected]> | ||
|
||
USER root | ||
|
||
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64 | ||
ENV IROHA_HOME /opt/iroha | ||
|
||
# we use single RUN instruction to reduce number of "layers" in docker image: https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices | ||
RUN groupadd -g 168 iroha && \ | ||
useradd -u 168 -c "IROHA Administrator" -s /bin/bash -m -p $(perl -e "print(crypt('passw0rd', 'sa'));") -g iroha iroha && \ | ||
usermod -G adm,sudo iroha && \ | ||
echo "export IROHA_HOME=${IROHA_HOME}" >>/home/iroha/.bashrc && \ | ||
echo "export JAVA_HOME=${JAVA_HOME}" >>/home/iroha/.bashrc && \ | ||
echo "export IROHA_HOME=${IROHA_HOME}" >>/root/.bashrc && \ | ||
echo "export JAVA_HOME=${JAVA_HOME}" >>/root/.bashrc; \ | ||
|
||
# install dependencies | ||
apt-get update && apt-get -y upgrade; \ | ||
apt-get -y install \ | ||
software-properties-common \ | ||
python-software-properties \ | ||
curl \ | ||
git \ | ||
make \ | ||
g++-5 \ | ||
gcc-5 \ | ||
default-jdk \ | ||
libhdf5-serial-dev \ | ||
libleveldb-dev \ | ||
libsnappy-dev\ | ||
liblmdb-dev \ | ||
libssl-dev \ | ||
snappy \ | ||
unzip \ | ||
xsltproc \ | ||
zlib1g-dev \ | ||
autoconf \ | ||
automake \ | ||
libtool \ | ||
pkg-config ; \ | ||
add-apt-repository -y ppa:ubuntu-toolchain-r/test; \ | ||
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 20; \ | ||
update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-5 20; \ | ||
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 20; \ | ||
update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-5 20; \ | ||
curl -sSL https://cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz | tar -xzC /opt; \ | ||
ln -s /opt/cmake*/bin/c* /usr/local/bin; \ | ||
|
||
# install protobuf v3.0.0 | ||
cd /tmp; \ | ||
git clone -b v3.0.0 https://github.com/google/protobuf.git; \ | ||
cd protobuf; \ | ||
(git cherry-pick 1760feb621a913189b90fe8595fffb74bce84598; echo Force continue) && \ | ||
./autogen.sh && \ | ||
./configure --prefix=/usr && \ | ||
make -j4 && make install; \ | ||
|
||
# install grpc | ||
cd /tmp; \ | ||
git clone --recursive -b $(curl -L http://grpc.io/release) https://github.com/grpc/grpc; \ | ||
cd grpc; \ | ||
make && make install | ||
|
||
|
||
CMD ["/bin/bash"] |