Skip to content

Commit

Permalink
docs(docs): optimize document
Browse files Browse the repository at this point in the history
Signed-off-by: cndoit18 <cndoit18@outlook.com>
  • Loading branch information
cndoit18 committed Oct 14, 2021
1 parent 808c22e commit aa24613
Show file tree
Hide file tree
Showing 38 changed files with 724 additions and 508 deletions.
70 changes: 35 additions & 35 deletions docs/en/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,81 +5,81 @@ Dragonfly Document is written, drawn, memorialized representation of all things
Organization of document is as following:

* [Quick Start](#Quick-Start)
* [User Guide](#User-Guide)
* [Design Docs](#Design-Docs)
* [manager](design/manager.md)
* [TODO scheduler](design/scheduler.md)
* [TODO cdn](design/cdn.md)
* [TODO dfdaemon](desigin/dfdaemon.md)
* [Deployment](#Deployment)
* [Installation](#Installation)
* [TODO Configuration](#Configuration)
* [CLI Reference](#CLI-Reference)
* [dfget](cli-reference/dfget.md)
* [cdn](cli-reference/cdn.md)
* [scheduler](cli-reference/scheduler.md)
* [manager](cli-reference/manager.md)
* [dfget](cli-reference/dfget.md)
* [cdn](cli-reference/cdn.md)
* [scheduler](cli-reference/scheduler.md)
* [manager](cli-reference/manager.md)
* [API Reference](#API-Reference)
* [Ecosystem](#Ecosystem)
* [Kubernetes Integration](ecosystem/Kubernetes-with-Dragonfly.md)
* [WIP Harbor Integration](ecosystem/Harbor-with-Dragonfly.md)
* [TODO Harbor Integration](ecosystem/Harbor-with-Dragonfly.md)
* [Developer Guide](#Developer-Guide)
* [Design Doc](#Design-Doc)
* [Test Guide](#Test-Guide)
* [Test Guide](#Test-Guide)

## How to Contribute Document

Find `WIP` or `TODO` in this page and follow [CONTRIBUTING](../../CONTRIBUTING.md).

## Quick Start

[Quick Started](user-guide/quick-start.md) is exactly what you need if you would give Dragonfly a try. This document includes what are the
prerequisites,
how to install Dragonfly and how to experience Dragonfly's usage.
[Quick Started](quick-start.md) is exactly what you need if you would give Dragonfly a try. This document includes what are the prerequisites, how to install Dragonfly and how to experience Dragonfly's usage.

## User Guide
## Design Docs

[User Guide](user-guide) helps all kinds of guidance end users need to experience Dragonfly. Not only the very brief [Quick Start]
(user-guide/quick-start.md), but the detailed binary installation and configure illustration. In addition, any concept and function which help users
understand Dragonfly better would be included as well.
[Design Docs](design) is content all about design of Dragonfly. It includes all things taken into consideration at the very beginning, the architecture designed for all components in Dragonfly, the interactive workflow between components, all APIs in Dragonfly and some technical things else.

## Deployment

### Installation

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

### Configuration

[Configuration](deployment/configuration) is content all about customizing the Dragonfly. It includes information about the configuration of all components and their corresponding explanations.

## CLI Reference

For almost all users, commandline is the first reference you may need. Document in directory [CLI Reference](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.

## API Reference

Commandline is the easiest way to experience Dragonfly's ability. API extension will bring more further experience of Dragonfly. Commandline is just one
kind of combination usage of API, if you wish to hack or take more advantages of Dragonfly, please see [API Reference](/api/README.md). Like command line
document, all API docs are auto generated via source code.
Commandline is the easiest way to experience Dragonfly's ability. API extension will bring more further experience of Dragonfly. Commandline is just one kind of combination usage of API, if you wish to hack or take more advantages of Dragonfly, please see [API Reference](/api/README.md). Like command line document, all API docs are auto generated via source code.

## Ecosystem

Ecosystem documents show connections between Dragonfly and popular tool or system in cloud native ecosystem. They guide end users how to experience cloud
native systems with Dragonfly, such as other CNCF project [Kubernetes](ecosystem/Kubernetes-with-Dragonfly.md) and [Harbor](ecosystem/Harbor-with-Dragonfly.md).
Ecosystem documents show connections between Dragonfly and popular tool or system in cloud native ecosystem. They guide end users how to experience cloud native systems with Dragonfly, such as other CNCF project [Harbor](ecosystem/Harbor-with-Dragonfly.md).

## Developer Guide

[Develop Guide](development/local.md) helps (potential) developers/contributors to understand the theory inside Dragonfly rather than the interface it exposes. With
better understanding of how Dragonfly is designed, developer could learn source code of Dragonfly much easier and know how to debug, test and hack.
[Develop Guide](developer-guide/local.md) helps (potential) developers/contributors to understand the theory inside Dragonfly rather than the interface it exposes. With better understanding of how Dragonfly is designed, developer could learn source code of Dragonfly much easier and know how to debug, test and hack.

### Design Doc
## Test Guide

[Design Doc](./design/architecture.md) is content all about design of Dragonfly. It includes all things taken into consideration at the very beginning, the
architecture designed for all components in Dragonfly, the interactive workflow between components, all APIs in Dragonfly and some technical things else.

### Test Guide

[Test Guide](./test-guide/test-guide.md) is the best reference helping contributors get aware of how to setup testing environment and do it. Currently we can divide test of Dragonfly into four dimensions:
[Test Guide](test-guide/test-guide.md) is the best reference helping contributors get aware of how to setup testing environment and do it. Currently we can divide test of Dragonfly into four dimensions:

* unit test;
* API integration test;
* CLI integration test;
* node e2e test.

For more details, please refer to [test](./test-guide/test-guide.md).
For more details, please refer to [test](test-guide/test-guide.md).

## Conclusion

The folder `/docs` does not contain all the document about Dragonfly. There are still other really helpful documents in other path of this repo, like:

* [TODO FAQ.md](./FAQ.md)
* [TODO FAQ.md](FAQ.md)
* [CHANGELOG.md](../../CHANGELOG.md)
* [TODO ROADMAP.md](./ROADMAP.md)
* [TODO ROADMAP.md](ROADMAP.md)
* others.

If you are searching some document and find no one, please do not hesitate to [file an ISSUE](https://github.com/dragonflyoss/Dragonfly2/issues/new/choose) for help. In addition, if you found that there are some incorrect places or typos in document, please help submit a pull request to correct that.


Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,130 @@ You can get the certificate of your server with:
```
openssl x509 -in <(openssl s_client -showcerts -servername xxx -connect xxx:443 -prexit 2>/dev/null)
```

# Use dfget daemon as registry mirror for Containerd with CRI support

From v1.1.0, Containerd supports registry mirrors, we can configure Containerd via this feature for HA.

## Quick Start

### Step 1: Configure dfget daemon

To use dfget daemon as registry mirror, first you need to ensure configuration in `/etc/dragonfly/dfget.yaml`:

```yaml
proxy:
security:
insecure: true
tcpListen:
listen: 0.0.0.0
port: 65001
registryMirror:
# multiple registries support, if only mirror single registry, disable this
dynamic: true
url: https://index.docker.io
proxies:
- regx: blobs/sha256.*
```

Run dfget daemon

```shell
dfget daemon
```

## Step 2: Configure Containerd

### Option 1: Single Registry

Enable mirrors in Containerd registries configuration in
`/etc/containerd/config.toml`:

```toml
# explicitly use v2 config format, if already v2, skip the "version = 2"
version = 2
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
endpoint = ["http://127.0.0.1:65001","https://registry-1.docker.io"]
```

In this config, there is two mirror endpoints for "docker.io", Containerd will pull images with `http://127.0.0.1:65001` first.
If `http://127.0.0.1:65001` is not available, the default `https://registry-1.docker.io` will be used for HA.

> More details about Containerd configuration: https://github.com/containerd/containerd/blob/v1.5.2/docs/cri/registry.md#configure-registry-endpoint

> Containerd has deprecated the above config from v1.4.0, new format for reference: https://github.com/containerd/containerd/blob/v1.5.2/docs/cri/config.md#registry-configuration

### Option 2: Multiple Registries

This option only supports Containerd 1.5.0+.

#### 1. Enable Containerd Registries Config Path

Enable mirrors in Containerd registries config path in
`/etc/containerd/config.toml`:

```toml
# explicitly use v2 config format, if already v2, skip the "version = 2"
version = 2
[plugins."io.containerd.grpc.v1.cri".registry]
config_path = "/etc/containerd/certs.d"
```

#### 2. Generate Per Registry hosts.toml

##### Option 1: Generate hosts.toml manually

Path: `/etc/containerd/certs.d/example.com/hosts.toml`

Replace `example.com` according the different registry domains.

Content:

```toml
server = "https://example.com"
[host."http://127.0.0.1:65001"]
capabilities = ["pull", "resolve"]
[host."http://127.0.0.1:65001".header]
X-Dragonfly-Registry = ["https://example.com"]
```

##### Option 2: Generate hosts.toml automatically

You can also generate hosts.toml with https://github.com/dragonflyoss/Dragonfly2/blob/main/hack/gen-containerd-hosts.sh

```shell
bash gen-containerd-hosts.sh example.com
```

> More details about registry configuration: https://github.com/containerd/containerd/blob/main/docs/hosts.md#registry-configuration---examples

## Step 3: Restart Containerd Daemon

```
systemctl restart containerd
```
## Step 4: Pull Image
You can pull image like this:
```
crictl pull docker.io/library/busybox
```
## Step 5: Validate Dragonfly
You can execute the following command to check if the busybox image is distributed via Dragonfly.
```bash
grep 'register peer task result' /var/log/dragonfly/daemon/*.log
```

If the output of command above has content like

```
{"level":"info","ts":"2021-02-23 20:03:20.306","caller":"client/client.go:83","msg":"register peer task result:true[200] for taskId:adf62a86f001e17037eedeaaba3393f3519b80ce,peerIp:10.15.233.91,securityDomain:,idc:,scheduler:127.0.0.1:8002","peerId":"10.15.233.91-65000-43096-1614081800301788000","errMsg":null}
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
8 changes: 8 additions & 0 deletions docs/en/deployment/installation/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +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.

Table of contents:

* [Docker Compose](docker-compose.md)
* [Standalone](standalone)
1 change: 1 addition & 0 deletions docs/en/deployment/installation/docker/docker-compose.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# WIP Docker-Compose Support
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ It is recommended to use helm charts for installation, which is a simple and qui

## Install separately

* [install-client](./install-dfdaemon.md) is the installation instructions of dfdaemon
* [install-client](./dfdaemon.md) is the installation instructions of dfdaemon

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

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

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

67 changes: 67 additions & 0 deletions docs/en/deployment/installation/docker/standalone/cdn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Installing Dragonfly CDN Server

This topic explains how to install the Dragonfly CDN server.

## Prerequisites

When deploying with Docker, the following conditions must be met.

Required Software | Version Limit
---|---
Git|1.9.1+
Docker|1.12.0+

## Procedure - When Deploying with Docker

### Get cdn image

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

Or you can build your own cdn image.

1. Obtain the source code of Dragonfly.

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

2. Enter the project directory.

```sh
cd Dragonfly2
```

3. Build the Docker image.

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

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

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 aa24613

Please sign in to comment.