-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: added Docker * feat: added License header * feat: added line in docs * Update test-docker.yml * feat(doc): update docs * feat: added extra line * feat: added Go Proxy in Dockerfile * feat: update Dockerfile * chore: update docs * fix: copy correct files * feat: improve Dockerfile * Revert "feat: improve Dockerfile" This reverts commit c68a4c4. * fix run fail * feat: update docs * fix: compatible with Golang conf * Squashed commit of the following: commit 94450bf Author: litesun <7sunmiao@gmail.com> Date: Tue Nov 3 10:19:04 2020 +0800 fix: promethus incorrect value when update route (#666) commit de8bdbf Author: nic-chen <33000667+nic-chen@users.noreply.github.com> Date: Tue Nov 3 07:50:29 2020 +0800 CI: collect golang unit test code coverage (#654) commit 722c0fd Author: litesun <7sunmiao@gmail.com> Date: Tue Nov 3 00:03:06 2020 +0800 feat: added e2e test for Login page (#619) * feat: added Front-end e2e test YAML file * feat: added login e2e test * feat: update Login.e2e.js * Update Login.e2e.js * feat: added e2e readme * feat: added licence * feat: added start-server-and-test package * feat: update login test case * Update frontend-e2e-test.yml * feat: added logout test case * Update frontend-e2e-test.yml * feat: added login failed with empty input * feat: update CI * feat: update text * feat: added public.js * feat: change logout timeout * feat: Added e2e test documentation link to development.md * Update develop.md * Update develop.zh-CN.md * Update README.md Co-authored-by: 琚致远 <juzhiyuan@apache.org> commit 915ce83 Author: nic-chen <33000667+nic-chen@users.noreply.github.com> Date: Mon Nov 2 21:13:34 2020 +0800 test: add e2e test for field hosts in `route` api (#612) * feat: ETCD cluster and APISIX cluster for CI * feat: add test cases * feat: add upstream service in docker compose * fix: comment * test: add test cases * fix: code format * test: add ci * fix ci * fix ci * fix ci * fix: remove consumer test * test: sleep for sync * test: e2e as an independent subproject * fix CI error * test: run docker * fix: remove json schema generate script in docker build * fix: check host and hosts config together * fix ci * test: add test cases for `host` in route * remove useless code * fix: using relative path to read conf (#617) * fix: using relative path * fix path * fix path * fix conf path * fix ci error * fix etcd ip * fix: code format * run backend e2e test ci on v2 branch * fix: code format * fix: code format * fix: CI error * test: remove deploy CI again * remove useless codes * fix: go fmt * test: don't use `go fmt` * fix: code format * fix: var name * fix lint * fix CI error * debug * fix: docker container name * fix CI error * fix CI error * test: add more test cases * fix CI error * chore: remove useless code * fix: go fmt * fix: refactor test code * fix: check body * fix small issue * fix: update docker compose * fix CI * test * test * test: build image first * test: revert subnet ip in docker compose * fix by review * fix: docker compose * test: add test cases * fix: remove useless code * fix: code format * test: code format commit 94d0245 Author: 琚致远 <juzhiyuan@apache.org> Date: Mon Nov 2 13:17:42 2020 +0800 chore: improve issue template and vscode (#660) * Revert "Squashed commit of the following:" This reverts commit 93d38ee. * feat: remove output from ignore files Co-authored-by: nic-chen <johz@163.com>
- Loading branch information
Showing
8 changed files
with
245 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Deploy with Docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- v2.0 | ||
pull_request: | ||
branches: | ||
- master | ||
- v2.0 | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run with Docker | ||
run: | | ||
docker build -t apisix-dashboard:dev . | ||
docker run -d -p 8081:8080 apisix-dashboard:dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
FROM alpine:latest as pre-build | ||
|
||
ARG APISIX_DASHBOARD_VERSION=v2.0 | ||
|
||
RUN set -x \ | ||
&& wget https://github.com/apache/apisix-dashboard/archive/${APISIX_DASHBOARD_VERSION}.tar.gz -O /tmp/apisix-dashboard.tar.gz \ | ||
&& mkdir /usr/local/apisix-dashboard \ | ||
&& tar -xvf /tmp/apisix-dashboard.tar.gz -C /usr/local/apisix-dashboard --strip 1 | ||
|
||
FROM golang:1.14 as api-builder | ||
|
||
ARG ENABLE_PROXY=false | ||
|
||
WORKDIR /usr/local/apisix-dashboard | ||
|
||
COPY --from=pre-build /usr/local/apisix-dashboard . | ||
|
||
WORKDIR /usr/local/apisix-dashboard/api | ||
|
||
RUN mkdir -p ../output/conf \ | ||
&& cp ./conf/*.json ../output/conf | ||
|
||
RUN wget https://github.com/api7/dag-to-lua/archive/v1.1.tar.gz -O /tmp/v1.1.tar.gz \ | ||
&& mkdir /tmp/dag-to-lua \ | ||
&& tar -xvf /tmp/v1.1.tar.gz -C /tmp/dag-to-lua --strip 1 \ | ||
&& mkdir -p ../output/dag-to-lua \ | ||
&& mv /tmp/dag-to-lua/lib/* ../output/dag-to-lua/ | ||
|
||
RUN if [ "$ENABLE_PROXY" = "true" ] ; then go env -w GOPROXY=https://goproxy.io,direct ; fi | ||
|
||
RUN go env -w GO111MODULE=on \ | ||
&& CGO_ENABLED=0 go build -o ../output/manager-api . | ||
|
||
FROM node:14-alpine as fe-builder | ||
|
||
ARG ENABLE_PROXY=false | ||
|
||
WORKDIR /usr/local/apisix-dashboard | ||
|
||
COPY --from=pre-build /usr/local/apisix-dashboard . | ||
|
||
WORKDIR /usr/local/apisix-dashboard/frontend | ||
|
||
RUN if [ "$ENABLE_PROXY" = "true" ] ; then yarn config set registry https://registry.npm.taobao.org/ ; fi | ||
|
||
RUN yarn install | ||
|
||
RUN yarn build | ||
|
||
FROM alpine:latest as prod | ||
|
||
ARG ENABLE_PROXY=false | ||
|
||
RUN if [ "$ENABLE_PROXY" = "true" ] ; then sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories ; fi | ||
|
||
RUN apk add lua5.1 | ||
|
||
WORKDIR /usr/local/apisix-dashboard | ||
|
||
COPY --from=api-builder /usr/local/apisix-dashboard/output/ ./ | ||
|
||
# NOTE: Just to compatible with /api/conf/conf.go WebDir | ||
RUN mkdir -p ./output | ||
COPY --from=fe-builder /usr/local/apisix-dashboard/output/ ./output | ||
|
||
ENV APISIX_CONF_PATH /usr/local/apisix-dashboard/conf | ||
|
||
EXPOSE 8080 | ||
|
||
CMD [ "/usr/local/apisix-dashboard/manager-api" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<!-- | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
--> | ||
|
||
# Deploy with Docker | ||
|
||
1. Build image | ||
|
||
```sh | ||
# NOTE: $tag should be set manually | ||
$ docker build -t apisix-dashboard:{$tag} . | ||
``` | ||
|
||
2. Prepare the configuration file | ||
|
||
Before starting the container, the configuration file `conf.json` needs to be prepared inside the **host** to override the default configuration file inside the container. Please refer to [example configuration file](./examples/docker-conf-example.json). | ||
|
||
Example configuration notes: | ||
|
||
- `conf.listen.host` To listen for IP within the container, it must be `0.0.0.0`, so the host can access the container's network. | ||
- `conf.listen.port` The default is `8080` for the container listening port. If you need to change it, please change the [Dockerfile](../Dockerfile) too. | ||
- `conf.etcd.endpoints` For the list of ETCD hosts, multiple nodes are connected with **English commas**. Make sure the container has access to these hosts. e.g. Example configuration `conf.etcd.endpoints` for `host.docker.internal` is intended to allow the container to access the network on the host. | ||
|
||
3. Run container | ||
|
||
```sh | ||
$ docker run -d -p 80:8080 -v /path/to/conf.json:/usr/local/apisix-dashboard/conf/conf.json --name apisix-dashboard apisix-dashboard:{$tag} | ||
``` | ||
|
||
## Note | ||
|
||
1. After building the image, if you want to modify the configuration file, you can use the `docker -v /local-path-to-conf-file:/conf/conf.json` parameter to specify the configuration file required for `manager-api` to be loaded dynamically when the container is started. | ||
2. For users in China, we could use the `ENABLE_PROXY` flag to speed up dependencies downloading. | ||
|
||
```sh | ||
$ docker build -t apisix-dashboard:{$tag} . --build-arg ENABLE_PROXY=true | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<!-- | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
--> | ||
|
||
# 使用 Docker 部署 | ||
|
||
1. 构建镜像 | ||
|
||
```sh | ||
# 注意:需手动指定 $tag | ||
$ docker build -t apisix-dashboard:{$tag} . | ||
``` | ||
|
||
2. 准备配置文件 | ||
|
||
在启动容器前,需要在**宿主主机**内准备配置文件 `conf.json`,以便覆盖容器内部默认的配置文件。请参考[示例配置文件](./examples/docker-conf-example.json)。 | ||
|
||
示例配置说明: | ||
|
||
- `conf.listen.host` 为容器内监听 IP,必须为 `0.0.0.0`,这样宿主才能访问容器内网络。 | ||
- `conf.listen.port` 为容器内监听端口,默认为 `8080`。如需修改,请同步修改 [Dockerfile](../Dockerfile)。 | ||
- `conf.etcd.endpoints` 为 ETCD 主机列表,多个节点以**英文逗号**连接,请确保容器可以访问到这些主机,例如:示例配置中 `conf.etcd.endpoints` 为 `host.docker.internal` 旨在允许容器访问宿主主机上的网络。 | ||
|
||
3. 启动容器 | ||
|
||
```sh | ||
$ docker run -d -p 80:8080 -v /path/to/conf.json:/usr/local/apisix-dashboard/conf/conf.json --name apisix-dashboard apisix-dashboard:{$tag} | ||
``` | ||
|
||
## 注意 | ||
|
||
1. 构建镜像后,如需修改配置文件,可通过使用 `docker -v /local-path-to-conf-file:/conf/conf.json` 参数指定 `manager-api` 所需要的配置文件,以便启动容器时动态加载配置文件。 | ||
2. 中国用户可使用 `ENABLE_PROXY` 指令以加速所需依赖的下载。 | ||
|
||
```sh | ||
$ docker build -t apisix-dashboard:{$tag} . --build-arg ENABLE_PROXY=true | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"conf": { | ||
"syslog": { | ||
"host": "127.0.0.1" | ||
}, | ||
"listen": { | ||
"host": "0.0.0.0", | ||
"port": 8080 | ||
}, | ||
"dag-lib-path": "", | ||
"etcd": { | ||
"endpoints": "host.docker.internal:2379" | ||
} | ||
}, | ||
"authentication": { | ||
"session": { | ||
"secret": "secret", | ||
"expireTime": 3600 | ||
}, | ||
"user": [ | ||
{ | ||
"username": "admin", | ||
"password": "admin" | ||
}, | ||
{ | ||
"username": "user", | ||
"password": "user" | ||
} | ||
] | ||
} | ||
} |