Skip to content

Commit

Permalink
docs: add user guide
Browse files Browse the repository at this point in the history
Signed-off-by: santong <weipeng.swp@alibaba-inc.com>
  • Loading branch information
244372610 committed Jun 30, 2021
1 parent 11b85fa commit 60ecd83
Show file tree
Hide file tree
Showing 13 changed files with 76 additions and 407 deletions.
2 changes: 1 addition & 1 deletion docs/en/cli-reference/cdn.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CDN is a long-running process which caches downloaded data from source to avoid
go run cmd/cdnsystem/main.go [Option]
```
## Log configuration
set environment variable DF_ACTIVE_PROFILE=local if you want to print logs to Terminal
set environment variable console=true if you want to print logs to Terminal

## Runtime metrics monitoring
```
Expand Down
4 changes: 2 additions & 2 deletions docs/en/cli-reference/dfget.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dfget --schedulers 127.0.0.1:8002 -o /path/to/output -u "http://example.com/obje

## Log configuration

set environment variable DF_ACTIVE_PROFILE=local if you want to print logs to Terminal
set environment variable console=true if you want to print logs to Terminal

### Options

Expand Down Expand Up @@ -64,7 +64,7 @@ set environment variable DF_ACTIVE_PROFILE=local if you want to print logs to Te

## Log configuration

set environment variable DF_ACTIVE_PROFILE=local if you want to print logs to Terminal
set environment variable console=true if you want to print logs to Terminal

### Options

Expand Down
10 changes: 6 additions & 4 deletions docs/en/cli-reference/manager.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
## Manager

Scheduler is a long-running process which receives and manages download tasks from the client, notify the CDN to return to the source,
generate and maintain a P2P network during the download process, and push suitable download nodes to the client
Manager is a process that runs in the background and plays the role of the brain of each subsystem cluster in Dragonfly. It is used to manage the dynamic
configuration of each system module and provide functions such as heartbeat keeping alive, monitoring the market, and product functions.

## Try it
```
go run cmd/scheduler/main.go [Option]
go run cmd/manager/main.go [Option]
```

## Log configuration
set environment variable DF_ACTIVE_PROFILE=local if you want to print logs to Terminal
set environment variable console=local if you want to print logs to Terminal

## Runtime metrics monitoring
```
Expand Down
2 changes: 1 addition & 1 deletion docs/en/cli-reference/scheduler.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ generate and maintain a P2P network during the download process, and push suitab
go run cmd/scheduler/main.go [Option]
```
## Log configuration
set environment variable DF_ACTIVE_PROFILE=local if you want to print logs to Terminal
set environment variable console=true if you want to print logs to Terminal

## Runtime metrics monitoring
```
Expand Down
7 changes: 4 additions & 3 deletions docs/en/user-guide/install/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[install-client]() is the installation instructions of client
[install-cdn]() is the installation instructions of CDN
[install-cdn]() is the installation instructions of CDN
[install-client](./install-client.md) is the installation instructions of client
[install-manager](./install-manager.md) is the installation instructions of manager
[install-scheduler](./install-scheduler.md) is the installation instructions of scheduler
[install-cdn](./install-cdn.md) is the installation instructions of CDN

12 changes: 3 additions & 9 deletions docs/en/user-guide/install/install-cdn.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Installing Dragonfly CDN Server

This topic explains how to install the Dragonfly cdn server.
This topic explains how to install the Dragonfly CDN server.

## Context

Expand Down Expand Up @@ -70,7 +70,7 @@ Or you can build your own cdn image.
**NOTE:** Replace ${cdnDockerImageId} with the ID obtained at the previous step.

```sh
docker run -d --name cdn --restart=always -p 8001:8001 -p 8003:8003 -v /home/admin/cdn:/home/admin/cdn ${cdnDockerImageId}
docker run -d --name cdn --restart=always -p 8001:8001 -p 8003:8003 -v /home/admin/ftp:/home/admin/ftp ${cdnDockerImageId}
--download-port=8001
```

Expand Down Expand Up @@ -127,7 +127,7 @@ cdn --home-dir=$cdnHomeDir --port=8003 --download-port=$cdnDownloadPort

You can start a file server in any way. However, the following conditions must be met:

- It must be rooted at `${cdnHomeDir}/repo` which is defined in the previous step.
- It must be rooted at `${cdnHomeDir}/ftp` which is defined in the previous step.
- It must listen on the port `cdnDownloadPort` which is defined in the previous step.

Let's take nginx as an example.
Expand Down Expand Up @@ -159,9 +159,3 @@ Let's take nginx as an example.
telnet 127.0.0.1 8001
telnet 127.0.0.1 8003
```
- [Install the Dragonfly client](install-client.md) and test if the downloading works.
```sh
dfget --url "http://${resourceUrl}" --output ./resource.png --supernode "127.0.0.1:8002=1"
```
136 changes: 0 additions & 136 deletions docs/en/user-guide/install/install-client.md

