Skip to content

Commit

Permalink
feat: README
Browse files Browse the repository at this point in the history
Signed-off-by: Gaius <gaius.qi@gmail.com>
  • Loading branch information
gaius-qi committed Nov 4, 2021
1 parent 036f126 commit e69eac2
Show file tree
Hide file tree
Showing 23 changed files with 421 additions and 295 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
uses: docker://avtodev/markdown-lint:v1
with:
args: '**/*.md'
ignore: 'deploy/helm-charts manager/console CHANGELOG.md docs/en/api-reference docs/zh-CN/api-reference'
ignore: 'deploy/helm-charts manager/console CHANGELOG.md docs/en/api-reference docs/zh-CN/api-reference docs/en/cli-reference/dfget.1.md'
10 changes: 8 additions & 2 deletions docs/en/cli-reference/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# CLI Reference

For almost all users, commandline is the first reference you may need. Document in directory `CLI Reference` is about command detailed usage of Dragonfly CLI including `dfget`, `cdn`, `scheduler` and `manager`. You can get introductions, synopsis, examples, options about command. Last but not least, Dragonfly can guarantee commandline docs is strongly consistent with Dragonfly CLI's source code. What's more, all commandline docs are auto generated via source code.
For almost all users, commandline is the first reference you may need.
Document in directory `CLI Reference` is about command detailed usage of
Dragonfly CLI including `dfget`, `cdn`, `scheduler` and `manager`.
You can get introductions, synopsis, examples, options about command.
Last but not least, Dragonfly can guarantee commandline docs is strongly
consistent with Dragonfly CLI's source code. What's more,
all commandline docs are auto generated via source code.

Table of contents:

* [dfget](dfget.md)
* [cdn](cdn.md)
* [scheduler](scheduler.md)
* [manager](manager.md)
* [manager](manager.md)
13 changes: 8 additions & 5 deletions docs/en/cli-reference/cdn.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
# CDN

CDN is a long-running process which caches downloaded data from source to avoid downloading the same files from source repeatedly
CDN is a long-running process which caches downloaded data
from source to avoid downloading the same files from source repeatedly.

## Usage

```
```shell
cdn [flags]
cdn [command]
```

## Available Commands:
## Available Commands

```
```text
doc generate documents
help Help about any command
version show version
```

## Flags

```
<!-- markdownlint-disable -->
```text
--config string the path of configuration file with yaml extension name, default is /Users/${USER_HOME}/.dragonfly/config/cdn.yaml, it can
also be set by environment variable cdn_config
--console whether logger output records to the stdout
Expand All @@ -29,3 +31,4 @@ version show version
--service-name string name of the service for tracer (default "dragonfly-cdn")
--verbose whether logger use debug level
```
<!-- markdownlint-restore -->
37 changes: 23 additions & 14 deletions docs/en/cli-reference/dfget.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
# dfget
# dfdaemon

## dfget

`dfget` is the client of Dragonfly used to download and upload files

### Synopsis

dfget is the client of Dragonfly which takes a role of peer in a P2P network. When user triggers a file downloading
task, dfget will download the pieces of file from other peers. Meanwhile, it will act as an uploader to support other
peers to download pieces from it if it owns them. In addition, dfget has the abilities to provide more advanced
functionality, such as network bandwidth limit, transmission encryption and so on.
dfget is the client of Dragonfly which takes
a role of peer in a P2P network. When user triggers a file downloading
task, dfget will download the pieces of
file from other peers. Meanwhile, it will act as an uploader to support other
peers to download pieces from it if it owns them.
In addition, dfget has the abilities to provide more advanced
functionality, such as network bandwidth limit,
transmission encryption and so on.

```
```shell
dfget [flags]
```

### Example

