-
Couldn't load subscription status.
- Fork 2.2k
add Apache APISIX doc #2185
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
Open
soulbird
wants to merge
3
commits into
docker-library:master
Choose a base branch
from
soulbird:apisix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
add Apache APISIX doc #2185
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 @@ | ||
| Apache APISIX is a dynamic, real-time, high-performance API Gateway. | ||
Empty file.
This file contains hidden or 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,198 @@ | ||
| ## What is Apache APISIX API Gateway | ||
|
|
||
| Apache APISIX is a dynamic, real-time, high-performance API Gateway. | ||
soulbird marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| APISIX API Gateway provides rich traffic management features such as load balancing, dynamic upstream, canary release, circuit breaking, authentication, observability, and more. | ||
|
|
||
| You can use APISIX API Gateway to handle traditional north-south traffic, as well as east-west traffic between services. | ||
| At present, APISIX has been used in various industries, including NASA, Tencent Cloud, EU Digital Factory, Airbus, Airwallex, iQIYI, etc. | ||
|
|
||
| ## How to run Apache APISIX | ||
|
|
||
| Apache APISIX supports stand-alone mode and also supports the use of etcd database as the configuration center. | ||
|
|
||
| ### How to run APISIX in stand-alone mode | ||
|
|
||
| In stand-alone mode, APISIX uses `apisix.yaml` as the configuration center to store routing, upstream, consumer and other information. After APISIX is started, it will load the `apisix.yaml` file regularly to update the corresponding configuration information. | ||
|
|
||
| The following command creates a configuration file for APISIX, and enables stand-alone mode. | ||
|
|
||
| 1. Create a APISIX configuration file in the current directory and use this file in the next step. | ||
|
|
||
| ``` | ||
| $ cat << EOF > $(pwd)/config.yaml | ||
| apisix: | ||
| enable_admin: false | ||
| config_center: yaml | ||
| EOF | ||
| ``` | ||
|
|
||
| 2. Start APISIX. | ||
|
|
||
| ``` | ||
| $ docker run -d \ | ||
| --name apache-apisix \ | ||
| -p 9080:9080 \ | ||
| -v $(pwd)/config.yaml:/usr/local/apisix/conf/config.yaml \ | ||
| apache/apisix | ||
| ``` | ||
|
|
||
| #### Modify stand-alone mode configuration file | ||
|
|
||
| After completing the above steps, you can refer to the following example to write the Route and Plugin configuration to the `apisix.yaml` file. | ||
|
|
||
| ``` | ||
| $ cat << EOF > apisix.yaml | ||
| routes: | ||
| - | ||
| uri: /* | ||
| upstream: | ||
| nodes: | ||
| "httpbin.org": 1 | ||
| type: roundrobin | ||
| plugin_config_id: 1 | ||
|
|
||
| plugin_configs: | ||
| - | ||
| id: 1 | ||
| plugins: | ||
| response-rewrite: | ||
| body: "Hello APISIX\n" | ||
| desc: "response-rewrite" | ||
| #END | ||
| EOF | ||
| ``` | ||
|
|
||
| You can use the following command to copy the `apisix.yaml` file to the APISIX container, reload APISIX and test whether the configuration takes effect. | ||
|
|
||
| ``` | ||
| $ docker cp apisix.yaml apache-apisix:/usr/local/apisix/conf && \ | ||
| docker exec -it apache-apisix apisix reload && \ | ||
| curl http://127.0.0.1:9080/anything | ||
| ``` | ||
|
|
||
| The response indicates that APISIX is running successfully: | ||
|
|
||
| ``` | ||
| 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 | ||
|
|
||
| #### Solution 1 | ||
|
|
||
| The operation of APISIX also supports the use of etcd as the configuration center. Before starting the APISIX container, we need to start the etcd container with the following command, and specify the network used by the container as the host network. Make sure that all the required ports (default: `9080`, `9443` and `2379`) are available and not used by other system processes. | ||
|
|
||
| 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 | ||
| ``` | ||
|
|
||
| 2. Start APISIX. | ||
|
|
||
| ``` | ||
| $ docker run -d \ | ||
| --name apache-apisix \ | ||
| --net host \ | ||
| apache/apisix | ||
| ``` | ||
|
|
||
| #### Solution 2 | ||
|
|
||
| Before starting the APISIX container, we need to create a Docker virtual network and start the etcd container. | ||
|
|
||
| 1. Create a network and view the subnet address, then start etcd | ||
|
|
||
| ``` | ||
| $ docker network create apisix-network --driver bridge && \ | ||
| docker network inspect -v apisix-network && \ | ||
| docker run -d --name etcd \ | ||
| --network apisix-network \ | ||
| -p 2379:2379 \ | ||
| -p 2380:2380 \ | ||
| -e ALLOW_NONE_AUTHENTICATION=yes \ | ||
| -e ETCD_ADVERTISE_CLIENT_URLS=http://127.0.0.1:2379 \ | ||
| bitnami/etcd:latest | ||
| ``` | ||
|
|
||
| 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 | ||
| 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 | ||
| ``` | ||
|
|
||
| ### 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/" \ | ||
| -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' | ||
| ``` | ||
|
|
||
| The response indicates that apisix is running successfully: | ||
|
|
||
| ``` | ||
| { | ||
| "count":0, | ||
| "action":"get", | ||
| "node":{ | ||
| "key":"/apisix/services", | ||
| "nodes":[], | ||
| "dir":true | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| 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 | ||
| ``` | ||
|
|
||
| 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/). | ||
|
|
||
| ## Reload APISIX in a running container | ||
|
|
||
| If you change your custom configuration, you can reload APISIX (without downtime) by issuing. | ||
|
|
||
| ``` | ||
| $ docker exec -it apache-apisix apisix reload | ||
| ``` | ||
| This will run the `apisix reload` command in your container. | ||
|
|
||
| ## Kubernetes Ingress | ||
|
|
||
| During the deployment process, in addition to the above operations, APISIX also derived the [`apisix-ingress-controller`](https://github.com/apache/apisix-ingress-controller), which can be deployed and used in the K8s environment more conveniently. | ||
|
|
||
| ## License | ||
|
|
||
| Licensed under the Apache License, Version 2.0: [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) | ||
This file contains hidden or 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,2 @@ | ||
| [Discussions](https://github.com/apache/apisix/discussions) | ||
| [Issues](https://github.com/apache/apisix/issues) |
This file contains hidden or 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 @@ | ||
| https://github.com/apache/apisix |
This file contains hidden or 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 @@ | ||
| View [license information](https://github.com/apache/apisix/blob/master/LICENSE) for the software contained in this image. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 @@ | ||
| [the Apache APISIX Docker Maintainers](%%GITHUB-REPO%%) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.