Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add makefile && modify develop and deploy docs #729

Merged
merged 35 commits into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
17046f3
docs: add makefile && modify develop and deploy docs
gxthrj Nov 8, 2020
5a03170
docs: Make the makefile clearer
gxthrj Nov 9, 2020
53d86b0
docs: modify frontend to web
gxthrj Nov 9, 2020
3e33977
doc: two blankline between commands
gxthrj Nov 9, 2020
453246d
doc: remove blanklien EOF
gxthrj Nov 9, 2020
ec1bd03
docs: remove make run/stop in makefile
gxthrj Nov 9, 2020
e42651f
docs: make readme readable
gxthrj Nov 9, 2020
ce81ec9
docs: declear in readme
gxthrj Nov 9, 2020
2d9189c
docs: make readme readable
gxthrj Nov 9, 2020
61dc416
docs: remove dependencies in readme
gxthrj Nov 9, 2020
c62aecd
docs: check english desc
gxthrj Nov 9, 2020
d243dd6
docs: style adjust
gxthrj Nov 9, 2020
773168a
docs: sync makefile desc
gxthrj Nov 9, 2020
6fde9e4
docs: remove blank
gxthrj Nov 9, 2020
59c20ac
docs: style adjust
gxthrj Nov 9, 2020
f1f94f8
docs: remove ENV=local in deploy
gxthrj Nov 9, 2020
4ea4dfe
fix: modify lint ci
gxthrj Nov 9, 2020
85c9ace
docs: unify go-lint
gxthrj Nov 10, 2020
e02874e
docs: check all text
gxthrj Nov 10, 2020
3e2e585
docs: makefile Aligned
gxthrj Nov 10, 2020
a20ec8e
docs: update style
gxthrj Nov 10, 2020
a61879e
docs: add markdown code style
gxthrj Nov 10, 2020
c7040f3
docs: fix syntax
gxthrj Nov 10, 2020
a8b55f1
docs: remove Self-referencing
gxthrj Nov 10, 2020
28b1316
docs: user guide
gxthrj Nov 10, 2020
38decac
docs: use header
gxthrj Nov 10, 2020
0312f50
docs: style fix
gxthrj Nov 10, 2020
59e60cc
docs: add desc
gxthrj Nov 10, 2020
dc93d15
docs: modify 'pack' to 'package'
gxthrj Nov 10, 2020
e1c3e5c
docs: unify manager-api
gxthrj Nov 10, 2020
3660e99
docs: mv Install to Installation
gxthrj Nov 10, 2020
f894cd9
docs: node to Node.js
gxthrj Nov 10, 2020
629efc7
docs: source codes to Source Codes
gxthrj Nov 10, 2020
68e8424
docs: Source Codes
gxthrj Nov 10, 2020
50b9c27
fix: mkdir -p ./output/logs in makefile build
gxthrj Nov 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 61 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,68 @@

SHELL := /bin/bash -o pipefail
UNAME ?= $(shell uname)
YARN_EXEC ?= $(shell which yarn)
GO_EXEC ?= $(shell which go)

### help: Show Makefile rules
export GO111MODULE=on

### help: Show Makefile rules
.PHONY: help
help:
@echo Makefile rules:
@echo
@grep -E '^### [-A-Za-z0-9_]+:' Makefile | sed 's/###/ /'

export GO111MODULE=on

### license-check: Check apisix-dashboard source codes for Apache License
.PHONY: license-check
license-check:
ifeq ("$(wildcard .actions/openwhisk-utilities/scancode/scanCode.py)", "")
git clone https://github.com/apache/openwhisk-utilities.git .actions/openwhisk-utilities
cp .actions/ASF* .actions/openwhisk-utilities/scancode/
### build: build dashboard, it contains web and manager-api
juzhiyuan marked this conversation as resolved.
Show resolved Hide resolved
.PHONY: build
build: web-default api-default
api/build.sh; \
cd /web; \
gxthrj marked this conversation as resolved.
Show resolved Hide resolved
yarn install; \
yarn build


### run: run dashboard, it contains web and manager-api
.PHONY: run
run:
api/run.sh &
gxthrj marked this conversation as resolved.
Show resolved Hide resolved


### stop: stop dashboard
stop:
kill $(ps aux | grep 'manager-api' | awk '{print $2}')


.PHONY: web-default
web-default:
ifeq ("$(wildcard $(YARN_EXEC))", "")
@echo "ERROR: Need to install yarn first"
exit 1
endif


.PHONY: api-default
api-default:
ifeq ("$(wildcard $(GO_EXEC))", "")
@echo "ERROR: Need to install golang 1.13+ first"
exit 1
endif
.actions/openwhisk-utilities/scancode/scanCode.py --config .actions/ASF-Release.cfg ./

### golang-lint: Lint Go source code

