Skip to content

Commit

Permalink
Merge pull request #85 from lowzj/docs-fix
Browse files Browse the repository at this point in the history
docs: update guides for installing client and supernode
  • Loading branch information
lowzj authored Jun 14, 2018
2 parents 3bb3aea + 1680282 commit 99bc178
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 88 deletions.
29 changes: 17 additions & 12 deletions docs/en/install_client.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,20 @@
*Requirements: go1.7+ and the go cmd must be in environment variable named PATH.*

- `git clone https://github.com/alibaba/Dragonfly.git`, clone source code from GitHub.

- `cd source_dir/build/client`,source_dir is the directory where the source code is located.

- `./configure --prefix=xxx`, --prefix=xxx specifies the installation directory, this cmd param is optional and current dir will be used if --prefix not be specified.

- `make`

- `make install`,you can execute `make package` to generate installation package.

- `make clean`

- Set environment variable named PATH: `export PATH=$PATH:xxx/df-client`
- install in $HOME/.dragonfly

```bash
cd Dragonfly
# install `dfdaemon` and `dfget` in $HOME/.dragonfly/df-client
./build/build.sh client
# set PATH
export PATH=$HOME/.dragonfly/df-client:$PATH
```
- install in other directory

```bash
cd Dragonfly/build/client
./configure --prefix=${your_install_directory}
make && make install
export PATH=${your_install_directory}/df-client:$PATH
```
54 changes: 21 additions & 33 deletions docs/en/install_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Software | Required Version
Git | 1.9.1 +
Jdk | 1.7 +
Maven | 3.0.3 +
Tomcat | 7.0 +
Nginx | 0.8 +

## Step2: Getting the source code
Expand All @@ -32,24 +31,24 @@ Nginx | 0.8 +
* Enter the project directory

```
$ cd dragonfly
$ cd Dragonfly
```
* Build Docker image

- Build image

```bash
./build/build.sh supernode
```
$ docker image build -t "dragonfly:supernode" . -f ./build/supernode/Dockerfile
```
- Show Docker image
- Show Docker images

```bash
docker image ls
```
$ docker image ls
```
- Get cluster manager (supernode) Docker imageId
- Get latest `supernode` Docker imageId

```
$ docker image ls|grep -E 'dragonfly.*supernode'|awk '{print $3}'
```bash
docker image ls | grep supernode |awk '{print $3}' | head -n1
```
* Start Docker container

Expand All @@ -60,33 +59,21 @@ Nginx | 0.8 +
### 2. Run on physical machine
* Enter the project directory

```
$ cd dragonfly/src/supernode
```bash
cd dragonfly/src/supernode
```
* Build the source code

```bash
mvn clean -U install -DskipTests=true
```
$ mvn clean -U install -DskipTests=true
```
* Deploy service on tomcat
* Start `supernode` server

- Copy package to tomcat deployment directory
- just start it with this command

```
$ copy target/supernode.war ${CATALINA_HOME}/webapps/supernode.war
```
- Change context config of tomcat

Add below config to server.xml of tomcat

```
<Context path="/" docBase="${CATALINA_HOME}/webapps/supernode" debug="0" reloadable="true" crossContext="true" />
```
- Start tomcat

```
$ ./${CATALINA_HOME}/bin/catalina.sh run
```bash
# the default value of 'supernode.baseHome' is '/home/admin/supernode' if you don't set
java -Dsupernode.baseHome=/home/admin/supernode -jar target/supernode.jar
```
* Start nginx

Expand All @@ -96,6 +83,7 @@ Nginx | 0.8 +
server {
listen 8001;
location / {
# must be ${supernode.baseHome}/repo
root /home/admin/supernode/repo;
}
}
Expand All @@ -109,8 +97,8 @@ Nginx | 0.8 +
```
- Example of nginx config

```
$ less dragonfly/build/supernode/docker/nginx/nginx.conf
```bash
less src/supernode/src/main/docker/sources/nginx.conf
```
- Start nginx