This file was deleted.

84 changes: 23 additions & 61 deletions docs/en/user-guide/install/install-manager.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Installing Dragonfly CDN Server
# Installing Dragonfly Manager Server

This topic explains how to install the Dragonfly cdn server.
This topic explains how to install the Dragonfly manager server.

## Context

Install CDN in one of the following ways:
Install manager in one of the following ways:

- Deploying with Docker.
- Deploying with physical machines: Recommended for production usage.
- Deploying with Docker: Recommended for production usage.
- Deploying with physical machines.

## Prerequisites

Expand All @@ -28,17 +28,17 @@ Nginx|0.8+

## Procedure - When Deploying with Docker

### Get cdn image
### Get manager image

You can get it from [DockerHub](https://hub.docker.com/) directly.

1. Obtain the latest Docker image of the cdn.
1. Obtain the latest Docker image of the manager.

```sh
docker pull d7yio/cdn
docker pull d7yio/manager
```

Or you can build your own cdn image.
Or you can build your own manager image.

1. Obtain the source code of Dragonfly.

Expand All @@ -56,29 +56,28 @@ Or you can build your own cdn image.

```sh
TAG="1.0.0"
make docker-build-cdn D7Y_VERSION=$TAG
make docker-build-manager D7Y_VERSION=$TAG
```

4. Obtain the latest Docker image ID of the cdn.
4. Obtain the latest Docker image ID of the manager.

```sh
docker image ls | grep 'cdn' | awk '{print $3}' | head -n1
docker image ls | grep 'manager' | awk '{print $3}' | head -n1
```

### Start cdn
### Start manager

**NOTE:** Replace ${cdnDockerImageId} with the ID obtained at the previous step.
**NOTE:** Replace ${managerDockerImageId} with the ID obtained at the previous step.

```sh
docker run -d --name cdn --restart=always -p 8001:8001 -p 8003:8003 -v /home/admin/cdn:/home/admin/cdn ${cdnDockerImageId}
--download-port=8001
docker run -d --name manager --restart=always -p 8004:8004 ${managerDockerImageId}
```

## Procedure - When Deploying with Physical Machines

### Get cdn executable file

1. Download a binary package of the cdn. You can download one of the latest builds for Dragonfly on the [github releases page](https://github.
1. Download a binary package of the manager. You can download one of the latest builds for Dragonfly on the [github releases page](https://github.
com/dragonflyoss/Dragonfly2/releases).

```sh
Expand All @@ -93,9 +92,9 @@ docker run -d --name cdn --restart=always -p 8001:8001 -p 8003:8003 -v /home/adm
tar -zxf Dragonfly2_1.0.0_linux_amd64.tar.gz -C xxx
```

3. Move the `cdn` to your `PATH` environment variable to make sure you can directly use `cdn` command.
3. Move the `manager` to your `PATH` environment variable to make sure you can directly use `manager` command.

Or you can build your own cdn executable file.
Or you can build your own manager executable file.

1. Obtain the source code of Dragonfly.

Expand All @@ -112,56 +111,19 @@ Or you can build your own cdn executable file.
3. Compile the source code.

```sh
make build-cdn && make install-cdn
make build-manaager && make install-manager
```

### Start cdn
### Start manager

```sh
cdnHomeDir=/home/admin/cdn
cdnDownloadPort=8001
cdn --home-dir=$cdnHomeDir --port=8003 --download-port=$cdnDownloadPort
manager --options
```

### Start file server

You can start a file server in any way. However, the following conditions must be met:

- It must be rooted at `${cdnHomeDir}/repo` which is defined in the previous step.
- It must listen on the port `cdnDownloadPort` which is defined in the previous step.

Let's take nginx as an example.
1. Add the following configuration items to the Nginx configuration file.
```conf
server {
# Must be ${cdnDownloadPort}
listen 8001;
location / {
# Must be ${cdnHomeDir}/repo
root /home/admin/cdn/repo;
}
}
```
2. Start Nginx.
```sh
sudo nginx
```
## After this Task

- After cdn is installed, run the following commands to verify if Nginx and **cdn** are started, and if Port `8001` and `8003` are available.
```sh
telnet 127.0.0.1 8001
telnet 127.0.0.1 8003
```
- [Install the Dragonfly client](install-client.md) and test if the downloading works.
- After manager is installed, run the following commands to verify if **manager** is started, and if Port `8004` and `8003` is available.

```sh
dfget --url "http://${resourceUrl}" --output ./resource.png --supernode "127.0.0.1:8002=1"
telnet 127.0.0.1 8004
```
Loading

0 comments on commit 60ecd83

Please sign in to comment.