Jelajahi Sumber

docs: refactor compile & installation (#2251)

Signed-off-by: Jiyong Huang <huangjy@emqx.io>
ngjaying 1 tahun lalu
induk
melakukan
bd969587a9

+ 2 - 37
docs/directory.json

@@ -87,26 +87,7 @@
     },
     {
       "title": "安装与部署",
-      "path": "installation",
-      "children": [
-        {
-          "title": "编译安装",
-          "children": [
-            {
-              "title": "源码编译",
-              "path": "operation/compile/compile"
-            },
-            {
-              "title": "交叉编译",
-              "path": "operation/compile/cross-compile"
-            },
-            {
-              "title": "按需编译",
-              "path": "operation/compile/features"
-            }
-          ]
-        }
-      ]
+      "path": "installation"
     },
     {
       "title": "规则",
@@ -783,23 +764,7 @@
     },
     {
       "title": "Installation",
-      "path": "installation",
-      "children": [
-        {
-          "title": "Build from Source Code",
-          "path": "operation/compile/compile",
-          "children": [
-            {
-              "title": "Cross Compile",
-              "path": "operation/compile/cross-compile"
-            },
-            {
-              "title": "Compile selected features only",
-              "path": "operation/compile/features"
-            }
-          ]
-        }
-      ]
+      "path": "installation"
     },
     {
       "title": "Rules",

+ 3 - 1
docs/en_US/extension/external/external_func.md

@@ -15,7 +15,9 @@ The json configuration file includes the following two parts:
 
 - about: Used to describe the Meta-information of service, including author, detailed description, help document url, etc. For detailed usage, please refer to the example below.
 - interfaces: Used to define a set of service interfaces. Services provided by the same server often have the same service address and can be used as a service interface. Each service interface contains the following attributes:
-  - protocol: The protocol used by the service. "grpc", "rest" are supported currently. The "msgpack-rpc" is not built by default, you need to build it with build tag "msgpack" by yourself. Please refer to [feature compilation](../../operation/compile/features.md#usage) for detail.
+  - protocol: The protocol used by the service. "grpc", "rest" are supported currently. The "msgpack-rpc" is not built
+    by default, you need to build it with build tag "msgpack" by yourself. Please refer
+    to [feature compilation](../../installation.md#compile-with-selected-features) for detail.
   - address: Service address, which must be url. For example, typical rpc service address: "tcp://localhost:50000" or http service address "https://localhost:8000".
   - schemaType: The type of service description file. Only "protobuf" is supported currently .
   - schemaFile: service description file, currently only proto file is supported. The rest and msgpack services also need to be described in proto.

+ 87 - 1
docs/en_US/installation.md

@@ -225,7 +225,93 @@ When installing by package, the eKuiper folders are not in the same directory. T
    $ bin/kuiperd
    ```
 
-eKuiper allows to tailor the binary in compilation to get a customized feature set. As written by go, it also allows cross compilation. For detail, please check [compilation](./operation/compile/compile.md).
+### Compile Packages and Docker Images
+
+- Packages: `$ make pkg`
+  - Packages files that support EdgeX: `$ make pkg_with_edgex`
+- Docker images: `$ make docker`
+
+  > Notice that: Docker images support EdgeX by default
+
+### Cross-compile binaries
+
+Go supports cross-compiling binaries for multiple platforms which applies to eKuiper as well. Because eKuiper depends on
+sqlite, CGO_ENABLED must be set to 1 which requires to install and specify the gcc of the target system.
+
+- Install the GNU toolchain/gcc of the target system.
+- Modify the Makefile to specify `GOOS`, `GOARCH` and `CC`  and then build.
+
+For example, to cross build ARM64 binaries in AMD64 ubuntu/debian machine, do these steps:
+
+1. Install the GNU toolchain/gcc of the target system ARM64
+
+      ```shell
+      apt-get install gcc-aarch64-linux-gnu
+      ```
+
+2. Update the Makefile in the build command. Examples:
+
+      ```shell
+      GO111MODULE=on CGO_ENABLED=1 GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -trimpath -ldflags="-s -w -X main.Version=$(VERSION) -X main.LoadFileType=relative" -o kuiperd cmd/kuiperd/main.go
+      ```
+
+3. Run `make`
+
+### Compile with Selected Features
+
+eKuiper allows tailoring the binary in compilation to get a customized feature set.
+As written by go, it also allows cross compilation.
+Except core runtime and REST api,
+there are some features
+that are allowed
+to be enabled or disabled during compilation
+by [go build constraints](https://pkg.go.dev/go/build#hdr-Build_Constraints).
+Uses can customize the built binary
+to include only the desired features to reduce the binary size according to the limit of the target environment.
+
+| Feature                                                                                       | Build Tag  | Description                                                                                                                                            |
+|-----------------------------------------------------------------------------------------------|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|
+| Core                                                                                          | core       | The core of eKuiper. It contains the processor and REST API for stream/table/rule, the configuration processing, the SQL parser, the rule runtime etc. |
+| [CLI](./api/cli/overview.md)                                                                  | rpc        | The cli server                                                                                                                                         |
+| [EdgeX Foundry integration](./edgex/edgex_rule_engine_tutorial.md)                            | edgex      | The built-in edgeX source, sink and connection                                                                                                         |
+| [Native plugin](./extension/native/overview.md)                                               | plugin     | The native plugin runtime, REST API, CLI API etc.                                                                                                      |
+| [Portable plugin](./extension/portable/overview.md)                                           | portable   | The portable plugin runtime, REST API, CLI API etc.                                                                                                    |
+| [External service](./extension/external/external_func.md)                                     | service    | The external service runtime, REST API, CLI API etc.                                                                                                   |
+| [Msgpack-rpc External service](./extension/external/external_func.md)                         | msgpack    | Support msgpack-rpc protocol in external service                                                                                                       |
+| [UI Meta API](./operation/manager-ui/overview.md)                                             | ui         | The REST API of the metadata which is usually consumed by the ui                                                                                       |
+| [Prometheus Metrics](./configuration/global_configurations.md#prometheus-configuration)       | prometheus | Support to send metrics to prometheus                                                                                                                  |
+| [Extended template functions](./guide/sinks/data_template.md#functions-supported-in-template) | template   | Support additional data template function from sprig besides default go text/template functions                                                        |
+| [Codecs with schema](./guide/serialization/serialization.md)                                  | schema     | Support schema registry and codecs with schema such as protobuf                                                                                        |
+
+In makefile, we already provide three feature sets: standard, edgeX and core. The standard feature set include all
+features in the list except edgeX; edgeX feature set include all features; And the core feature set is the minimal which
+only has core feature. Build these feature sets with default makefile:
+
+```shell
+# standard
+make
+# EdgeX
+make build_with_edgex
+# core
+make build_core
+```
+
+Feature selection is useful in a limited resource target which is unlikely to run as docker container. So we only
+provide standard feature set in the docker images.
+
+And users need to build from source to customize the feature sets. To build with the desired features:
+
+```shell
+go build --tags "<FEATURE>"
+```
+
+For example, to build with core and native plugin support:
+
+```shell
+go build --tags "core plugin"
+```
+
+Recommend updating the build command in the Makefile with tags and building from make.
 
 ## Installation structure
 

+ 0 - 17
docs/en_US/operation/compile/compile.md

@@ -1,17 +0,0 @@
-#### Compile from source code
-
-+ Binary:
-
-  + Binary: `$ make`
-
-  + Binary files that support EdgeX: `$ make build_with_edgex`
-
-+ Packages: `$ make pkg`
-
-  + Packages: `$ make pkg`
-
-  + Packages files that support EdgeX: `$ make pkg_with_edgex`
-
-+ Docker images: `$ make docker`
-
-  > Docker images support EdgeX by default

+ 0 - 22
docs/en_US/operation/compile/cross-compile.md

@@ -1,22 +0,0 @@
-## Cross-compile binaries
-
-Go supports cross-compiling binaries for multiple platforms which applies to eKuiper as well. Because eKuiper depends on sqlite, CGO_ENABLED must be set to 1 which requires to install and specify the gcc of the target system.
-
-- Install the GNU toolchain/gcc of the target system.
-- Modify the Makefile to specify `GOOS`, `GOARCH` and `CC`  and then build.
-
-For example, to cross build ARM64 binaries in AMD64 ubuntu/debian machine, do these steps:
-
-1. Install the GNU toolchain/gcc of the target system ARM64
-
-      ```shell
-      apt-get install gcc-aarch64-linux-gnu
-      ```
-
-2. Update the Makefile in the build command. Examples:
-
-      ```shell
-      GO111MODULE=on CGO_ENABLED=1 GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -trimpath -ldflags="-s -w -X main.Version=$(VERSION) -X main.LoadFileType=relative" -o kuiperd cmd/kuiperd/main.go
-      ```
-
-3. Run `make`

+ 0 - 48
docs/en_US/operation/compile/features.md

@@ -1,48 +0,0 @@
-# Features
-
-Except core runtime and REST api, there are some features that are allowed to be enabled or disabled during compilation by [go build constraints](https://pkg.go.dev/go/build#hdr-Build_Constraints). Uses can customize the built binary to include only the desired features to reduce the binary size according to the limit of the target environment.
-
-## Feature List
-
-| Feature                                                                                           | Build Tag  | Description                                                                                                                                            |
-|---------------------------------------------------------------------------------------------------|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|
-| Core                                                                                              | core       | The core of eKuiper. It contains the processor and REST API for stream/table/rule, the configuration processing, the SQL parser, the rule runtime etc. |
-| [CLI](../../api/cli/overview.md)                                                                  | rpc        | The cli server                                                                                                                                         |
-| [EdgeX Foundry integration](../../edgex/edgex_rule_engine_tutorial.md)                            | edgex      | The built-in edgeX source, sink and connection                                                                                                         |
-| [Native plugin](../../extension/native/overview.md)                                               | plugin     | The native plugin runtime, REST API, CLI API etc.                                                                                                      |
-| [Portable plugin](../../extension/portable/overview.md)                                           | portable   | The portable plugin runtime, REST API, CLI API etc.                                                                                                    |
-| [External service](../../extension/external/external_func.md)                                     | service    | The external service runtime, REST API, CLI API etc.                                                                                                   |
-| [Msgpack-rpc External service](../../extension/external/external_func.md)                         | msgpack    | Support msgpack-rpc protocol in external service                                                                                                       |
-| [UI Meta API](../../operation/manager-ui/overview.md)                                             | ui         | The REST API of the metadata which is usually consumed by the ui                                                                                       |
-| [Prometheus Metrics](../../configuration/global_configurations.md#prometheus-configuration)       | prometheus | Support to send metrics to prometheus                                                                                                                  |
-| [Extended template functions](../../guide/sinks/data_template.md#functions-supported-in-template) | template   | Support additional data template function from sprig besides default go text/template functions                                                        |
-| [Codecs with schema](../../guide/serialization/serialization.md)                                  | schema     | Support schema registry and codecs with schema such as protobuf                                                                                        |
-
-## Usage
-
-In makefile, we already provide three feature sets: standard, edgeX and core. The standard feature set include all features in the list except edgeX; edgeX feature set include all features; And the core feature set is the minimal which only has core feature. Build these feature sets with default makefile:
-
-```shell
-# standard
-make
-# EdgeX
-make build_with_edgex
-# core
-make build_core
-```
-
-Feature selection is useful in a limited resource target which is unlikely to run as docker container. So we only provide standard feature set in the docker images.
-
-And users need to build from source to customize the feature sets. To build with the desired features:
-
-```shell
-go build --tags "<FEATURE>"
-```
-
-For example, to build with core and native plugin support:
-
-```shell
-go build --tags "core plugin"
-```
-
-Recommend updating the build command in the Makefile with tags and build from make.

+ 2 - 1
docs/zh_CN/extension/external/external_func.md

@@ -15,7 +15,8 @@ json 配置文件包括以下两个部分:
 
 - about: 用于描述服务的元信息,包括作者,详细描述,帮助文档 url 等。详细用法请参考下面的范例。
 - interfaces: 用于定义一组服务接口。同一个服务器提供的服务往往具有相同的服务地址,可作为一个服务接口。每一个服务接口包含下列属性:
-  - protocol: 服务采用的协议。目前支持 "grpc", "rest"。需要注意的是, "msgpack-rpc" 服务没有编译到默认的 eKuiper 中,需要添加 build tag "msgpack" 并自行编译。详情请参考[按需编译](../../operation/compile/features.md#使用)。
+  - protocol: 服务采用的协议。目前支持 "grpc", "rest"。需要注意的是, "msgpack-rpc" 服务没有编译到默认的 eKuiper 中,需要添加
+    build tag "msgpack" 并自行编译。详情请参考[按需编译](../../installation.md#按需编译功能)。
   - adddress: 服务地址,必须为 url。例如,典型 rpc 服务地址:"tcp://localhost:50000" 或者 http 服务地址 "<https://localhost:8000"。>
   - schemaType: 服务描述文件类型。目前仅支持 "protobuf"。
   - schemaFile: 服务描述文件,目前仅支持 proto 文件。rest 和 msgpack 服务也需要采用 proto 描述。

+ 79 - 1
docs/zh_CN/installation.md

@@ -225,7 +225,85 @@ eKuiper 发布了以下操作系统的二进制包,支持 AMD64、ARM 和 ARM6
    $ bin/kuiperd
    ```
 
-eKuiper 允许在编译中对二进制文件进行定制,以获得定制的功能集。它也允许交叉编译,详情请查看 [compilation](./operation/compile/compile.md)。
+### 编译打包和 Docker 镜像
+
+- 安装文件打包:
+  - 安装文件打包:: `$ make pkg`
+  - 支持 EdgeX 的安装文件打包: `$ make pkg_with_edgex`
+- Docker 镜像:`$ make docker`
+  > 请注意,Docker 镜像默认支持 EdgeX
+
+### 交叉编译二进制文件
+
+Go 语言支持交叉编译多种目标平台的二进制文件。eKuiper 项目也支持标准的 Go 语言交叉编译。由于 eKuiper 依赖
+sqlite,因此 `CGO_ENABLE` 必须设置为1。在交叉编译时,必须安装核指定目标系统的 gcc 工具链。
+
+- 安装目标系统 gcc 工具链。
+- 修改 Makefile 添加 `GOOS`, `GOARCH` 和 `CC`  编译参数,并编译。
+
+例如,在 AMD64 架构的 ubuntu/debian 系统中,可使用下列步骤编译针对 ARM64 架构的 linux 系统的二进制包。
+
+1. 安装 ARM64 的 gcc 工具链。
+
+      ```shell
+      apt-get install gcc-aarch64-linux-gnu
+      ```
+
+2. 更新 Makefile 里的编译相关参数如下:
+
+      ```shell
+      GO111MODULE=on CGO_ENABLED=1 GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -trimpath -ldflags="-s -w -X main.Version=$(VERSION) -X main.LoadFileType=relative" -o kuiperd cmd/kuiperd/main.go
+      ```
+
+3. 运行 `make` 。
+
+### 按需编译功能
+
+eKuiper 允许在编译中对二进制文件进行定制,以获得定制的功能集。除了核心运行时和 REST API
+,其他功能都可通过 [go build constraints](https://pkg.go.dev/go/build#hdr-Build_Constraints)
+在编译时打开或者关闭。用户可编译自定义的,仅包含所需功能的二进制包从而减少包的大小,以便能够部署在资源敏感的环境中。
+
+| 功能                                                                      | Build Tag  | 描述                                                           |
+|-------------------------------------------------------------------------|------------|--------------------------------------------------------------|
+| 核心                                                                      | core       | eKuiper 的核心运行时。 包括流/表/规则的处理器和 REST API ,配置管理,SQL 解析器,规则运行时等。 |
+| [CLI](./api/cli/overview.md)                                            | rpc        | CLI 服务端                                                      |
+| [EdgeX Foundry 整合](./edgex/edgex_rule_engine_tutorial.md)               | edgex      | 内置的 edgeX source, sink 和共享连接支持                               |
+| [原生插件](./extension/native/overview.md)                                  | plugin     | 原生插件运行时,REST API和CLI API等                                    |
+| [Portable 插件](./extension/portable/overview.md)                         | plugin     | Portable 插件运行时,REST API和CLI API等                             |
+| [外部服务](./extension/external/external_func.md)                           | service    | 外部服务运行时,REST API和CLI API等                                    |
+| [UI 元数据API](./operation/manager-ui/overview.md)                         | ui         | 元数据的 REST API,通常由 UI 端消费                                     |
+| [Prometheus 指标](./configuration/global_configurations.md#prometheus-配置) | prometheus | 支持发送指标到 prometheus 中                                         |
+| [扩展模板函数](./guide/sinks/data_template.md#模版中支持的函数)                       | template   | 支持除 go 语言默认的模板函数之外的扩展函数,主要来自 sprig                           |
+| [有模式编解码](./guide/serialization/serialization.md)                        | schema     | 支持模式注册及有模式的编解码格式,例如 protobuf                                 |
+
+Makefile 里已经提供了三种功能集合:标准,edgeX和核心。标准功能集合包含除了 EdgeX 之外的所有功能。edgeX
+功能集合包含了所有的功能;而核心功能集合近包含最小的核心功能。可以通过以下命令,分别编译这三种功能集合:
+
+```shell
+# 标准
+make
+# EdgeX
+make build_with_edgex
+# 核心
+make build_core
+```
+
+功能选择通常应用在资源受限的目标环境中。而该环境一般不太适合运行 docker 容易。因此,我们仅提供包含标准及 edgeX 功能集合的
+docker 镜像。
+
+若需要自定义功能选择,用户需要自行编译源码。其语法为:
+
+```shell
+go build --tags "<FEATURE>"
+```
+
+例如,编译带有原生插件功能的核心包,编译命令为:
+
+```shell
+go build --tags "core plugin"
+```
+
+建议用户以默认 Makefile 为模板,在里面更新编译命令,使其选择所需的 tags ,然后采用 make 命令进行编译。
 
 ## 目录结构
 

+ 0 - 19
docs/zh_CN/operation/compile/compile.md

@@ -1,19 +0,0 @@
-## 从源码编译
-
-+ Go version >= 1.13
-
-+ 编译二进制:
-
-  + 编译二进制文件: `$ make`
-
-  + 编译支持 EdgeX 的二进制文件: `$ make build_with_edgex`
-
-+ 安装文件打包:
-
-  + 安装文件打包:: `$ make pkg`
-
-  + 支持 EdgeX 的安装文件打包: `$ make pkg_with_edgex`
-
-+ Docker 镜像:`$ make docker`
-
-  > Docker 镜像默认支持 EdgeX

+ 0 - 22
docs/zh_CN/operation/compile/cross-compile.md

@@ -1,22 +0,0 @@
-## 交叉编译二进制文件
-
-Go 语言支持交叉编译多种目标平台的二进制文件。eKuiper 项目也支持标准的 Go 语言交叉编译。由于 eKuiper 依赖 sqlite,因此 `CGO_ENABLE` 必须设置为1。在交叉编译时,必须安装核指定目标系统的 gcc 工具链。
-
-- 安装目标系统 gcc 工具链。
-- 修改 Makefile 添加 `GOOS`, `GOARCH` 和 `CC`  编译参数,并编译。
-
-例如,在 AMD64 架构的 ubuntu/debian 系统中,可使用下列步骤编译针对 ARM64 架构的 linux 系统的二进制包。
-
-1. 安装 ARM64 的 gcc 工具链。
-
-      ```shell
-      apt-get install gcc-aarch64-linux-gnu
-      ```
-
-2. 更新 Makefile 里的编译相关参数如下:
-
-      ```shell
-      GO111MODULE=on CGO_ENABLED=1 GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -trimpath -ldflags="-s -w -X main.Version=$(VERSION) -X main.LoadFileType=relative" -o kuiperd cmd/kuiperd/main.go
-      ```
-
-3. 运行 `make` 。

+ 0 - 47
docs/zh_CN/operation/compile/features.md

@@ -1,47 +0,0 @@
-# 功能
-
-除了核心运行时和 REST API ,其他功能都可通过 [go build constraints](https://pkg.go.dev/go/build#hdr-Build_Constraints) 在编译时打开或者关闭。用户可编译自定义的,仅包含所需功能的二进制包从而减少包的大小,以便能够部署在资源敏感的环境中。
-
-## 功能列表
-
-| 功能                                                                          | Build Tag  | 描述                                                           |
-|-----------------------------------------------------------------------------|------------|--------------------------------------------------------------|
-| 核心                                                                          | core       | eKuiper 的核心运行时。 包括流/表/规则的处理器和 REST API ,配置管理,SQL 解析器,规则运行时等。 |
-| [CLI](../../api/cli/overview.md)                                            | rpc        | CLI 服务端                                                      |
-| [EdgeX Foundry 整合](../../edgex/edgex_rule_engine_tutorial.md)               | edgex      | 内置的 edgeX source, sink 和共享连接支持                               |
-| [原生插件](../../extension/native/overview.md)                                  | plugin     | 原生插件运行时,REST API和CLI API等                                    |
-| [Portable 插件](../../extension/portable/overview.md)                         | plugin     | Portable 插件运行时,REST API和CLI API等                             |
-| [外部服务](../../extension/external/external_func.md)                           | service    | 外部服务运行时,REST API和CLI API等                                    |
-| [UI 元数据API](../../operation/manager-ui/overview.md)                         | ui         | 元数据的 REST API,通常由 UI 端消费                                     |
-| [Prometheus 指标](../../configuration/global_configurations.md#prometheus-配置) | prometheus | 支持发送指标到 prometheus 中                                         |
-| [扩展模板函数](../../guide/sinks/data_template.md#模版中支持的函数)                       | template   | 支持除 go 语言默认的模板函数之外的扩展函数,主要来自 sprig                           |
-| [有模式编解码](../../guide/serialization/serialization.md)                        | schema     | 支持模式注册及有模式的编解码格式,例如 protobuf                                 |
-
-## 使用
-
-Makefile 里已经提供了三种功能集合:标准,edgeX和核心。标准功能集合包含除了 EdgeX 之外的所有功能。edgeX 功能集合包含了所有的功能;而核心功能集合近包含最小的核心功能。可以通过以下命令,分别编译这三种功能集合:
-
-```shell
-# 标准
-make
-# EdgeX
-make build_with_edgex
-# 核心
-make build_core
-```
-
-功能选择通常应用在资源受限的目标环境中。而该环境一般不太适合运行 docker 容易。因此,我们仅提供包含标准及 edgeX 功能集合的 docker 镜像。
-
-若需要自定义功能选择,用户需要自行编译源码。其语法为:
-
-```shell
-go build --tags "<FEATURE>"
-```
-
-例如,编译带有原生插件功能的核心包,编译命令为:
-
-```shell
-go build --tags "core plugin"
-```
-
-建议用户以默认 Makefile 为模板,在里面更新编译命令,使其选择所需的 tags ,然后采用 make 命令进行编译。