From 825fe64cb91b0ffc20a32c8878dcea65b46040c6 Mon Sep 17 00:00:00 2001 From: dongjunduo Date: Tue, 7 Feb 2023 16:38:31 +0800 Subject: [PATCH 1/4] docs(getting-started): rewrite the install section --- docs/en/latest/getting-started.md | 74 ++++++++----------------------- docs/zh/latest/getting-started.md | 74 +++++++------------------------ 2 files changed, 35 insertions(+), 113 deletions(-) diff --git a/docs/en/latest/getting-started.md b/docs/en/latest/getting-started.md index 62a4a4810402..ecf888e0255e 100644 --- a/docs/en/latest/getting-started.md +++ b/docs/en/latest/getting-started.md @@ -119,41 +119,20 @@ We receive a JSON response when we send the request: ## Install Apache APISIX -To get started, we will install Apache APISIX with Docker and enable the [Admin API](./admin-api.md). +The APISIX can be easily installed and started with the quickstart script. -First clone the [apisix-docker](https://github.com/apache/apisix-docker) repository: - -```shell -git clone https://github.com/apache/apisix-docker.git -cd apisix-docker/example -``` - -Now, you can use `docker-compose` to start APISIX. - - - - -```shell -docker-compose -p docker-apisix up -d +```sh +curl -sL https://run.api7.ai/apisix/quickstart | sh ``` - +This command runs APISIX and etcd locally with Docker. APISIX uses etcd to save and synchronize configuration. Both the etcd and the APISIX use [**host**](https://docs.docker.com/network/host/) Docker network mode. That is, the APISIX can be accessed from local. - +If everything is ok, you will see the following message. -```shell -docker-compose -p docker-apisix -f docker-compose-arm64.yml up -d +```text +✔ APISIX is ready! ``` - - - :::note You can check out [Installing Apache APISIX](./installation-guide.md) for different installation methods. @@ -164,39 +143,22 @@ You can check out [Installing Apache APISIX](./installation-guide.md) for differ Make sure that all the required ports (default: 9080, 9180, 9443 and 2379) are available and not used by other system processes. -On Unix-based systems, you can run the command below to terminate a process listening on a specific port: - -```bash -sudo fuser -k 9443/tcp -``` - -If a Docker container is crashing, you can inspect the logs to diagnose the problem: - -```bash -docker logs -f --tail -``` - ::: -Once APISIX is running, you can use `curl` to access the Admin API. You can also check if APISIX is running properly by running this command and checking the response. +Once APISIX is running, you can use curl to access it. Send a simple HTTP request to validate if APISIX is working properly or not. -```bash -curl "http://127.0.0.1:9180/apisix/admin/services/" -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' +```sh +curl "http://127.0.0.1:9080" --head | grep Server ``` -This response indicates that APISIX is running successfully: +If everything is ok, you will get the following response. -```json -{ - "count":0, - "node":{ - "key":"/apisix/services", - "nodes":[], - "dir":true - } -} +```text +Server: APISIX/3.1.0 ``` +You now have APISIX installed and running successfully!​ + ## Create a Route From the previous step, we have a running instance of APISIX in Docker. Now let's create a Route. @@ -206,7 +168,7 @@ APISIX provides a powerful [Admin API](./admin-api.md) and [APISIX Dashboard](ht We will configure the Route so that APISIX can forward the request to the corresponding Upstream service: ```bash -curl "http://127.0.0.1:9180/apisix/admin/routes/1" -H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1" -X PUT -d ' +curl "http://127.0.0.1:9180/apisix/admin/routes/1" -X PUT -d ' { "methods": ["GET"], "host": "example.com", @@ -241,7 +203,7 @@ Instead of configuring the Upstream directly to the Route, you can create an Ups To create an Upstream object: ```bash -curl "http://127.0.0.1:9180/apisix/admin/upstreams/1" -H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1" -X PUT -d ' +curl "http://127.0.0.1:9180/apisix/admin/upstreams/1" -X PUT -d ' { "type": "roundrobin", "nodes": { @@ -255,7 +217,7 @@ This is the same as the Upstream service we configured directly into the Route o To bind this Upstream to the Route, we can use the `upstream_id` as `1`: ```bash -curl "http://127.0.0.1:9180/apisix/admin/routes/1" -H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1" -X PUT -d ' +curl "http://127.0.0.1:9180/apisix/admin/routes/1" -X PUT -d ' { "methods": ["GET"], "host": "example.com", diff --git a/docs/zh/latest/getting-started.md b/docs/zh/latest/getting-started.md index d4c18e7ff9dd..c6a945368777 100644 --- a/docs/zh/latest/getting-started.md +++ b/docs/zh/latest/getting-started.md @@ -111,41 +111,20 @@ curl --location --request GET "http://httpbin.org/get?foo1=bar1&foo2=bar2" ## 安装 APISIX -我们将使用 Docker 安装 APISIX 并启用 [Admin API](./admin-api.md)。 +APISIX 可以借助 quickstart 脚本快速安装并启动。 -首先,通过 `git` 命令克隆 [apisix-docker](https://github.com/apache/apisix-docker) 仓库: - -```bash -git clone https://github.com/apache/apisix-docker.git -cd apisix-docker/example -``` - -现在你可以通过 `docker-compose` 启动 APISIX。 - - - - -```shell -docker-compose -p docker-apisix up -d +```sh +curl -sL https://run.api7.ai/apisix/quickstart | sh ``` - +该命令在本地安装并运行了基于 Docker 的 APISIX 和 etcd 容器,其中 APISIX 采用 etcd 保存和同步配置信息。APISIX 和 etcd 容器使用 [**host**](https://docs.docker.com/network/host/) 的 Docker 网络模式,因此可以从本地直接访问。 - +如果一切顺利,将输出如下信息。 -```shell -docker-compose -p docker-apisix -f docker-compose-arm64.yml up -d +```text +✔ APISIX is ready! ``` - - - :::note 你也可以参考 [APISIX 安装指南](./installation-guide.md)了解不同的安装方法。 @@ -155,42 +134,23 @@ docker-compose -p docker-apisix -f docker-compose-arm64.yml up -d :::info IMPORTANT 请确保其他系统进程没有占用 **9080、9180、9443 和 2379** 端口。 - -在基于 UNIX 的系统中,可以使用以下命令来终止指定监听端口的运行: - -```bash -sudo fuser -k 9443/tcp -``` - -如果 Docker 容器不能正常运行,你可以通过以下命令检查日志进行问题诊断: - -```bash -docker logs -f --tail $ ``` ::: -安装完成后,你可以在运行 Docker 的宿主机上执行 `curl` 命令访问 Admin API,根据返回数据判断 APISIX 是否成功启动。 +你可以通过 curl 来访问正在运行的 APISIX 实例。比如,你可以发送一个简单的 HTTP 请求来验证 APISIX 运行状态是否正常。 -```bash -# 注意:请在运行 Docker 的宿主机上执行 curl 命令。 -curl "http://127.0.0.1:9180/apisix/admin/services/" -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' +```sh +curl "http://127.0.0.1:9080" --head | grep Server ``` -如果返回数据如下所示,则表示 APISIX 成功启动: +I如果一切顺利,将输出如下信息。 -```json -{ - "count":0, - "node":{ - "key":"/apisix/services", - "nodes":[], - "dir":true - } -} +```text +Server: APISIX/3.1.0 ``` -完成上述步骤后,你就已经拥有了一个正在运行的 APISIX 的实例了,现在你可以从之后的小节中学习如何创建路由以及了解 APISIX Dashboard 的操作。 +现在,你已经成功安装并运行了 APISIX ! ## 创建路由 @@ -199,7 +159,7 @@ APISIX 提供了强大的 [Admin API](./admin-api.md) 和 [Dashboard](https://gi 以下示例代码中,我们将为路由配置匹配规则,以便 APISIX 可以将请求转发到对应的上游服务: ```bash -curl "http://127.0.0.1:9180/apisix/admin/routes/1" -H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1" -X PUT -d ' +curl "http://127.0.0.1:9180/apisix/admin/routes/1" -X PUT -d ' { "methods": ["GET"], "host": "example.com", @@ -232,7 +192,7 @@ curl -i -X GET "http://127.0.0.1:9080/anything/foo?arg=10" -H "Host: example.com 你可以通过以下命令创建一个上游,并在路由中使用它,而不是直接将其配置在路由中: ```bash -curl "http://127.0.0.1:9180/apisix/admin/upstreams/1" -H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1" -X PUT -d ' +curl "http://127.0.0.1:9180/apisix/admin/upstreams/1" -X PUT -d ' { "type": "roundrobin", "nodes": { @@ -246,7 +206,7 @@ curl "http://127.0.0.1:9180/apisix/admin/upstreams/1" -H "X-API-KEY: edd1c9f0343 上游服务创建完成后,可以通过以下命令绑定到指定路由: ```bash -curl "http://127.0.0.1:9180/apisix/admin/routes/1" -H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1" -X PUT -d ' +curl "http://127.0.0.1:9180/apisix/admin/routes/1" -X PUT -d ' { "uri": "/get", "host": "httpbin.org", From 8b9228e6588b7dd1ac0d173acf614ce881f2b617 Mon Sep 17 00:00:00 2001 From: dongjunduo Date: Tue, 7 Feb 2023 16:44:19 +0800 Subject: [PATCH 2/4] remove useless quota --- docs/zh/latest/getting-started.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/zh/latest/getting-started.md b/docs/zh/latest/getting-started.md index c6a945368777..04618dc03731 100644 --- a/docs/zh/latest/getting-started.md +++ b/docs/zh/latest/getting-started.md @@ -134,7 +134,6 @@ curl -sL https://run.api7.ai/apisix/quickstart | sh :::info IMPORTANT 请确保其他系统进程没有占用 **9080、9180、9443 和 2379** 端口。 -``` ::: From 7df5e4351dfa5b259dfa2f626b4d599e5685c0d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=90=9A=E8=87=B4=E8=BF=9C=20/=20Zhiyuan=20Ju?= Date: Tue, 7 Feb 2023 22:05:41 +0800 Subject: [PATCH 3/4] Update docs/en/latest/getting-started.md Co-authored-by: Abhishek Choudhary --- docs/en/latest/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/latest/getting-started.md b/docs/en/latest/getting-started.md index ecf888e0255e..97758e4843da 100644 --- a/docs/en/latest/getting-started.md +++ b/docs/en/latest/getting-started.md @@ -119,7 +119,7 @@ We receive a JSON response when we send the request: ## Install Apache APISIX -The APISIX can be easily installed and started with the quickstart script. +APISIX can be easily installed and started with the quickstart script. ```sh curl -sL https://run.api7.ai/apisix/quickstart | sh From 276253547ec13a849b74d11634f8175212d1b1fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=90=9A=E8=87=B4=E8=BF=9C=20/=20Zhiyuan=20Ju?= Date: Tue, 7 Feb 2023 22:05:56 +0800 Subject: [PATCH 4/4] Update docs/en/latest/getting-started.md Co-authored-by: Abhishek Choudhary --- docs/en/latest/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/latest/getting-started.md b/docs/en/latest/getting-started.md index 97758e4843da..31014894d731 100644 --- a/docs/en/latest/getting-started.md +++ b/docs/en/latest/getting-started.md @@ -125,7 +125,7 @@ APISIX can be easily installed and started with the quickstart script. curl -sL https://run.api7.ai/apisix/quickstart | sh ``` -This command runs APISIX and etcd locally with Docker. APISIX uses etcd to save and synchronize configuration. Both the etcd and the APISIX use [**host**](https://docs.docker.com/network/host/) Docker network mode. That is, the APISIX can be accessed from local. +This command runs APISIX and etcd locally with Docker. APISIX uses etcd to save and synchronize configuration. Both etcd and APISIX use the [**host**](https://docs.docker.com/network/host/) Docker network mode. That is, APISIX can be accessed locally. If everything is ok, you will see the following message.