```
```shell
dfget --schedulers 127.0.0.1:8002 -o /path/to/output -u "http://example.com/object"
```

## Log configuration
### Log configuration

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

### Options

<!-- markdownlint-disable -->
```
--alivetime duration alive duration for which uploader keeps no accessing by any uploading requests, after this period uploader will automatically exit (default 5m0s)
--cacerts strings the cacert file which is used to verify remote server when supernode interact with the source.
Expand Down Expand Up @@ -57,23 +64,24 @@ set environment variable console=true if you want to print logs to Terminal
--totallimit ratelimit network bandwidth rate limit for the whole host, in format of G(B)/g/M(B)/m/K(B)/k/B, pure number will also be parsed as Byte (default 104857600.000000)
-u, --url string URL of user requested downloading file(only HTTP/HTTPs supported)
--verbose enable verbose mode, all debug log will be display
```
<!-- markdownlint-restore -->

# dfget daemon
## dfget daemon

## Log configuration
### Daemon Log configuration

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

### Options
### Daemon Options

<!-- markdownlint-disable -->
```
--advertise-ip string the ip report to scheduler, normal same with listen ip (default "10.15.232.63")
--alivetime duration alive duration for which uploader keeps no accessing by any uploading requests, after this period uploader will automatically exit (default 5m0s)
--alivetime duration alive duration for which uploader keeps no accessing by any uploading requests, after this period uploader will automatically exit (default 5m0s)
--data string local directory which stores temporary files for p2p uploading
--download-rate ratelimit download rate limit for other peers and back source (default 104857600.000000)
--expiretime duration caching duration for which cached file keeps no accessed by any process, after this period cache file will be deleted (default 3m0s)
--expiretime duration caching duration for which cached file keeps no accessed by any process, after this period cache file will be deleted (default 3m0s)
--gc-interval duration gc interval (default 1m0s)
--grpc-port int the listen address for grpc with other peers (default 65000)
--grpc-port-end int the listen address for grpc with other peers (default 65000)
Expand All @@ -96,3 +104,4 @@ set environment variable console=true if you want to print logs to Terminal
--upload-rate ratelimit upload rate limit for other peers (default 104857600.000000)
--verbose print verbose log and enable golang debug info
```
<!-- markdownlint-restore -->
45 changes: 25 additions & 20 deletions docs/en/cli-reference/manager.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,52 @@
## Manager
# Manager

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.
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
## Try it

```
```text
manager [Option]
```

### Log configuration
## Log configuration

```
```text
1. set option --console if you want to print logs to Terminal
2. log path: /var/log/dragonfly/manager/
```

### Runtime metrics monitoring
## Runtime metrics monitoring

```
```text
manager --pprof-port port
```

### Swagger support
## Swagger support

endpoint: /swagger/doc.json
endpoint: /swagger/doc.json

### Prometheus metrics monitoring
## Prometheus metrics monitoring

endpoint: /metrics

### HealthCheck
## HealthCheck

endpoint: /healthy/

## Enable jaeger

### Enable jaeger

```
```text
manager --jaeger http://localhost:14250/api/traces
```

### Options
## Options

```
<!-- markdownlint-disable -->
```text
--config string the path of configuration file with yaml extension name, default is /etc/dragonfly/manager.yaml, it can also be set by env var: MANAGER_CONFIG
--console whether logger output records to the stdout
-h, --help help for manager
Expand All @@ -52,6 +55,8 @@ manager --jaeger http://localhost:14250/api/traces
--service-name string name of the service for tracer (default "dragonfly-manager")
--verbose whether logger use debug level
```
<!-- markdownlint-restore -->

## Manager Config

### Manager Config
[Config Example](../config/manager.yaml)
[Config Example](../config/manager.yaml)
19 changes: 12 additions & 7 deletions docs/en/cli-reference/scheduler.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
# Scheduler

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
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

## Usage

```
```text
scheduler [flags]
scheduler [command]
```

## Available Commands:
## Available Commands

```
```text
doc generate documents
help Help about any command
version show version
```

## Flags

