Skip to content

Commit

Permalink
docs of dragonfly2.0
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 10, 2021
1 parent dd6daf5 commit fdb9eaf
Show file tree
Hide file tree
Showing 10 changed files with 973 additions and 0 deletions.
117 changes: 117 additions & 0 deletions docs/en/quick_start/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Dragonfly Quick Start

Dragonfly Quick Start document aims to help you to quick start Dragonfly journey. This experiment is quite easy and simplified.

If you are using Dragonfly in your **production environment** to handle production image distribution, please refer to supernode and dfget's detailed production parameter configuration.

## Prerequisites

All steps in this document is doing on the same machine using the docker container, so make sure the docker container engine installed and started on your machine. You can also refer to the documentation: [multi-machine deployment](../user_guide/multi_machines_deployment.md) to experience Dragonfly.

## Step 1: Deploy Dragonfly Manager Server

```bash
docker run -d --name supernode \
--restart=always \
-p 8001:8001 \
-p 8002:8002 \
-v /home/admin/supernode:/home/admin/supernode \
dragonflyoss/supernode:1.0.2
```

## Step 2: Deploy Dragonfly CDN Server

```bash
docker run -d --name supernode \
--restart=always \
-p 8001:8001 \
-p 8002:8002 \
-v /home/admin/supernode:/home/admin/supernode \
dragonflyoss/supernode:1.0.2
```

## Step 3: Deploy Dragonfly Scheduler Server

```bash
docker run -d --name supernode \
--restart=always \
-p 8001:8001 \
-p 8002:8002 \
-v /home/admin/supernode:/home/admin/supernode \
dragonflyoss/supernode:1.0.2
```

## Step 2: Deploy Dragonfly Client

```bash
SUPERNODE_IP=`docker inspect supernode -f '{{.NetworkSettings.Networks.bridge.IPAddress}}'`
docker run -d --name dfclient \
--restart=always \
-p 65001:65001 \
-v $HOME/.small-dragonfly:/root/.small-dragonfly \
dragonflyoss/dfclient:1.0.2 --registry https://index.docker.io --node $SUPERNODE_IP
```

**NOTE**:

- The `--registry` parameter specifies the mirrored image registry address, and `https://index.docker.io` is the address of official image registry, you can also set it to the other **non-https image registries**.
- The `--node` parameter specifies the supernode's address in the format of **HOST:IP**. And the default value `8002` will be used if the port is not specified. Here we use `docker inspect` to get the ip of supernode container as the host value. Since the supernode container exposes its ports, you can specify this parameter to node ip address as well.

## Step 3. Configure Docker Daemon

We need to modify the Docker Daemon configuration to use the Dragonfly as a pull through registry.

1. Add or update the configuration item `registry-mirrors` in the configuration file`/etc/docker/daemon.json`.

```json
{
"registry-mirrors": ["http://127.0.0.1:65001"]
}
```