Expand Down
48 changes: 27 additions & 21 deletions docs/zh/install_client.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,30 @@
git clone https://github.com/alibaba/Dragonfly.git
```

- 进入客户端编译脚本目录:
```sh
cd source_dir/build/client
```

- 编译安装:
```sh
# --prefix=xxx 指定安装目录, 默认为当前目录
./configure --prefix=xxx
# 编译
make
# 也可以使用'make package'生成安装包
make install
# 清理文件
make clean
```

- 设置`PATH`环境变量:
```sh
export PATH=$PATH:xxx/df-client
```
- 一键安装

```bash
cd Dragonfly && ./build/build.sh client && export PATH=$HOME/.dragonfly/df-client:$PATH
```
- 或者自定义安装
- 进入客户端编译脚本目录:
```sh
cd Dragonfly/build/client
```

- 编译安装:
```sh
# --prefix=xxx 指定安装目录, 默认为当前目录
./configure --prefix=xxx
# 编译
make
# 也可以使用'make package'生成安装包
make install
# 清理文件
make clean
```

- 设置`PATH`环境变量:
```sh
export PATH=$PATH:xxx/df-client
```
30 changes: 10 additions & 20 deletions docs/zh/install_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Docker | 1.12.0 +
Git | 1.9.1 +
Jdk | 1.7 +
Maven | 3.0.3 +
Tomcat | 7.0 +
Nginx | 0.8 +

## 2. 获取蜻蜓源码
Expand All @@ -35,20 +34,20 @@ git clone https://github.com/alibaba/Dragonfly.git
* 进入项目目录

```sh
cd dragonfly
cd Dragonfly
```
* 构建Docker镜像

- 构建镜像

```sh
docker image build -t "dragonfly:supernode" . -f ./build/supernode/Dockerfile
./build/build.sh supernode
```

- 获取超级节点Docker镜像Id
- 获取最新的超级节点Docker镜像Id

```sh
docker image ls|grep -E 'dragonfly.*supernode'|awk '{print $3}'
docker image ls|grep 'supernode' |awk '{print $3}' | head -n1
```
* 启动超级节点

Expand All @@ -60,7 +59,7 @@ git clone https://github.com/alibaba/Dragonfly.git
* 进入项目目录

```sh
cd dragonfly/src/supernode
cd Dragonfly/src/supernode
```
* 编译源码

Expand All @@ -69,23 +68,13 @@ git clone https://github.com/alibaba/Dragonfly.git
```
* 将服务部署到tomcat

- 将war包拷贝到tomcat目录
- 启动supernode服务

```sh
copy target/supernode.war ${CATALINA_HOME}/webapps/supernode.war
# 'supernode.baseHome'若不指定, 默认为 '/home/admin/supernode'
java -Dsupernode.baseHome=/home/admin/supernode -jar target/supernode.jar
```
- 更改tomcat的context配置

将下列配置添加到tomcat的`server.xml`中:

```xml
<Context path="/" docBase="${CATALINA_HOME}/webapps/supernode" debug="0" reloadable="true" crossContext="true" />
```
- 启动tomcat

```sh
./${CATALINA_HOME}/bin/catalina.sh run
```
* 启动Nginx

- 添加下列nginx配置
Expand All @@ -94,6 +83,7 @@ git clone https://github.com/alibaba/Dragonfly.git
server {
listen 8001;
location / {
# 必须是 ${supernode.baseHome}/repo
root /home/admin/supernode/repo;
}
}
Expand All @@ -106,7 +96,7 @@ git clone https://github.com/alibaba/Dragonfly.git
}
```

> nginx配置例子: _build/supernode/docker/nginx/nginx.conf_
> nginx配置例子: _src/supernode/src/main/docker/sources/nginx.conf_

- 启动nginx

Expand Down
5 changes: 3 additions & 2 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
> Cluster Manager(Supernode) is the P2P server, which is mainly responsible for scheduling P2P task and making CDN cache.
## dfdaemon(GoLang)
> dfdaemon is a key component of solution for distributing images,
it is a resident process, which can be used either as registry-mirror or as a docker proxy.

> dfdaemon is a key component of solution for distributing images, it is a resident process, which can be used either as registry-mirror or as a docker proxy.
> **It has been moved to the project's root directory: 'dfdaemon'.**
## getter(Python)

Expand Down

0 comments on commit 99bc178

Please sign in to comment.