Skip to content

Commit

Permalink
docs: document dfdaemon add download case
Browse files Browse the repository at this point in the history
Signed-off-by: zhaoxinxin <[email protected]>
  • Loading branch information
Liam-Zhao committed Aug 28, 2024
1 parent 14c189c commit 61f319d
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 107 deletions.
88 changes: 34 additions & 54 deletions docs/reference/commands/client/dfdaemon.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,21 @@ Meanwhile, it will act as an uploader to support other peers to download pieces

#### Download with HTTP protocol

Configure Dfdaemon yaml file, The default path in Linux is `/etc/dragonfly/dfdaemon.yaml` in linux,
refer to [Dfdaemon](../../configuration/client/dfdaemon.md).

> Notice: set `cproxy.rules.regex` to match the download path.
```yaml
proxy:
server:
port: 4001
rules:
- regex: '.*example.*'
```
```shell
curl -v -x 127.0.0.1:4001 http://<host>:<port>/<path> --output /tmp/file.txt
curl -v -x 127.0.0.1:4001 http://<host>:<port>/<path> --output /path/to/example
```

#### Download with HTTPS protocol
Expand All @@ -70,39 +83,17 @@ refer to [Dfdaemon](../../configuration/client/dfdaemon.md).
> Notice: set `cproxy.rules.regex` to match the download path.
```yaml
manager:
addrs:
- http://dragonfly-manager:65003

upload:
server:
port: 4000

metrics:
server:
port: 4002

proxy:
server:
port: 4001
rules:
- regex: 'blobs/sha256.*'
```
Run Dfdaemon as Seed Peer:
```bash
# View Dfdaemon cli help docs.
dfdaemon --help

# Setup Dfdaemon, it is recommended to start Dfdaemon via systemd.
dfdaemon
- regex: '.*example.*'
```
Download with Insecure HTTPS protocol:
```shell
curl -v -x 127.0.0.1:4001 https://<host>:<port>/<path> --insecure --output /tmp/file.txt
curl -v -x 127.0.0.1:4001 https://<host>:<port>/<path> --insecure --output /path/to/example
```

##### Download with using custom CA certificates HTTPS protocol
Expand All @@ -113,52 +104,41 @@ Generate a CA certificates:
openssl req -x509 -sha256 -days 36500 -nodes -newkey rsa:4096 -keyout ca.key -out ca.crt
```

Configure Dfdaemon yaml file, The default path in Linux is `/etc/dragonfly/dfdaemon.yaml` in linux,
refer to [Dfdaemon](../../configuration/client/dfdaemon.md).
Trust the certificate at the OS level.

> Notice: set `cproxy.rules.regex` to match the download path.
- Ubuntu:

```yaml
manager:
addrs:
- http://dragonfly-manager:65003
```shell
cp ca.crt /usr/local/share/ca-certificates/ca.crt
update-ca-certificates
```

dynconfig:
refreshInterval: 30s
scheduler:
announceInterval: 30s
- Red Hat (CentOS etc):

upload:
server:
port: 4000
```shell
cp ca.crt /etc/pki/ca-trust/source/anchors/ca.crt
update-ca-trust
```

metrics:
server:
port: 4002
Configure Dfdaemon yaml file, The default path in Linux is `/etc/dragonfly/dfdaemon.yaml` in linux,
refer to [Dfdaemon](../../configuration/client/dfdaemon.md).

> Notice: set `cproxy.rules.regex` to match the download path.
```yaml
proxy:
server:
port: 4001
caCert: ca.crt
caKey: ca.key
rules:
- regex: 'blobs/sha256.*'
```
Run Dfdaemon as Seed Peer:
```bash
# View Dfdaemon cli help docs.
dfdaemon --help

# Setup Dfdaemon, it is recommended to start Dfdaemon via systemd.
dfdaemon
- regex: '.*example.*'
```
Download with HTTPS protocol:
```shell
curl -v -x 127.0.0.1:4001 https://<host>:<port>/<path> --output /tmp/file.txt
curl -v -x 127.0.0.1:4001 https://<host>:<port>/<path> --output /path/to/example
```