**Tip:** For more information on `/etc/docker/daemon.json`, see [Docker documentation](https://docs.docker.com/registry/recipes/mirror/#configure-the-cache).

2. Restart Docker Daemon.

```bash
systemctl restart docker
```

## Step 4: Pull images with Dragonfly

Through the above steps, we can start to validate if Dragonfly works as expected.

And you can pull the image as usual, for example:

```bash
docker pull nginx:latest
```

## Step 5: Validate Dragonfly

You can execute the following command to check if the nginx image is distributed via Dragonfly.

```bash
docker exec dfclient grep 'downloading piece' /root/.small-dragonfly/logs/dfclient.log
```

If the output of command above has content like

```
2019-03-29 15:49:53.913 INFO sign:96027-1553845785.119 : downloading piece:{"taskID":"00a0503ea12457638ebbef5d0bfae51f9e8e0a0a349312c211f26f53beb93cdc","superNode":"127.0.0.1","dstCid":"127.0.0.1-95953-1553845720.488","range":"67108864-71303167","result":503,"status":701,"pieceSize":4194304,"pieceNum":16}
```

then Dragonfly works successfully.

## SEE ALSO

- [multi machines deployment](../user_guide/multi_machines_deployment.md) - experience Dragonfly on multiple machines
- [install manager](../user_guide/install_manager.md) - how to install the Dragonfly manager
- [install cdn](../user_guide/install_cdn.md) - how to install the Dragonfly cdn
- [install scheduler](../user_guide/install_scheduler.md) - how to install the Dragonfly scheduler
- [install client](../user_guide/install_client.md) - how to install the Dragonfly client
- [proxy](../user_guide/proxy/docker.md) - make Dragonfly as an HTTP proxy for docker daemon
- [download files](../user_guide/download_files.md) - download files with Dragonfly
- Container Runtimes
- [cri-o mirror](../user_guide/registry/cri-o.md) - make Dragonfly as Registry Mirror for CRIO daemon
- [cri-containerd_mirror](../user_guide/registry/cri-containerd.md) - make Dragonfly as Registry Mirror for containerd daemon
131 changes: 131 additions & 0 deletions docs/en/user_guide/download_files.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Downloading Files with Dragonfly

Things are done differently when you download container images and download general files with Dragonfly.

## Prerequisites

- You are using Linux operating system.
- The supernode service is started.

**Tip:** For more information on the dfget command, see [dfget](../cli_reference/dfget.md). For more information on the installation of supernodes, see [Installing Server](./install_server.md).

## Downloading container images

1. Config the supernodes with the configuration file.

```shell
cat <<EOD > /etc/dragonfly/dfget.yml
nodes:
- supernode01:port
- supernode02:port
- supernode03:port
EOD
```
2. Start the dfget proxy (dfdaemon).
```sh
# Start dfdaemon and specify the image repo URL. The default port is `65001`.
dfdaemon --registry https://xxx.xx.x
# Review dfdaemon logs
tailf ~/.small-dragonfly/logs/dfdaemon.log
```
**Tip:** To list all available parameters for dfdaemon, run `dfdaemon -h`.
3. Configure the Docker daemon.
a. Modify the configuration file `/etc/docker/daemon.json`.
```sh
vi /etc/docker/daemon.json
```
**Tip:** For more information on `/etc/docker/daemon.json`, see [Docker documentation](https://docs.docker.com/registry/recipes/mirror/#configure-the-cache).
b. Add or update the configuration item `registry-mirrors` in the configuration file.
```sh
"registry-mirrors": ["http://127.0.0.1:65001"]
```
c. Restart Docker daemon.
```bash
systemctl restart docker
```
d. Add authentication info for the private docker registry in `~/.docker/config.json` if the registry is configured with auth.
```json
{
"auths": {
"https://index.docker.io/v1/": {
"auth": "${auth_value}"
}
}
}
```
The ${auth_value} is `base64("${username}:${password}")`.
```bash
echo "${username}:${password}" | base64
```
4. Download an image with Dragonfly.
```bash
docker pull {imageName}
```
**Note:** Don't include the image repo URL in {imageName}, because the repo URL has been specified with the `registry` parameter when starting dfdaemon.
## Downloading General Files
1. Specify the supernodes in one of the following ways.
- Specifying with the configuration file.
```sh
cat <<EOD > /etc/dragonfly/dfget.yml
nodes:
- supernode01:port
- supernode02:port
- supernode03:port
EOD
```
- Specifying with the parameter in the command line.
```sh
dfget -u "http://www.taobao.com" -o /tmp/test.html --node supernode01:port,supernode02:port,supernode03:port
```
**Note:** When using this method, you must add the `node` parameter whenever you run the dfget command. And the parameter in the command line takes precedence over the configuration file.
2. Download general files with Dragonfly in one of the following ways.
- Download files with the default `/etc/dragonfly/dfget.yml` configuration.
```sh
dfget --url "http://xxx.xx.x"
```
**Tip:** To list all available parameters for dfget, run `dfget -h`.
- Download files with your specified supernodes.
```sh
dfget --url "http://xxx.xx.x" --node "127.0.0.1:8002"
```
- Download files to your specified output file.
```sh
dfget --url "http://xxx.xx.x" -o a.txt
```
## After this Task
To review the downloading log, run `less ~/.small-dragonfly/logs/dfclient.log`.
Loading

0 comments on commit fdb9eaf

Please sign in to comment.