```
<!-- markdownlint-disable -->
```text
--config string the path of configuration file with yaml extension name, default is /Users/${USER_HOME}/.dragonfly/config/scheduler.yaml, it can
also be set by environment variable scheduler_config
also be set by environment variable scheduler_config
--console whether logger output records to the stdout
-h, --help help for scheduler
--jaeger string jaeger endpoint url, like: http://localhost:14250/api/traces
--pprof-port int listen port for pprof, 0 represents random port (default -1)
--service-name string name of the service for tracer (default "dragonfly-scheduler")
--verbose whether logger use debug level
```
<!-- markdownlint-restore -->
8 changes: 6 additions & 2 deletions docs/en/deployment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ Table of contents:

## Installation

Installation documents provide you with several options available to deploy the Dragonfly, such as [Kubernetes](installation/kubernetes/README.md) and [Docker](installation/docker/README.md).
Installation documents provide you with several options available to
deploy the Dragonfly, such as [Kubernetes](installation/kubernetes/README.md)
and [Docker](installation/docker/README.md).

## Configuration

[Configuration](configuration) is content all about customizing the Dragonfly. It includes information about the configuration of all components and their corresponding explanations.
[Configuration](configuration) is content all about customizing the Dragonfly.
It includes information about the configuration of all components and
their corresponding explanations.
4 changes: 3 additions & 1 deletion docs/en/deployment/installation/docker/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Installation

There are two installation methods, it is recommended to use docker-compose to install as a whole, or install separately according to modules.
There are two installation methods, it is recommended to
use docker-compose to install as a whole,
or install separately according to modules.

Table of contents:

Expand Down
11 changes: 7 additions & 4 deletions docs/en/deployment/installation/docker/standalone/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Installation

There are two installation methods, it is recommended to use helm charts to install as a whole, or install separately according to modules
There are two installation methods, it is recommended to
use helm charts to install as a whole, or install separately according to modules

## Install with Helm Charts

> ArtifactHub Link: https://artifacthub.io/packages/helm/dragonfly/dragonfly
> ArtifactHub Link: <https://artifacthub.io/packages/helm/dragonfly/dragonfly>
It is recommended to use helm charts for installation, which is a simple and quick installation. [Kubernetes-with-Dragonfly](../../kubernetes/README.md) is the installation instructions of dragonfly.
It is recommended to use helm charts for
installation, which is a simple and quick installation.
[Kubernetes-with-Dragonfly](../../kubernetes/README.md)
is the installation instructions of dragonfly.

## Install separately

Expand All @@ -17,4 +21,3 @@ It is recommended to use helm charts for installation, which is a simple and qui
* [install-scheduler](./scheduler.md) is the installation instructions of scheduler

* [install-cdn](./cdn.md) is the installation instructions of CDN

44 changes: 24 additions & 20 deletions docs/en/deployment/installation/docker/standalone/cdn.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,49 +19,53 @@ You can get it from [DockerHub](https://hub.docker.com/) directly.

1. Obtain the latest Docker image of the cdn.

```sh
docker pull dragonflyoss/cdn
```
```sh
docker pull dragonflyoss/cdn
```

Or you can build your own cdn image.

1. Obtain the source code of Dragonfly.

```sh
git clone https://github.com/dragonflyoss/Dragonfly2.git
```
```sh
git clone https://github.com/dragonflyoss/Dragonfly2.git
```

2. Enter the project directory.

```sh
cd Dragonfly2
```
```sh
cd Dragonfly2
```

3. Build the Docker image.

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

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

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

### Start cdn

**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/ftp:/home/admin/ftp ${cdnDockerImageId}
--download-port=8001
docker run -d --name cdn --restart=always \
-p 8001:8001 -p 8003:8003 \
-v /home/admin/ftp:/home/admin/ftp ${cdnDockerImageId} \
--download-port=8001
```

After cdn is installed, run the following commands to verify if Nginx and **cdn** are started, and if Port `8001` and `8003` are available.
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
```
```
Loading

0 comments on commit e69eac2

Please sign in to comment.