This is an automated email from the ASF dual-hosted git repository.
sylviasu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-docker.git
The following commit(s) were added to refs/heads/master by this push:
new 0d0c786 docs: update README (#380)
0d0c786 is described below
commit 0d0c786f0bf8ea3de8311ef466087a769d2834be
Author: Fei Han <[email protected]>
AuthorDate: Thu Nov 17 17:45:04 2022 +0800
docs: update README (#380)
---
README.md | 106 ++++++++++++++++++++++++++++++++++----------------------------
1 file changed, 59 insertions(+), 47 deletions(-)
diff --git a/README.md b/README.md
index f4f24c3..9422572 100644
--- a/README.md
+++ b/README.md
@@ -17,14 +17,17 @@ In stand-alone mode, APISIX uses `apisix.yaml` as the
configuration center to st
You can start an APISIX container with stand-alone mode by the following
command:
-```
-$ docker run -d --name apache-apisix -p 9080:9080 -e APISIX_STAND_ALONE=true
apache/apisix
+```shell
+docker run -d --name apache-apisix \
+ -p 9080:9080 \
+ -e APISIX_STAND_ALONE=true \
+ apache/apisix
```
Add Route and Plugin configuration to the running APISIX container:
-```
-$ docker exec -i apache-apisix sh -c 'cat > /usr/local/apisix/conf/apisix.yaml
<<_EOC_
+```shell
+docker exec -i apache-apisix sh -c 'cat > /usr/local/apisix/conf/apisix.yaml
<<_EOC_
routes:
-
id: httpbin
@@ -46,6 +49,15 @@ plugin_configs:
_EOC_'
```
+Test example:
+
+```shell
+curl http://127.0.0.1:9080/
+```
+
+```shell
+Hello APISIX
+```
If you want to know more configuration examples, you can refer to
[stand-alone](https://apisix.apache.org/docs/apisix/stand-alone).
### How to run APISIX using etcd as configuration center
@@ -56,22 +68,22 @@ The operation of APISIX also supports the use of etcd as
the configuration cente
1. Start etcd.
-```
-$ docker run -d \
- --name etcd \
- --net host \
- -e ALLOW_NONE_AUTHENTICATION=yes \
- -e ETCD_ADVERTISE_CLIENT_URLS=http://127.0.0.1:2379 \
- bitnami/etcd:latest
+```shell
+docker run -d \
+ --name etcd \
+ --net host \
+ -e ALLOW_NONE_AUTHENTICATION=yes \
+ -e ETCD_ADVERTISE_CLIENT_URLS=http://127.0.0.1:2379 \
+ bitnami/etcd:latest
```
2. Start APISIX.
-```
-$ docker run -d \
- --name apache-apisix \
- --net host \
- apache/apisix
+```shell
+docker run -d \
+ --name apache-apisix \
+ --net host \
+ apache/apisix
```
#### Solution 2
@@ -80,8 +92,8 @@ Before starting the APISIX container, we need to create a
Docker virtual network
1. Create a network and view the subnet address, then start etcd
-```
-$ docker network create apisix-network --driver bridge && \
+```shell
+docker network create apisix-network --driver bridge && \
docker network inspect -v apisix-network && \
docker run -d --name etcd \
--network apisix-network \
@@ -94,57 +106,57 @@ docker run -d --name etcd \
2. View the return result of the previous step, we can see the `subnet`
address. Create a APISIX configuration file in the current directory. You need
to set `allow_admin` to the `subnet` address obtained in step1.
-```
-$ cat << EOF > $(pwd)/config.yaml
-apisix:
- allow_admin:
- - 0.0.0.0/0 # Please set it to the subnet address you obtained.
- # If not set, by default all IP access is allowed.
-etcd:
- host:
- - "http://etcd:2379"
- prefix: "/apisix"
- timeout: 30
+```shell
+cat << EOF > $(pwd)/config.yaml
+deployment:
+ role: traditional
+ role_traditional:
+ config_provider: etcd
+ admin:
+ allow_admin:
+ - 0.0.0.0/0 # Please set it to the subnet address you obtained.
+ # If not set, by default all IP access is allowed.
+ etcd:
+ host:
+ - "http://etcd:2379"
+ prefix: "/apisix"
+ timeout: 30
EOF
```
3. Start APISIX and reference the file created in the previous step.
-```
-$ docker run -d --name apache-apisix \
- --network apisix-network \
- -p 9080:9080 \
- -v $(pwd)/config.yaml:/usr/local/apisix/conf/config.yaml \
- apache/apisix
+```shell
+ docker run -d --name apache-apisix \
+ --network apisix-network \
+ -p 9080:9080 \
+ -p 9180:9180 \
+ -v $(pwd)/config.yaml:/usr/local/apisix/conf/config.yaml \
+ apache/apisix
```
-### Test example
+#### Test example
Check that APISIX is running properly by running the following command on the
host.
```
-$ curl "http://127.0.0.1:9080/apisix/admin/services/" \
+curl "http://127.0.0.1:9180/apisix/admin/services/" \
-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1'
```
The response indicates that apisix is running successfully:
-```
+```json
{
- "count":0,
- "action":"get",
- "node":{
- "key":"/apisix/services",
- "nodes":[],
- "dir":true
- }
+ "total": 0,
+ "list": []
}
```
If you want to modify the default configuration of APISIX, you can use the
following command to enter the APISIX container and modify the configuration
file `./conf/config.yaml`, which will take effect after reloading APISIX. For
details, please refer to `./conf/config-default.yaml`.
```
-$ docker exec -it apache-apisix bash
+docker exec -it apache-apisix bash
```
For more information, you can refer to the [APISIX
Website](https://apisix.apache.org/) and [APISIX
Documentation](https://apisix.apache.org/docs/apisix/getting-started). If you
encounter problems during use, you can ask for help through [slack and the
mailing list](https://apisix.apache.org/docs/general/join/).
@@ -154,7 +166,7 @@ For more information, you can refer to the [APISIX
Website](https://apisix.apach
If you change your custom configuration, you can reload APISIX (without
downtime) by issuing.
```
-$ docker exec -it apache-apisix apisix reload
+docker exec -it apache-apisix apisix reload
```
This will run the `apisix reload` command in your container.