### api-test: Run the tests of manager-api
.PHONY: api-test
api-test: api-default
cd api/ && APISIX_API_WORKDIR=$$PWD go test -v -race -cover -coverprofile=coverage.txt -covermode=atomic ./...


### api-run: Run the manager-api
.PHONY: api-run
api-run: api-default
cd api/ && go run .


### golang-lint: Lint Go source code
gxthrj marked this conversation as resolved.
Show resolved Hide resolved
.PHONY: golang-lint
golang-lint: ## Run the golangci-lint application (install if not found)
@#Brew - MacOS
Expand All @@ -46,8 +88,13 @@ golang-lint: ## Run the golangci-lint application (install if not found)
@echo "running golangci-lint..."
@cd api && golangci-lint run --tests=false ./...

### api-test: Run the tests of manager-api
.PHONY: api-test
api-test:
cd api/ && APISIX_API_WORKDIR=$$PWD go test -v -race -cover -coverprofile=coverage.txt -covermode=atomic ./...

### license-check: Check apisix-dashboard source codes for Apache License
.PHONY: license-check
license-check:
ifeq ("$(wildcard .actions/openwhisk-utilities/scancode/scanCode.py)", "")
git clone https://github.com/apache/openwhisk-utilities.git .actions/openwhisk-utilities
gxthrj marked this conversation as resolved.
Show resolved Hide resolved
cp .actions/ASF* .actions/openwhisk-utilities/scancode/
endif
.actions/openwhisk-utilities/scancode/scanCode.py --config .actions/ASF-Release.cfg ./

59 changes: 17 additions & 42 deletions docs/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ $ git clone -b v2.0 https://github.com/apache/apisix-dashboard.git
$ cd apisix-dashboard
```

## Build the manager-api
## build
gxthrj marked this conversation as resolved.
Show resolved Hide resolved

### checklist for manager-api
gxthrj marked this conversation as resolved.
Show resolved Hide resolved

The `manager-api` is used to provide APIs for Dashboard, just like a bridge between the Apache APISIX and the Dashboard. Here are the steps to build it manually:

Expand All @@ -37,51 +39,32 @@ NOTE: You also need to install `Lua` 5.1+ if you want to use the Plugin Orchestr

2. Check environment variables

- enable Go MODULE

```sh
$ go env -w GO111MODULE=on
```

- For most users in China, we could use [Goproxy](https://goproxy.cn/) to speed up downloading modules.

```sh
$ go env -w GOPROXY=https://goproxy.cn,direct
```

3. Build

```sh
$ api/build.sh
```

The bundled files are located in the root directory `/output`.

## Build the web
### checklist for web
gxthrj marked this conversation as resolved.
Show resolved Hide resolved

This project is initialized with [Ant Design Pro](https://pro.ant.design). The following are some quick guides for how to use.

1. Make sure you have `Node.js(version 10.0.0+)` installed on your machine.
2. Install [yarn](https://yarnpkg.com/).
3. Install dependencies:

```sh
$ cd /web

$ yarn install
```

4. Build
### building
gxthrj marked this conversation as resolved.
Show resolved Hide resolved

```sh
$ yarn build
$ make build
```

The bundled files are located in the root directory `/output/html`.
The bundled files are located in the root directory `/output`.

## Run

1. According to your deploy environment, check the related configurations in `api/conf/conf.yaml`, modify those variables if needed.
1. According to your deploy environment, check the related configurations in `output/conf/conf.yaml`, modify those variables if needed.

Example:

Expand All @@ -104,10 +87,10 @@ authentication:
password: user
```

2. Run manager-api
2. Run

```sh
$ api/run.sh &
$ make run
```

3. Visit `http://127.0.0.1:8080` in your browser, `8080` is the default listen port of manager-api.
Expand All @@ -120,25 +103,17 @@ $ api/run.sh &

3. `conf.etcd.endpoints` is used to set ETCD's instances address, it supports multiple instances mode.

```json
{
"etcd": {
"endpoints": "127.0.0.1:2379,127.0.0.1:3379"
}
}
```yaml
conf:
etcd:
endpoints:
- 127.0.0.1:2379
- 127.0.0.1:3379
```

## NOTE

1. When the manager-api is running in background, before we want to rebuild & re-deploy it, we should find the process id then kill it.

```sh
$ ps aux | grep manager-api

