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 8 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
65 changes: 51 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,58 @@

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 && yarn install && yarn build


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

### golang-lint: Lint Go source code

.PHONY: api-default
api-default:
ifeq ("$(wildcard $(GO_EXEC))", "")
@echo "ERROR: Need to install golang 1.13+ first"
exit 1
endif


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

### api-stop: stop manager-api
gxthrj marked this conversation as resolved.
Show resolved Hide resolved
api-stop:
kill $(ps aux | grep 'manager-api' | awk '{print $2}')


### 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 +78,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 ./

20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,27 @@ English | [简体中文](./README.zh-CN.md)

Dashboard for [Apache APISIX](https://github.com/apache/apisix)

The goal of the Apache APISIX Dashboard project is to enable everyone to quickly experience and learn Apache APISIX, and it cannot be used directly in a production environment. Therefore, its function point coverage is always a subset of Apache APISIX, and may lag behind the rapid iteration of Apache APISIX. If you need to use the Dashboard project in a production system, you need to enhance user permissions, communication security, high availability and advanced features.
gxthrj marked this conversation as resolved.
Show resolved Hide resolved
gxthrj marked this conversation as resolved.
Show resolved Hide resolved

## User Guide

Please refer to [User Guide](./docs/USER_GUIDE.md)

## Deployment
## For Developer

If you are a developer, please refer to start manager-api and Web separately

- [dependencies](#dependencies)
gxthrj marked this conversation as resolved.
Show resolved Hide resolved
- [develop Dashboard](./docs/develop.md)

## deployment
gxthrj marked this conversation as resolved.
Show resolved Hide resolved

- [Deploy Manually](./docs/deploy.md)
- [Deploy with Docker](./docs/deploy-with-docker.md)
- [one click with Docker](./docs/deploy-with-docker.md)
gxthrj marked this conversation as resolved.
Show resolved Hide resolved
- [build from source code](./docs/deploy.md)

## Development
## dependencies
gxthrj marked this conversation as resolved.
Show resolved Hide resolved

- [Apache APISIX](https://github.com/apache/apisix)
- [Dashboard](./docs/develop.md)
apisix-dashboard provides a management interface for [Apache APISIX](https://github.com/apache/apisix), you need to [install APISIX first](https://github.com/apache/apisix#configure-and-installation).
juzhiyuan marked this conversation as resolved.
Show resolved Hide resolved

## Milestones

Expand Down
23 changes: 15 additions & 8 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,30 @@

# [Apache APISIX](https://github.com/apache/apisix) 控制台
juzhiyuan marked this conversation as resolved.
Show resolved Hide resolved

Apache APISIX Dashboard 项目的目标是为了让大家快速上手体验和学习 Apache APISIX,并不能直接用于生产环境。所以它的功能点覆盖永远都是 Apache APISIX 的子集,也可能会滞后于 Apache APISIX 的快速迭代。如果你需要把 Dashboard 项目用于生产系统,需要对用户权限、通讯安全、高可用、高级功能等方面做增强。

## 用户指南

请参考 [用户指南](./docs/USER_GUIDE.zh-CN.md)

## 部署
## 开发者

如果你是开发者,请参考这里分别启动 manager-api 和 web
gxthrj marked this conversation as resolved.
Show resolved Hide resolved

- [依赖检查](#依赖检查)
gxthrj marked this conversation as resolved.
Show resolved Hide resolved
- [开发 Dashboard](./docs/develop.zh-CN.md)

## 部署运行
gxthrj marked this conversation as resolved.
Show resolved Hide resolved

当前支持如下方式部署:
我们有多种部署方式
gxthrj marked this conversation as resolved.
Show resolved Hide resolved

- [手动部署](./docs/deploy.zh-CN.md)
- [使用 Docker 部署](./docs/deploy-with-docker.zh-CN.md)
- [使用 Docker 一键部署](./docs/deploy-with-docker.zh-CN.md)

## 开发
- [从源文件打包部署](./docs/deploy.zh-CN.md)
gxthrj marked this conversation as resolved.
Show resolved Hide resolved

开发分为 Apache APISIX 开发、Dashboard 开发
## 依赖检查

- [Apache APISIX](https://github.com/apache/apisix)
- [Dashboard](./docs/develop.zh-CN.md)
apisix-dashboard 为 [Apache APISIX](https://github.com/apache/apisix) 提供管理界面,需要先 [安装 APISIX](https://github.com/apache/apisix#configure-and-installation).
gxthrj marked this conversation as resolved.
Show resolved Hide resolved

## 里程碑

Expand Down
74 changes: 32 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

### manager-api dependencies
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
### web dependencies
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`.
juzhiyuan marked this conversation as resolved.
Show resolved Hide resolved

## 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,14 +87,29 @@ authentication:
password: user
```

2. Run manager-api
2. Run

```sh
$ api/run.sh &
$ cd ./output
$ export ENV=local && exec ./manager-api
gxthrj marked this conversation as resolved.
Show resolved Hide resolved
```

3. Visit `http://127.0.0.1:8080` in your browser, `8080` is the default listen port of manager-api.

3. stop
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

What's stop?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


```sh
$ kill $(ps aux | grep 'manager-api' | awk '{print $2}')
```

## tar
gxthrj marked this conversation as resolved.
Show resolved Hide resolved

You can package the output directory as a whole, copy it to other places to decompress and run. The output directory contains all the files needed to run the dashboard (configuration files, executable files, web static resources)
gxthrj marked this conversation as resolved.
Show resolved Hide resolved

```sh
$ tar –cvf dashboard.tar ./output/*
```

## Configuration

1. `conf.dag-lib-path` MUST use absolute path, we could use `pwd` command. Only used when enable Plugin Orchestration.
Expand All @@ -120,25 +118,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
Loading