## Log {#log}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,21 @@ dfdaemon 将从其他 peer 下载文件片段。同时,它将充当上传者

#### 使用 HTTP 协议下载

编辑配置文件 Linux 环境下默认 Dfdaemon 配置路径为 `/etc/dragonfly/dfdaemon.yaml`
参考文档 [Dfdaemon](../../configuration/client/dfdaemon.md)

> 注意:可以根据下载路径修改 `proxy.rules.regex` 来调整路由匹配规则。
```yaml
proxy:
server:
port: 4001
rules:
- regex: '.*example.*'
```
```shell
curl -v -x 127.0.0.1:4001 http://<host>:<port>/<path> --output /tmp/file.txt
curl -v -x 127.0.0.1:4001 http://<host>:<port>/<path> --output /path/to/example
```

#### 使用 HTTPS 协议下载
Expand All @@ -69,39 +82,17 @@ curl -v -x 127.0.0.1:4001 http://<host>:<port>/<path> --output /tmp/file.txt
> 注意:可以根据下载路径修改 `proxy.rules.regex` 来调整路由匹配规则。
```yaml
manager:
addrs:
- http://dragonfly-manager:65003

upload:
server:
port: 4000

metrics:
server:
port: 4002

proxy:
server:
port: 4001
rules:
- regex: 'blobs/sha256.*'
```
运行 Dfdaemon:
```bash
# 查看 Dfdaemon cli 帮助。
dfdaemon --help

# 启动 Dfdaemon 模式,推荐使用 systemd 启动 Dfdaemon。
dfdaemon
- regex: '.*example.*'
```
使用 Insecure HTTPS 请求下载文件
```shell
curl -v -x 127.0.0.1:4001 https://<host>:<port>/<path> --insecure --output /tmp/file.txt
curl -v -x 127.0.0.1:4001 https://<host>:<port>/<path> --insecure --output /path/to/example
```

##### 使用自签 CA 证书进行 HTTPS 协议下载
Expand All @@ -112,47 +103,40 @@ curl -v -x 127.0.0.1:4001 https://<host>:<port>/<path> --insecure --output /tmp/
openssl req -x509 -sha256 -days 36500 -nodes -newkey rsa:4096 -keyout ca.key -out ca.crt
```

编辑配置文件 Linux 环境下默认 Dfdaemon 配置路径为 `/etc/dragonfly/dfdaemon.yaml`
参考文档 [Dfdaemon](../../configuration/client/dfdaemon.md)

> 注意:可以根据下载路径修改 `proxy.rules.regex` 来调整路由匹配规则。
信任自签名证书。

```yaml
manager:
addrs:
- http://dragonfly-manager:65003
- Ubuntu:

upload:
server:
port: 4000
```shell
cp ca.crt /usr/local/share/ca-certificates/ca.crt
update-ca-certificates
```

metrics:
server:
port: 4002
- Red Hat (CentOS etc):

proxy:
server:
port: 4001
caCert: ca.crt
caKey: ca.key
rules:
- regex: 'blobs/sha256.*'
```shell
cp ca.crt /etc/pki/ca-trust/source/anchors/ca.crt
update-ca-trust
```

运行 Dfdaemon:
编辑配置文件 Linux 环境下默认 Dfdaemon 配置路径为 `/etc/dragonfly/dfdaemon.yaml`
参考文档 [Dfdaemon](../../configuration/client/dfdaemon.md)

```bash
# 查看 Dfdaemon cli 帮助。
dfdaemon --help
> 注意:可以根据下载路径修改 `proxy.rules.regex` 来调整路由匹配规则。
# 启动 Dfdaemon 模式,推荐使用 systemd 启动 Dfdaemon。
dfdaemon
```yaml
server:
port: 4001
caCert: ca.crt
caKey: ca.key
rules:
- regex: '.*example.*'
```
使用 HTTPS 请求下载文件
```shell
curl -v -x 127.0.0.1:4001 https://<host>:<port>/<path> --output /tmp/file.txt
curl -v -x 127.0.0.1:4001 https://<host>:<port>/<path> --output /path/to/example
```

## Dfdaemon 日志
Expand Down

0 comments on commit 61f319d

Please sign in to comment.