$ kill $process_id
```

2. After compiling the Manager API, if you move the compiled product to another location, an error will be reported at startup, this is because the configuration file's **absolute path** is fixed in the product and needs to be resolved by running an environment variable to set the location of the configuration file before running.
1. After compiling the Manager API, if you move the compiled product to another location, an error will be reported at startup, this is because the configuration file's **absolute path** is fixed in the product and needs to be resolved by running an environment variable to set the location of the configuration file before running.
juzhiyuan marked this conversation as resolved.
Show resolved Hide resolved

```sh
$ export APISIX_CONF_PATH=/home/demo_user/workspace/apisix-dashboard/api/conf
Expand Down
66 changes: 23 additions & 43 deletions docs/deploy.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ $ git clone -b v2.0 https://github.com/apache/apisix-dashboard.git
$ cd apisix-dashboard
```

## 构建 manager-api
## 构建

### manager-api 检查项

`manager-api` 用于为控制台提供接口,就像 Apache APISIX 和控制台之间的桥梁。下面是手动构建步骤:

Expand All @@ -37,53 +39,33 @@ $ cd apisix-dashboard

2. 检查环境变量

- 开启 Go MODULE

```sh
$ go env -w GO111MODULE=on
```

- 对于大多数中国用户,我们可以使用 [Goproxy](https://goproxy.cn/) 加快模块下载速度。

```sh
$ go env -w GOPROXY=https://goproxy.cn,direct
```

3. 构建

```sh
$ api/build.sh
```

构建完成后的文件在根目录 `/output` 下。

## 构建前端
### 前端 检查项

该项目使用 [Ant Design Pro](https://pro.ant.design) 初始化。以下是一些使用方法的快速指南。

1. 确保你的设备已经安装了 `Node.js(版本 10.0.0+)`。

2. 安装 [yarn](https://yarnpkg.com/)。

3. 安装依赖:

```sh
$ cd /web
### 开始构建

$ yarn install
```

4. 构建

```sh
$ yarn build
$ make build
```

构建完成后的文件在根目录 `/output/html` 目录下
构建完成后的文件在根目录 `/output` 下
gxthrj marked this conversation as resolved.
Show resolved Hide resolved

## 启动

1. 根据您的部署环境,检查并修改 `api/conf/conf.yaml` 中的配置。
1. 根据您的部署环境,检查并修改 `output/conf/conf.yaml` 中的配置。
gxthrj marked this conversation as resolved.
Show resolved Hide resolved

例如:

Expand All @@ -106,14 +88,20 @@ authentication:
password: user
```

2. 启动 manager-api
2. 启动

```sh
$ api/run.sh &
$ make run
```

3. 在浏览器中访问 `http://127.0.0.1:8080`,`8080` 是 manager-api 的默认监听端口。

3. 关闭

```sh
$ make stop
```

## 配置参数

1. `conf.dag-lib-path` 参数需要使用绝对路径,可通过 `pwd` 指令获取。仅在使用插件编排功能时需要指定。
Expand All @@ -122,25 +110,17 @@ $ api/run.sh &

3. `conf.etcd.endpoints` 用于配置 ETCD 实例,支持集群模式。

```json
{
"etcd": {
"endpoints": "127.0.0.1:2379,127.0.0.1:3379"
}
}
```yaml
conf:
etcd:
endpoints:
- 127.0.0.1:2379
- 127.0.0.1:3379
```

## 注意

1. 当 manager-api 在后台模式下运行,在重新编译、重新部署它之前,我们需要查找其进程并结束掉它:

```sh
$ ps aux | grep manager-api

$ kill $process_id
```

2. 在编译 Manager API 后,如移动编译后产物到其它位置,启动时将会报错,这是由于配置文件**绝对路径**被固定在了产物中,需要在运行前,通过执行环境变量设置配置文件位置来解决。
1. 在编译 Manager API 后,如移动编译后产物到其它位置,启动时将会报错,这是由于配置文件**绝对路径**被固定在了产物中,需要在运行前,通过执行环境变量设置配置文件位置来解决。

```sh
$ export APISIX_CONF_PATH=/home/demo_user/workspace/apisix-dashboard/api/conf
Expand Down
39 changes: 38 additions & 1 deletion docs/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@

# Dashboard Devlopment

## Preconditions

```
$ git clone -b v2.0 https://github.com/apache/apisix-dashboard.git
$ cd apisix-dashboard
```

## Web

1. Make sure you have `Node.js(version version 10.0.0+)` installed on your machine.
Expand All @@ -30,7 +37,8 @@ $ yarn install
```

4. If we want to modify the API, please refer to the `config/proxy.ts` file.
5. Start the development mode

5. Start (the development mode)

```sh
$ yarn start
Expand All @@ -42,6 +50,35 @@ Please refer to [E2E Documentation](../web/src/e2e/README.md).

## manager-api

### start

1. modify `config.yaml` in `api/conf/conf.yaml`

```
conf:
listen:
host: 127.0.0.1
port: 8080
dag_lib_path: ''
etcd:
endpoints:
- 127.0.0.1:2379
authentication:
secret: secret
expireTime: 3600
users:
- username: admin
password: admin
- username: user
password: user
```

2. start (the development mode)

```
$ make api-run
```

### Sync jsonschema

To sync jsonschema from Apache APISIX, `Lua` 5.1+ and `zip` need to be preinstalled, then execute this command: `api/build-tools/schema-sync.sh $version`.
Expand Down
Loading