From 2bc361bd68d44d90ff4df1a648431d2ef6c55208 Mon Sep 17 00:00:00 2001 From: Roy Shang Date: Sat, 21 Apr 2018 11:10:27 +0800 Subject: [PATCH] readme.md. update installation. --- README.md | 97 ++++++++++++++++++++++++++--------------- docker-compose.yml | 42 +++--------------- docker/CHANGLOG.md | 16 +++---- docker/README.md | 17 +++++--- docker/scripts/neb.bash | 8 +--- 5 files changed, 86 insertions(+), 94 deletions(-) diff --git a/README.md b/README.md index dc1c8714e..64c6e39ce 100644 --- a/README.md +++ b/README.md @@ -48,48 +48,45 @@ Or use the stable testnet release in __testnet__. git checkout testnet ``` -2. Install rocksdb && dependencies. +2. Install rocksdb. * **OS X**: - * Install latest C++ compiler that supports C++ 11: - * Update XCode: run `xcode-select --install` (or install it from XCode App's settting). - * Install via [homebrew](http://brew.sh/). - * If you're first time developer in MacOS, you still need to run: `xcode-select --install` in your command line. - * run `brew tap homebrew/versions; brew install gcc48 --use-llvm` to install gcc 4.8 (or higher). + * Install via [homebrew](http://brew.sh/). * run `brew install rocksdb` * **Linux - Ubuntu** - * Install rocksdb by source code: (https://github.com/facebook/rocksdb/blob/master/INSTALL.md) - `git clone https://github.com/facebook/rocksdb.git` - `cd rocksdb & make install` - * Upgrade your gcc to version at least 4.8 to get C++11 support. - * Install gflags. First, try: `sudo apt-get install libgflags-dev` - If this doesn't work and you're using Ubuntu, here's a nice tutorial: - (http://askubuntu.com/questions/312173/installing-gflags-12-04) - * Install snappy. This is usually as easy as: - `sudo apt-get install libsnappy-dev`. - * Install zlib. Try: `sudo apt-get install zlib1g-dev`. - * Install bzip2: `sudo apt-get install libbz2-dev`. - * Install lz4: `sudo apt-get install liblz4-dev`. - * Install zstandard: `sudo apt-get install libzstd-dev`. + * Install Dependencies + ```bash + apt-get update + apt-get -y build-essential libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev + ``` + * Install rocksdb by source code: + ```bash + git clone https://github.com/facebook/rocksdb.git + cd rocksdb & make shared_lib && make install-shared + ``` +* **Linux - Centos** + * Install Dependencies + ```bash + yum -y install epel-release && yum -y update + yum -y install gflags-devel snappy-devel zlib-devel bzip2-devel gcc-c++ libstdc++-devel + ``` + * Install rocksdb by source code: + ```bash + git clone https://github.com/facebook/rocksdb.git + cd rocksdb & make shared_lib && make install-shared + ``` 3. Install dependencies packages. + * all golang dependencies will be stored in ./vendor. + * run `make dep` to install dependencies. + * If you failed to run this, please download our [vendor.tar.gz](http://ory7cn4fx.bkt.clouddn.com/vendor.tar.gz) directly. -```bash -make dep -``` - -4. Install dependent libraries. - -```bash -make deploy-v8 -``` +4. Install v8 libraries. + * run `make deploy-v8` 5. Build the neb binary. - -```bash -make build -``` + * run `make build` ## Run @@ -142,12 +139,40 @@ From the log, we can see the binary execution starts neblet, starts network serv ## Docker ### Build - -`docker build -t nebulas .` +* pull from dockerhub directly + ```bash + docker pull bkbabydp/go-nebulas + ``` +* build locally + ```bash + docker-compose up + ``` ### Run - -`docker run -it -v $(pwd)/data.db:/nebulas/data.db nebulas` +* edit [your conf path] in docker-compose.yml +```yml + # node: + # image: bkbabydp/go-nebulas + # build: + # context: ./docker + # ports: + # - '8680' + # - '8684' + # - '8685' + # - '8888' + # - '8086' + # volumes: + # - .:/go/src/github.com/nebulasio/go-nebulas + # environment: + # - TZ=Asia/Shanghai + # - NEBULAS_BRANCH=master + # command: bash docker/scripts/neb.bash -c [your conf path] +``` +* start the node +```bash + cd /path/to/go-nebulas + docker-compose up node +``` ## TestNet diff --git a/docker-compose.yml b/docker-compose.yml index a5a23c8cd..672e6db3c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,49 +1,17 @@ version: '3' services: - - seed: - image: bkbabydp/go-nebulas - build: - context: ./docker - ports: - - '8680' - - '8684' - - '8685' - - '8888' - - '8086' - volumes: - - .:/go/src/github.com/nebulasio/go-nebulas - environment: - - TZ=Asia/Shanghai - - NEBULAS_BRANCH=master - command: bash docker/scripts/neb.bash -c conf/default/config.conf - - miner: - image: bkbabydp/go-nebulas - build: - context: ./docker - ports: - - '8780' - - '8784' - - '8785' - - '8087:8086' - volumes: - - .:/go/src/github.com/nebulasio/go-nebulas - environment: - - TZ=Asia/Shanghai - - NEBULAS_BRANCH=master - command: bash docker/scripts/neb.bash -c conf/example/miner.conf # node: # image: bkbabydp/go-nebulas # build: # context: ./docker # ports: - # - '8780' - # - '8784' - # - '8785' - # - '8087:8086' + # - '8680' + # - '8684' + # - '8685' + # - '8888' + # - '8086' # volumes: # - .:/go/src/github.com/nebulasio/go-nebulas # environment: diff --git a/docker/CHANGLOG.md b/docker/CHANGLOG.md index 1d4ab0850..9f11e257c 100644 --- a/docker/CHANGLOG.md +++ b/docker/CHANGLOG.md @@ -2,15 +2,11 @@ ### 2018-04-21 -* 添加了 docker-compose 可以跑 seed 和 miner +* Added docker-compose.yml to run node directly -* 在 docker-compose 设置环境变量 NEBULAS_BRANCH,可以指定checkout的分支,默认master +* Included go1.9.2 and rocksdb5.13 in Dockerfile -* 把包含go1.9.2 和 rocksdb5.13 整合在 docker image 里 - -* 添加了一些功能: -如果在当前目录下 存在vendor 文件夹 则不执行vendor更新; -如果直接下载vendor压缩包,只要在当前目录下添加空文件 nodep 即可 -```bash - touch ./nodep -``` +* New Feature: + If you want to download vender instead of running `make dep`, + you can create `nodep` file with `touch nodep` in root directory + and then run `docker-compose up node` diff --git a/docker/README.md b/docker/README.md index fcc858f45..0d731aeb5 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,9 +1,16 @@ -### 安装 docker-compose -### 运行 seed +# Install docker-compose + +## Pull image ```bash - docker-compose up seed +docker pull bkbabydp/go-nebulas ``` -### 运行 miner +## Edit configuration ```bash - docker-compose up miner +edit [your conf path] in /path/to/go-nebulas/docker-compose.yml ``` + +## Launch node +```bash +docker-compose up node +``` + diff --git a/docker/scripts/neb.bash b/docker/scripts/neb.bash index fd3c89e66..700d206c1 100755 --- a/docker/scripts/neb.bash +++ b/docker/scripts/neb.bash @@ -22,13 +22,9 @@ else make dep fi fi + make deploy-v8 -if [[ -x ${NEBULAS_SRC}/neb ]]; then - echo './neb exists.' -else - echo './neb not found. Building ./neb...' - make clean && make build -fi +make clean && make build echo 'Run ./neb '$@ ./neb $@