├── .asf.yaml ├── .github └── workflows │ ├── ISSUE_TEMPLATE │ ├── bug-report.md │ ├── config.yml │ └── feature-request.md │ ├── PULL_REQUEST_TEMPLATE │ ├── apisix-docker-example-test-standalone.yaml │ ├── apisix-docker-example-test.yaml │ ├── apisix_dev_docker_local_test.yaml │ ├── apisix_dev_push_docker_hub.yaml │ ├── apisix_push_docker_hub.yaml │ ├── dashboard_all_in_one_ci.yaml │ ├── dashboard_push_docker_hub.yaml │ ├── lint.yml │ └── stale.yml ├── .gitignore ├── .markdownlint.yml ├── LICENSE ├── MAINTAINING.md ├── Makefile ├── README.md ├── all-in-one ├── apisix-dashboard │ ├── Dockerfile │ └── conf.yaml └── apisix │ ├── Dockerfile │ └── config.yaml ├── compose ├── apisix_conf │ ├── master │ │ └── config.yaml │ └── release │ │ └── config.yaml ├── dashboard-compose.yaml ├── docker-compose-master.yaml └── docker-compose-release.yaml ├── dashboard ├── Dockerfile.alpine └── README.md ├── debian-dev ├── Dockerfile ├── Dockerfile.local ├── docker-entrypoint.sh └── install-brotli.sh ├── debian ├── Dockerfile ├── docker-entrypoint.sh └── install-brotli.sh ├── docs └── en │ └── latest │ ├── build.md │ ├── config.json │ ├── example.md │ └── manual.md ├── example ├── .gitignore ├── apisix_conf │ ├── apisix-standalone.yaml │ ├── config-standalone.yaml │ └── config.yaml ├── docker-compose-arm64.yml ├── docker-compose-standalone.yml ├── docker-compose.yml ├── etcd_conf │ └── etcd.conf.yml ├── grafana_conf │ ├── config │ │ └── grafana.ini │ ├── dashboards │ │ └── apisix-grafana-dashboard.json │ └── provisioning │ │ ├── dashboards │ │ └── all.yaml │ │ └── datasources │ │ └── all.yaml ├── mkcert │ ├── README.md │ ├── lvh.me+1-key.pem │ ├── lvh.me+1.pem │ ├── rootCA-key.pem │ └── rootCA.pem ├── prometheus_conf │ └── prometheus.yml └── upstream │ ├── web1.conf │ └── web2.conf ├── redhat ├── Dockerfile ├── docker-entrypoint.sh ├── install-brotli.sh └── yum.repos.d │ ├── apache-apisix.repo │ └── openresty.repo └── utils └── check_standalone_config.sh /.asf.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | github: 19 | description: the docker for Apache APISIX 20 | homepage: https://apisix.apache.org/ 21 | labels: 22 | - docker 23 | - api-gateway 24 | - cloud-native 25 | - microservices 26 | - api 27 | - reverse-proxy 28 | - api-management 29 | - loadbalancing 30 | - serverless 31 | - kubernetes 32 | - apisix 33 | - devops 34 | 35 | enabled_merge_buttons: 36 | squash: true 37 | merge: false 38 | rebase: false 39 | 40 | notifications: 41 | commits: notifications@apisix.apache.org 42 | issues: notifications@apisix.apache.org 43 | pullrequests: notifications@apisix.apache.org 44 | -------------------------------------------------------------------------------- /.github/workflows/ISSUE_TEMPLATE/bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Please use this template for reporting suspected bugs. 4 | labels: "bug" 5 | --- 6 | 7 | ## Issue description 8 | 9 | 10 | ## Expected behavior 11 | 12 | 13 | ## How to Reproduce 14 | 15 | 16 | ## Screenshots 17 | 18 | 19 | ## Environment 20 | 21 | * apisix-docker version: 22 | 23 | ## Additional context 24 | 25 | -------------------------------------------------------------------------------- /.github/workflows/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Visit Apache APISIX 4 | url: https://github.com/apache/apisix 5 | about: Ask questions or discuss with other community members about Apache APISIX 6 | -------------------------------------------------------------------------------- /.github/workflows/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Create a feature request for the Apache APISIX 4 | labels: 'feature' 5 | --- 6 | 7 | # Feature request 8 | 9 | ## Please describe your feature 10 | 11 | A clear and concise description of what you want and what your use case is. 12 | 13 | ## Describe the solution you'd like 14 | 15 | A clear and concise description of what you want to happen. 16 | 17 | ## Describe alternatives you've considered 18 | 19 | A clear and concise description of any alternative solutions or features you've considered. 20 | 21 | ## Additional context 22 | 23 | Add any other context or screenshots about the feature request here. 24 | -------------------------------------------------------------------------------- /.github/workflows/PULL_REQUEST_TEMPLATE: -------------------------------------------------------------------------------- 1 | Please answer these questions before submitting a pull request, **or your PR will get closed**. 2 | 3 | **Why submit this pull request?** 4 | 5 | - [ ] Bugfix 6 | - [ ] New feature provided 7 | - [ ] Improve performance 8 | - [ ] Backport patches 9 | 10 | **What changes will this PR take into?** 11 | 12 | Please update this section with detailed description. 13 | 14 | **Related issues** 15 | 16 | fix/resolve #0001 17 | 18 | **Checklist:** 19 | 20 | - [ ] Did you explain what problem does this PR solve? Or what new features have been added? 21 | - [ ] Have you added corresponding test cases? 22 | - [ ] Have you modified the corresponding document? 23 | - [ ] Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first 24 | -------------------------------------------------------------------------------- /.github/workflows/apisix-docker-example-test-standalone.yaml: -------------------------------------------------------------------------------- 1 | name: Docker compose CI for example with standalone mode 2 | 3 | on: 4 | schedule: 5 | - cron: "0 1 * * *" 6 | push: 7 | branches: [master] 8 | paths-ignore: 9 | - 'docs/**' 10 | - '**/*.md' 11 | pull_request: 12 | branches: 13 | - master 14 | - 'release/apisix-2.15.**' 15 | 16 | env: 17 | APISIX_VERSION: "3.12.0" 18 | 19 | jobs: 20 | prepare: 21 | runs-on: ubuntu-latest 22 | 23 | steps: 24 | - name: Set apisix version 25 | id: apisix 26 | run: | 27 | branch=${{ github.base_ref }} 28 | apisix_version=$( (echo ${branch} | grep -Po '\d*\.\d*\.\d*') || echo ${APISIX_VERSION} ) 29 | echo "version=${apisix_version}" >> $GITHUB_OUTPUT 30 | 31 | outputs: 32 | apisix-version: ${{ steps.apisix.outputs.version }} 33 | 34 | build: 35 | runs-on: ubuntu-latest 36 | needs: prepare 37 | env: 38 | APISIX_VERSION: ${{ needs.prepare.outputs.apisix-version }} 39 | 40 | strategy: 41 | fail-fast: false 42 | matrix: 43 | platform: 44 | - debian 45 | - redhat 46 | 47 | steps: 48 | - uses: actions/checkout@v2 49 | 50 | - name: Build image 51 | run: | 52 | make build-on-${{ matrix.platform }} 53 | 54 | - name: use docker-compose 55 | env: 56 | APISIX_IMAGE_TAG: ${{ format('{0}-{1}', env.APISIX_VERSION, matrix.platform) }} 57 | APISIX_STAND_ALONE: true 58 | run: docker compose -p docker-apisix -f example/docker-compose-standalone.yml up -d 59 | 60 | - name: Test APISIX 61 | run: | 62 | sleep 30 63 | 64 | result_code=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/get` 65 | if [[ $result_code -ne 200 ]];then 66 | printf "result_code: %s\n" "$result_code" 67 | exit 125 68 | fi 69 | -------------------------------------------------------------------------------- /.github/workflows/apisix-docker-example-test.yaml: -------------------------------------------------------------------------------- 1 | name: Docker compose CI for example 2 | 3 | on: 4 | schedule: 5 | - cron: "0 1 * * *" 6 | push: 7 | branches: [master] 8 | paths-ignore: 9 | - 'docs/**' 10 | - '**/*.md' 11 | pull_request: 12 | branches: 13 | - master 14 | - 'release/apisix-2.15.**' 15 | 16 | env: 17 | APISIX_VERSION: "3.12.0" 18 | 19 | jobs: 20 | prepare: 21 | runs-on: ubuntu-latest 22 | 23 | steps: 24 | - name: Set apisix version 25 | id: apisix 26 | run: | 27 | branch=${{ github.base_ref }} 28 | apisix_version=$( (echo ${branch} | grep -Po '\d*\.\d*\.\d*') || echo ${APISIX_VERSION} ) 29 | echo "version=${apisix_version}" >> $GITHUB_OUTPUT 30 | 31 | outputs: 32 | apisix-version: ${{ steps.apisix.outputs.version }} 33 | 34 | build: 35 | runs-on: ubuntu-latest 36 | needs: prepare 37 | env: 38 | APISIX_VERSION: ${{ needs.prepare.outputs.apisix-version }} 39 | 40 | strategy: 41 | fail-fast: false 42 | matrix: 43 | platform: 44 | - debian 45 | - redhat 46 | 47 | steps: 48 | - uses: actions/checkout@v2 49 | 50 | - name: Build image 51 | run: | 52 | make build-on-${{ matrix.platform }} 53 | 54 | - name: use docker-compose 55 | env: 56 | APISIX_IMAGE_TAG: ${{ format('{0}-{1}', env.APISIX_VERSION, matrix.platform) }} 57 | run: docker compose -p docker-apisix -f example/docker-compose.yml up -d 58 | 59 | - name: Test APISIX 60 | run: | 61 | sleep 30 62 | 63 | curl http://127.0.0.1:9180/apisix/admin/routes/1 \ 64 | -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' 65 | { 66 | "uri": "/get", 67 | "upstream": { 68 | "type": "roundrobin", 69 | "nodes": { 70 | "web1:80": 1 71 | } 72 | } 73 | }' 74 | 75 | result_code=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/get` 76 | if [[ $result_code -ne 200 ]];then 77 | printf "result_code: %s\n" "$result_code" 78 | exit 125 79 | fi 80 | -------------------------------------------------------------------------------- /.github/workflows/apisix_dev_docker_local_test.yaml: -------------------------------------------------------------------------------- 1 | name: CI for docker image built from local source code 2 | 3 | on: 4 | schedule: 5 | - cron: "0 1 * * *" 6 | push: 7 | branches: [master] 8 | paths-ignore: 9 | - 'docs/**' 10 | - '**/*.md' 11 | pull_request: 12 | branches: 13 | - master 14 | - 'release/apisix-2.15.**' 15 | 16 | env: 17 | APISIX_IMAGE_TAG: "local-debian-dev" 18 | APISIX_VERSION: "local" 19 | 20 | jobs: 21 | 22 | build: 23 | runs-on: ubuntu-latest 24 | 25 | strategy: 26 | fail-fast: false 27 | matrix: 28 | platform: 29 | - debian 30 | 31 | steps: 32 | - uses: actions/checkout@v2 33 | 34 | - name: Checkout APISIX code 35 | run: | 36 | git clone https://github.com/apache/apisix.git 37 | 38 | - name: Build image 39 | env: 40 | LOCAL_CODE_PATH: ./apisix 41 | run: | 42 | make build-on-debian-local-dev 43 | 44 | - name: use docker-compose 45 | run: docker compose -p docker-apisix -f example/docker-compose.yml up -d 46 | 47 | - name: Test APISIX 48 | run: | 49 | sleep 2 50 | docker logs docker-apisix-apisix-1 51 | 52 | sleep 30 53 | 54 | curl http://127.0.0.1:9180/apisix/admin/routes/1 \ 55 | -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' 56 | { 57 | "uri": "/get", 58 | "upstream": { 59 | "type": "roundrobin", 60 | "nodes": { 61 | "web1:80": 1 62 | } 63 | } 64 | }' 65 | 66 | result_code=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/get` 67 | if [[ $result_code -ne 200 ]];then 68 | printf "result_code: %s\n" "$result_code" 69 | exit 125 70 | fi 71 | -------------------------------------------------------------------------------- /.github/workflows/apisix_dev_push_docker_hub.yaml: -------------------------------------------------------------------------------- 1 | name: Build and Push apisix-dev to Docker DockerHub 2 | 3 | 4 | on: 5 | schedule: 6 | # UTC 0:00 AM (See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07) 7 | - cron: "0 1 * * *" 8 | push: 9 | branches: [master] 10 | paths-ignore: 11 | - 'docs/**' 12 | - '**/*.md' 13 | 14 | jobs: 15 | build: 16 | runs-on: ubuntu-latest 17 | 18 | env: 19 | APISIX_VERSION: master 20 | APISIX_DOCKER_TAG: master-debian-dev 21 | 22 | steps: 23 | - name: Check out the repo 24 | uses: actions/checkout@v2 25 | 26 | - name: Build and run 27 | run: | 28 | make build-on-debian-dev 29 | docker compose -f ./compose/docker-compose-master.yaml up -d 30 | sleep 30 31 | docker logs compose-apisix-1 32 | 33 | - name: Test APISIX 34 | run: | 35 | 36 | curl http://127.0.0.1:9180/apisix/admin/routes/1 \ 37 | -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' 38 | { 39 | "uri": "/get", 40 | "upstream": { 41 | "type": "roundrobin", 42 | "nodes": { 43 | "httpbin.org:80": 1 44 | } 45 | } 46 | }' 47 | 48 | result_code=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/get` 49 | if [[ $result_code -ne 200 ]];then 50 | printf "result_code: %s\n" "$result_code" 51 | exit 125 52 | fi 53 | 54 | - name: Login to Docker Hub 55 | uses: docker/login-action@v1 56 | with: 57 | username: ${{ secrets.DOCKERHUB_USER }} 58 | password: ${{ secrets.DOCKERHUB_TOKEN }} 59 | 60 | - name: Set up QEMU 61 | uses: docker/setup-qemu-action@v1 62 | 63 | - name: Set up Docker Buildx 64 | uses: docker/setup-buildx-action@v1 65 | 66 | - name: Push apisix image to Docker Hub 67 | run: | 68 | make push-multiarch-dev-on-debian 69 | -------------------------------------------------------------------------------- /.github/workflows/apisix_push_docker_hub.yaml: -------------------------------------------------------------------------------- 1 | name: Push apisix to Docker image 2 | on: 3 | push: 4 | branches: ['release/apisix-**'] 5 | 6 | jobs: 7 | build: 8 | runs-on: ubuntu-latest 9 | strategy: 10 | fail-fast: false 11 | matrix: 12 | platform: 13 | - debian 14 | - redhat 15 | env: 16 | APISIX_DOCKER_TAG: 3.12.0-${{ matrix.platform }} 17 | 18 | steps: 19 | - name: Check out the repo 20 | uses: actions/checkout@v2 21 | 22 | - name: Build and run 23 | run: | 24 | make build-on-${{ matrix.platform }} 25 | docker compose -f ./compose/docker-compose-release.yaml up -d 26 | sleep 30 27 | docker logs compose-apisix-1 28 | 29 | - name: Test route 30 | run: | 31 | grep -C 3 '\[error\]' compose/apisix_log/error.log && exit 1 32 | 33 | curl http://127.0.0.1:9180/apisix/admin/routes/1 \ 34 | -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' 35 | { 36 | "uri": "/get", 37 | "upstream": { 38 | "type": "roundrobin", 39 | "nodes": { 40 | "httpbin.org:80": 1 41 | } 42 | } 43 | }' 44 | 45 | result_code=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/get` 46 | if [[ $result_code -ne 200 ]];then 47 | printf "result_code: %s\n" "$result_code" 48 | exit 125 49 | fi 50 | 51 | - name: Login to Docker Hub 52 | uses: docker/login-action@v1 53 | with: 54 | username: ${{ secrets.DOCKERHUB_USER }} 55 | password: ${{ secrets.DOCKERHUB_TOKEN }} 56 | 57 | - name: Set up QEMU 58 | uses: docker/setup-qemu-action@v1 59 | 60 | - name: Set up Docker Buildx 61 | uses: docker/setup-buildx-action@v1 62 | 63 | - name: push apisix:latest image to docker hub 64 | if: matrix.platform == 'debian' 65 | run: | 66 | make push-multiarch-on-latest 67 | 68 | - name: Push apisix:${{ matrix.os }} image to Docker Hub 69 | run: | 70 | make push-multiarch-on-${{ matrix.platform }} 71 | -------------------------------------------------------------------------------- /.github/workflows/dashboard_all_in_one_ci.yaml: -------------------------------------------------------------------------------- 1 | name: apisix dashboard all in one docker 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | 15 | env: 16 | APISIX_DASHBOARD_VERSION: "3.0.1" # in semver 17 | 18 | steps: 19 | - uses: actions/checkout@v2 20 | 21 | - name: Build and Test 22 | run: | 23 | docker build -t apache/apisix-dashboard:whole --build-arg APISIX_DASHBOARD_TAG=v${APISIX_DASHBOARD_VERSION} -f ./all-in-one/apisix-dashboard/Dockerfile . 24 | docker run -v `pwd`/all-in-one/apisix/config.yaml:/usr/local/apisix/conf/config.yaml -v `pwd`/all-in-one/apisix-dashboard/conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml -p 9080:9080 -p 2379:2379 -p 9000:9000 -d apache/apisix-dashboard:whole 25 | sleep 30 26 | curl http://127.0.0.1:9080/apisix/admin/schema/service -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' 27 | curl http://127.0.0.1:9000 28 | -------------------------------------------------------------------------------- /.github/workflows/dashboard_push_docker_hub.yaml: -------------------------------------------------------------------------------- 1 | name: Push apisix dashboard to Docker image 2 | on: 3 | push: 4 | branches: ['release/apisix-dashboard**'] 5 | jobs: 6 | build: 7 | strategy: 8 | fail-fast: false 9 | matrix: 10 | os: 11 | - alpine 12 | 13 | name: build dashboard & test on ${{ matrix.os }} && push to docker hub 14 | runs-on: ubuntu-latest 15 | 16 | env: 17 | APISIX_DASHBOARD_VERSION: "3.0.1" # in semver 18 | 19 | steps: 20 | - name: Check out the repo 21 | uses: actions/checkout@v2 22 | 23 | - name: Build and run 24 | run: | 25 | make build-dashboard-${{ matrix.os }} 26 | docker compose -f ./compose/dashboard-compose.yaml up -d 27 | sleep 30 28 | docker logs compose-dashboard-1 29 | 30 | - name: check 31 | run: | 32 | wget https://raw.githubusercontent.com/apache/apisix-dashboard/master/api/test/shell/manager_smoking.sh 33 | chmod +x ./manager_smoking.sh 34 | sh manager_smoking.sh -s true 35 | 36 | - name: Tar Image 37 | run: | 38 | make save-dashboard-${{ matrix.os }}-tar 39 | 40 | - name: Upload Image 41 | uses: actions/upload-artifact@v4 42 | with: 43 | path: ./package 44 | 45 | - name: Login to Docker Hub 46 | uses: docker/login-action@v1 47 | with: 48 | username: ${{ secrets.DOCKERHUB_USER }} 49 | password: ${{ secrets.DOCKERHUB_TOKEN }} 50 | 51 | - name: Set up QEMU 52 | uses: docker/setup-qemu-action@v1 53 | 54 | - name: Set up Docker Buildx 55 | uses: docker/setup-buildx-action@v1 56 | 57 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: ❄️ Lint 2 | 3 | on: [pull_request] 4 | 5 | jobs: 6 | markdownlint: 7 | name: 🍇 Markdown 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v2 11 | - name: 🚀 Use Node.js 12 | uses: actions/setup-node@v1 13 | with: 14 | node-version: '12.x' 15 | - run: npm install -g markdownlint-cli@0.25.0 16 | - run: markdownlint '**/*.md' --ignore node_modules 17 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | on: 2 | workflow_dispatch: 3 | schedule: 4 | - cron: '0 10 * * *' 5 | 6 | jobs: 7 | prune_stale: 8 | name: Prune Stale 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - name: Prune Stale 13 | uses: actions/stale@v4.0.0 14 | with: 15 | days-before-issue-stale: 30 16 | days-before-issue-close: 14 17 | stale-issue-message: > 18 | This issue has been marked as stale due to 30 days of inactivity. 19 | It will be closed in 2 weeks if no further activity occurs. If this 20 | issue is still relevant, please simply write any comment. Even if 21 | closed, you can still revive the issue at any time or discuss it 22 | on the dev@apisix.apache.org list. 23 | Thank you for your contributions. 24 | close-issue-message: > 25 | This issue has been closed due to lack of activity. If you think 26 | that is incorrect, or the issue requires additional review, you 27 | can revive the issue at any time. 28 | days-before-pr-stale: 60 29 | days-before-pr-close: 28 30 | stale-pr-message: > 31 | This pull request has been marked as stale due to 60 days of 32 | inactivity. It will be closed in 4 weeks if no further activity 33 | occurs. If you think that's incorrect or this pull request should 34 | instead be reviewed, please simply write any comment. Even if 35 | closed, you can still revive the PR at any time ordiscuss it on 36 | the dev@apisix.apache.org list. 37 | Thank you for your contributions. 38 | close-pr-message: > 39 | This pull request/issue has been closed due to lack of activity. 40 | If you think that is incorrect, or the pull request requires 41 | review, you can revive the PR at any time. 42 | # Issues with these labels will never be considered stale. 43 | exempt-issue-labels: 'bug,enhancement,good first issue' 44 | stale-issue-label: 'stale' 45 | stale-pr-label: 'stale' 46 | ascending: true 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .DS_Store 3 | ./package 4 | !compose/apisix_log/.gitkeep 5 | -------------------------------------------------------------------------------- /.markdownlint.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # MD013/line-length Line length 19 | MD013: false 20 | 21 | # MD014/commands-show-output Dollar signs used before commands without showing output 22 | MD014: false 23 | 24 | # MD029/ol-prefix Ordered list item prefix 25 | MD019: false 26 | 27 | # MD029/ol-prefix Ordered list item prefix 28 | MD029: false 29 | 30 | # MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines 31 | MD031: false 32 | 33 | # MD032/blanks-around-lists Lists should be surrounded by blank lines 34 | MD032: false 35 | 36 | # MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading 37 | MD036: false 38 | 39 | # MD040/fenced-code-language Fenced code blocks should have a language specified 40 | MD040: false 41 | 42 | # MD041/first-line-heading/first-line-h1 First line in file should be a top level heading 43 | MD041: false 44 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /MAINTAINING.md: -------------------------------------------------------------------------------- 1 | ## New release 2 | 3 | To make and publish new docker images on docker hub, maintainers should create branch under `apisix-docker` repo with specific name. 4 | 5 | For apisix new version, the branch name should use prefix `release/apisix` (e.g. `release/apisix-2.6`). Remember to delete the release branch after the new images published, since the branch would got no use afterwards. 6 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # Makefile basic env setting 19 | .DEFAULT_GOAL := help 20 | SHELL := bash 21 | 22 | 23 | # APISIX ARGS 24 | APISIX_VERSION ?= 3.12.0 25 | MAX_APISIX_VERSION ?= 3.12.0 26 | IMAGE_NAME = apache/apisix 27 | IMAGE_TAR_NAME = apache_apisix 28 | APISIX_REPO = https://github.com/apache/apisix 29 | APISIX_REPO_BRANCH = master 30 | LOCAL_CODE_PATH = 0 31 | 32 | APISIX_DASHBOARD_VERSION ?= $(shell echo ${APISIX_DASHBOARD_VERSION:=3.0.1}) 33 | APISIX_DASHBOARD_IMAGE_NAME = apache/apisix-dashboard 34 | APISIX_DASHBOARD_IMAGE_TAR_NAME = apache_apisix_dashboard 35 | 36 | 37 | # Makefile ENV 38 | ENV_OS_NAME ?= $(shell uname -s | tr '[:upper:]' '[:lower:]') 39 | ENV_APISIX_TAR_NAME ?= $(IMAGE_TAR_NAME)_$(APISIX_VERSION) 40 | ENV_APISIX_IMAGE_TAG_NAME ?= $(IMAGE_NAME):$(APISIX_VERSION) 41 | ENV_DOCKER ?= docker 42 | 43 | 44 | # Makefile basic extension function 45 | _color_red =\E[1;31m 46 | _color_green =\E[1;32m 47 | _color_yellow =\E[1;33m 48 | _color_blue =\E[1;34m 49 | _color_wipe =\E[0m 50 | 51 | 52 | define func_echo_status 53 | printf "[$(_color_blue) info $(_color_wipe)] %s\n" $(1) 54 | endef 55 | 56 | 57 | define func_echo_warn_status 58 | printf "[$(_color_yellow) info $(_color_wipe)] %s\n" $(1) 59 | endef 60 | 61 | 62 | define func_echo_success_status 63 | printf "[$(_color_green) info $(_color_wipe)] %s\n" $(1) 64 | endef 65 | 66 | define build_image_dev 67 | $(ENV_DOCKER) build -t $(ENV_APISIX_IMAGE_TAG_NAME)-debian-dev \ 68 | --build-arg CODE_PATH=$(1) \ 69 | --build-arg ENTRYPOINT_PATH=debian-dev/docker-entrypoint.sh \ 70 | --build-arg INSTALL_BROTLI=debian-dev/install-brotli.sh \ 71 | -f ./debian-dev/Dockerfile.local . 72 | endef 73 | 74 | ### build-on-redhat : Build apache/apisix:xx-redhat image 75 | .PHONY: build-on-redhat 76 | build-on-redhat: 77 | @$(call func_echo_status, "$@ -> [ Start ]") 78 | cp ./utils/check_standalone_config.sh redhat/check_standalone_config.sh 79 | $(ENV_DOCKER) build -t $(ENV_APISIX_IMAGE_TAG_NAME)-redhat -f ./redhat/Dockerfile redhat 80 | rm -f redhat/check_standalone_config.sh 81 | @$(call func_echo_success_status, "$@ -> [ Done ]") 82 | 83 | ### build-on-debian-dev : Build apache/apisix:xx-debian-dev image 84 | .PHONY: build-on-debian-dev 85 | build-on-debian-dev: 86 | @$(call func_echo_status, "$@ -> [ Start ]") 87 | cp ./utils/check_standalone_config.sh debian-dev/check_standalone_config.sh 88 | $(ENV_DOCKER) build -t $(ENV_APISIX_IMAGE_TAG_NAME)-debian-dev -f ./debian-dev/Dockerfile debian-dev 89 | rm -f debian-dev/check_standalone_config.sh 90 | @$(call func_echo_success_status, "$@ -> [ Done ]") 91 | 92 | ### build-on-debian-local-dev : Build apache/apisix:xx-debian-dev image 93 | .PHONY: build-on-debian-local-dev 94 | build-on-debian-local-dev: 95 | @$(call func_echo_status, "$@ -> [ Start ]") 96 | ifeq ($(LOCAL_CODE_PATH), 0) 97 | ifeq ($(shell test -d ./apisix && echo -n yes), ) 98 | git clone -b $(APISIX_REPO_BRANCH) $(APISIX_REPO) ./apisix 99 | endif 100 | $(call build_image_dev,"./apisix") 101 | else 102 | $(call build_image_dev,$(LOCAL_CODE_PATH)) 103 | endif 104 | @$(call func_echo_success_status, "$@ -> [ Done ]") 105 | 106 | ### build-on-debian : Build apache/apisix:xx-debian image 107 | .PHONY: build-on-debian 108 | build-on-debian: 109 | @$(call func_echo_status, "$@ -> [ Start ]") 110 | cp ./utils/check_standalone_config.sh debian/check_standalone_config.sh 111 | $(ENV_DOCKER) build -t $(ENV_APISIX_IMAGE_TAG_NAME)-debian -f ./debian/Dockerfile debian 112 | rm -f debian/check_standalone_config.sh 113 | @$(call func_echo_success_status, "$@ -> [ Done ]") 114 | 115 | 116 | ### push-on-alpine : Push apache/apisix:dev image 117 | .PHONY: push-multiarch-dev-on-debian 118 | push-multiarch-dev-on-debian: 119 | @$(call func_echo_status, "$@ -> [ Start ]") 120 | cp ./utils/check_standalone_config.sh debian-dev/check_standalone_config.sh 121 | $(ENV_DOCKER) buildx build --network=host --push \ 122 | -t $(IMAGE_NAME):dev \ 123 | --platform linux/amd64,linux/arm64 \ 124 | -f ./debian-dev/Dockerfile debian-dev 125 | rm -f debian-dev/check_standalone_config.sh 126 | @$(call func_echo_success_status, "$@ -> [ Done ]") 127 | 128 | 129 | ### push-multiarch-on-debian : Push apache/apisix:xx-debian image 130 | .PHONY: push-multiarch-on-debian 131 | push-multiarch-on-debian: 132 | @$(call func_echo_status, "$@ -> [ Start ]") 133 | cp ./utils/check_standalone_config.sh debian/check_standalone_config.sh 134 | $(ENV_DOCKER) buildx build --network=host --push \ 135 | -t $(ENV_APISIX_IMAGE_TAG_NAME)-debian \ 136 | --platform linux/amd64,linux/arm64 \ 137 | -f ./debian/Dockerfile debian 138 | rm -f debian/check_standalone_config.sh 139 | @$(call func_echo_success_status, "$@ -> [ Done ]") 140 | 141 | 142 | ### push-multiarch-on-redhat : Push apache/apisix:xx-redhat image 143 | .PHONY: push-multiarch-on-redhat 144 | push-multiarch-on-redhat: 145 | @$(call func_echo_status, "$@ -> [ Start ]") 146 | cp ./utils/check_standalone_config.sh redhat/check_standalone_config.sh 147 | $(ENV_DOCKER) buildx build --network=host --push \ 148 | -t $(ENV_APISIX_IMAGE_TAG_NAME)-redhat \ 149 | --platform linux/amd64,linux/arm64 \ 150 | -f ./redhat/Dockerfile redhat 151 | rm -f redhat/check_standalone_config.sh 152 | @$(call func_echo_success_status, "$@ -> [ Done ]") 153 | 154 | ### push-multiarch-on-latest : Push apache/apisix:latest image 155 | .PHONY: push-multiarch-on-latest 156 | # Here we choose to check the max APISIX version instead of the patch version, so that 157 | # we can release a patch version for a non-LTS version. For example, release a version 158 | # to solve security issue. 159 | push-multiarch-on-latest: 160 | @$(call func_echo_status, "$@ -> [ Start ]") 161 | @if [ "$(shell echo "$(APISIX_VERSION) $(MAX_APISIX_VERSION)" | tr " " "\n" | sort -rV | head -n 1)" == "$(APISIX_VERSION)" ]; then \ 162 | cp ./utils/check_standalone_config.sh debian/check_standalone_config.sh; \ 163 | $(ENV_DOCKER) buildx build --network=host --push \ 164 | -t $(IMAGE_NAME):latest \ 165 | --platform linux/amd64,linux/arm64 \ 166 | -f ./debian/Dockerfile debian; \ 167 | rm -f debian/check_standalone_config.sh; \ 168 | fi 169 | @$(call func_echo_success_status, "$@ -> [ Done ]") 170 | 171 | 172 | ### build-all-in-one : Build All in one Docker container for Apache APISIX 173 | .PHONY: build-all-in-one 174 | build-all-in-one: 175 | @$(call func_echo_status, "$@ -> [ Start ]") 176 | $(ENV_DOCKER) build -t $(IMAGE_NAME):whole -f ./all-in-one/apisix/Dockerfile . 177 | @$(call func_echo_success_status, "$@ -> [ Done ]") 178 | 179 | 180 | ### build-dashboard-all-in-one : Build All in one Docker container for Apache APISIX-dashboard 181 | .PHONY: build-dashboard-all-in-one 182 | build-dashboard-all-in-one: 183 | @$(call func_echo_status, "$@ -> [ Start ]") 184 | $(ENV_DOCKER) build -t $(APISIX_DASHBOARD_IMAGE_NAME):whole -f ./all-in-one/apisix-dashboard/Dockerfile . 185 | @$(call func_echo_success_status, "$@ -> [ Done ]") 186 | 187 | 188 | ### save-debian-tar : tar apache/apisix:xx-debian image 189 | .PHONY: save-debian-tar 190 | save-debian-tar: 191 | @$(call func_echo_status, "$@ -> [ Start ]") 192 | mkdir -p package 193 | $(ENV_DOCKER) save -o ./package/$(ENV_APISIX_TAR_NAME)-debian.tar $(ENV_APISIX_IMAGE_TAG_NAME)-debian 194 | @$(call func_echo_success_status, "$@ -> [ Done ]") 195 | 196 | 197 | ### build-dashboard-alpine : Build apache/dashboard:tag image on alpine 198 | .PHONY: build-dashboard-alpine 199 | build-dashboard-alpine: 200 | @$(call func_echo_status, "$@ -> [ Start ]") 201 | $(ENV_DOCKER) build -t $(APISIX_DASHBOARD_IMAGE_NAME):$(APISIX_DASHBOARD_VERSION) \ 202 | --build-arg APISIX_DASHBOARD_TAG=v$(APISIX_DASHBOARD_VERSION) \ 203 | -f ./dashboard/Dockerfile.alpine . 204 | @$(call func_echo_success_status, "$@ -> [ Done ]") 205 | 206 | 207 | ### save-dashboard-alpine-tar : tar apache/apisix-dashboard:tag image 208 | .PHONY: save-dashboard-alpine-tar 209 | save-dashboard-alpine-tar: 210 | @$(call func_echo_status, "$@ -> [ Start ]") 211 | mkdir -p package 212 | $(ENV_DOCKER) save -o ./package/$(APISIX_DASHBOARD_IMAGE_TAR_NAME)_$(APISIX_DASHBOARD_VERSION)-alpine.tar $(APISIX_DASHBOARD_IMAGE_NAME):$(APISIX_DASHBOARD_VERSION) 213 | @$(call func_echo_success_status, "$@ -> [ Done ]") 214 | 215 | 216 | ### help : Show Makefile rules 217 | .PHONY: help 218 | help: 219 | @$(call func_echo_success_status, "Makefile rules:") 220 | @echo 221 | @if [ '$(ENV_OS_NAME)' = 'darwin' ]; then \ 222 | awk '{ if(match($$0, /^#{3}([^:]+):(.*)$$/)){ split($$0, res, ":"); gsub(/^#{3}[ ]*/, "", res[1]); _desc=$$0; gsub(/^#{3}([^:]+):[ \t]*/, "", _desc); printf(" make %-25s : %-10s\n", res[1], _desc) } }' Makefile; \ 223 | else \ 224 | awk '{ if(match($$0, /^\s*#{3}\s*([^:]+)\s*:\s*(.*)$$/, res)){ printf(" make %-25s : %-10s\n", res[1], res[2]) } }' Makefile; \ 225 | fi 226 | @echo 227 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Roadmap 2 | 3 | Refer to [⚡️ Apache APISIX Projects Roadmap](https://github.com/apache/apisix/issues/12159) 4 | 5 | ## What is Apache APISIX API Gateway 6 | 7 | Apache APISIX is a dynamic, real-time, high-performance API Gateway. 8 | 9 | APISIX API Gateway provides rich traffic management features such as load balancing, dynamic upstream, canary release, circuit breaking, authentication, observability, and more. 10 | 11 | You can use APISIX API Gateway to handle traditional north-south traffic, as well as east-west traffic between services. 12 | At present, APISIX has been used in various industries, including NASA, Tencent Cloud, EU Digital Factory, Airbus, Airwallex, iQIYI, etc. 13 | 14 | ## How to run Apache APISIX 15 | 16 | Apache APISIX supports stand-alone mode and also supports the use of etcd database as the configuration center. 17 | 18 | ### How to run APISIX in stand-alone mode 19 | 20 | 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. 21 | 22 | You can start an APISIX container with stand-alone mode by the following command: 23 | 24 | ```shell 25 | docker run -d --name apache-apisix \ 26 | -p 9080:9080 \ 27 | -e APISIX_STAND_ALONE=true \ 28 | apache/apisix 29 | ``` 30 | 31 | Add Route and Plugin configuration to the running APISIX container: 32 | 33 | ```shell 34 | docker exec -i apache-apisix sh -c 'cat > /usr/local/apisix/conf/apisix.yaml <<_EOC_ 35 | routes: 36 | - 37 | id: httpbin 38 | uri: /* 39 | upstream: 40 | nodes: 41 | "httpbin.org": 1 42 | type: roundrobin 43 | plugin_config_id: 1 44 | 45 | plugin_configs: 46 | - 47 | id: 1 48 | plugins: 49 | response-rewrite: 50 | body: "Hello APISIX\n" 51 | desc: "response-rewrite" 52 | #END 53 | _EOC_' 54 | ``` 55 | 56 | Test example: 57 | 58 | ```shell 59 | curl http://127.0.0.1:9080/ 60 | ``` 61 | 62 | ```shell 63 | Hello APISIX 64 | ``` 65 | If you want to know more configuration examples, you can refer to [stand-alone](https://apisix.apache.org/docs/apisix/deployment-modes/#standalone). 66 | 67 | ### How to run APISIX using etcd as configuration center 68 | 69 | #### Solution 1 70 | 71 | 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. 72 | 73 | 1. Start etcd. 74 | 75 | ```shell 76 | docker run -d \ 77 | --name etcd \ 78 | --net host \ 79 | -e ALLOW_NONE_AUTHENTICATION=yes \ 80 | -e ETCD_ADVERTISE_CLIENT_URLS=http://127.0.0.1:2379 \ 81 | bitnami/etcd:latest 82 | ``` 83 | 84 | 2. Start APISIX. 85 | 86 | ```shell 87 | docker run -d \ 88 | --name apache-apisix \ 89 | --net host \ 90 | apache/apisix 91 | ``` 92 | 93 | #### Solution 2 94 | 95 | Before starting the APISIX container, we need to create a Docker virtual network and start the etcd container. 96 | 97 | 1. Create a network and view the subnet address, then start etcd 98 | 99 | ```shell 100 | docker network create apisix-network --driver bridge && \ 101 | docker network inspect -v apisix-network && \ 102 | docker run -d --name etcd \ 103 | --network apisix-network \ 104 | -p 2379:2379 \ 105 | -p 2380:2380 \ 106 | -e ALLOW_NONE_AUTHENTICATION=yes \ 107 | -e ETCD_ADVERTISE_CLIENT_URLS=http://127.0.0.1:2379 \ 108 | bitnami/etcd:latest 109 | ``` 110 | 111 | 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. 112 | 113 | ```shell 114 | cat << EOF > $(pwd)/config.yaml 115 | deployment: 116 | role: traditional 117 | role_traditional: 118 | config_provider: etcd 119 | admin: 120 | allow_admin: 121 | - 0.0.0.0/0 # Please set it to the subnet address you obtained. 122 | # If not set, by default all IP access is allowed. 123 | etcd: 124 | host: 125 | - "http://etcd:2379" 126 | prefix: "/apisix" 127 | timeout: 30 128 | EOF 129 | ``` 130 | 131 | 3. Start APISIX and reference the file created in the previous step. 132 | 133 | ```shell 134 | docker run -d --name apache-apisix \ 135 | --network apisix-network \ 136 | -p 9080:9080 \ 137 | -p 9180:9180 \ 138 | -v $(pwd)/config.yaml:/usr/local/apisix/conf/config.yaml \ 139 | apache/apisix 140 | ``` 141 | 142 | #### Test example 143 | 144 | Check that APISIX is running properly by running the following command on the host. 145 | 146 | ``` 147 | curl "http://127.0.0.1:9180/apisix/admin/services/" \ 148 | -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' 149 | ``` 150 | 151 | The response indicates that apisix is running successfully: 152 | 153 | ```json 154 | { 155 | "total": 0, 156 | "list": [] 157 | } 158 | ``` 159 | 160 | 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`. 161 | 162 | ```shell 163 | docker exec -it apache-apisix bash 164 | ``` 165 | 166 | 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/). 167 | 168 | ## Reload APISIX in a running container 169 | 170 | If you change your custom configuration, you can reload APISIX (without downtime) by issuing. 171 | 172 | ```shell 173 | docker exec -it apache-apisix apisix reload 174 | ``` 175 | This will run the `apisix reload` command in your container. 176 | 177 | ## Kubernetes Ingress 178 | 179 | 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. 180 | 181 | ## License 182 | 183 | Licensed under the Apache License, Version 2.0: [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) 184 | -------------------------------------------------------------------------------- /all-in-one/apisix-dashboard/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | ARG ENABLE_PROXY=false 19 | ARG ETCD_VERSION=v3.4.14 20 | ARG APISIX_VERSION=master 21 | ARG APISIX_DASHBOARD_VERSION=master 22 | 23 | # Build Apache APISIX 24 | FROM openresty/openresty:1.25.3.2-0-alpine-fat AS production-stage 25 | 26 | ARG APISIX_VERSION 27 | ARG ENABLE_PROXY 28 | LABEL apisix_version="${APISIX_VERSION}" 29 | 30 | RUN set -x \ 31 | && (test "${ENABLE_PROXY}" != "true" || /bin/sed -i 's,http://dl-cdn.alpinelinux.org,https://mirrors.aliyun.com,g' /etc/apk/repositories) \ 32 | && apk add --no-cache --virtual .builddeps \ 33 | automake \ 34 | autoconf \ 35 | libtool \ 36 | pkgconfig \ 37 | cmake \ 38 | make \ 39 | clang \ 40 | wget \ 41 | git \ 42 | openldap-dev \ 43 | sudo \ 44 | && wget https://github.com/yaml/libyaml/releases/download/0.2.5/yaml-0.2.5.tar.gz \ 45 | && tar -zxvf yaml-0.2.5.tar.gz \ 46 | && cd yaml-0.2.5 \ 47 | && ./configure \ 48 | && make \ 49 | && make install \ 50 | && mkdir ~/.luarocks \ 51 | && luarocks config variables.OPENSSL_LIBDIR /usr/local/openresty/openssl/lib \ 52 | && luarocks config variables.OPENSSL_INCDIR /usr/local/openresty/openssl/include \ 53 | && git config --global url.https://github.com/.insteadOf git://github.com/ \ 54 | && luarocks install https://raw.githubusercontent.com/apache/apisix/master/apisix-master-0.rockspec --tree=/usr/local/apisix/deps PCRE_DIR=/usr/local/openresty/pcre \ 55 | && cp -v /usr/local/apisix/deps/lib/luarocks/rocks-5.1/apisix/${APISIX_VERSION}-0/bin/apisix /usr/bin/ \ 56 | && (if [ "$APISIX_VERSION" = "master" ] || [ "$APISIX_VERSION" \> "2.2" ]; then echo 'use shell ';else bin='#! /usr/local/openresty/luajit/bin/luajit\npackage.path = "/usr/local/apisix/?.lua;" .. package.path'; sed -i "1s@.*@$bin@" /usr/bin/apisix ; fi;) \ 57 | && mv /usr/local/apisix/deps/share/lua/5.1/apisix /usr/local/apisix \ 58 | && apk del .builddeps build-base make unzip clang wget 59 | 60 | # Build etcd 61 | FROM alpine:3.13 AS etcd-stage 62 | 63 | ARG ETCD_VERSION 64 | LABEL etcd_version="${ETCD_VERSION}" 65 | 66 | WORKDIR /tmp 67 | RUN wget https://github.com/etcd-io/etcd/releases/download/${ETCD_VERSION}/etcd-${ETCD_VERSION}-linux-amd64.tar.gz \ 68 | && tar -zxvf etcd-${ETCD_VERSION}-linux-amd64.tar.gz \ 69 | && ln -s etcd-${ETCD_VERSION}-linux-amd64 etcd 70 | 71 | 72 | # Build APISIX Dashboard - 1. download source code from github 73 | FROM alpine:latest as pre-build 74 | 75 | ARG APISIX_DASHBOARD_TAG 76 | 77 | RUN set -x \ 78 | && wget https://github.com/apache/apisix-dashboard/archive/${APISIX_DASHBOARD_TAG}.tar.gz -O /tmp/apisix-dashboard.tar.gz \ 79 | && mkdir /usr/local/apisix-dashboard \ 80 | && tar -xvf /tmp/apisix-dashboard.tar.gz -C /usr/local/apisix-dashboard --strip 1 81 | 82 | # Build APISIX Dashboard - 2. build manager-api from source code 83 | FROM golang:1.17 as api-builder 84 | 85 | ARG APISIX_DASHBOARD_VERSION 86 | ARG ENABLE_PROXY 87 | 88 | WORKDIR /usr/local/apisix-dashboard 89 | 90 | COPY --from=pre-build /usr/local/apisix-dashboard . 91 | 92 | RUN if [ "$ENABLE_PROXY" = "true" ] ; then go env -w GOPROXY=https://goproxy.io,direct ; fi \ 93 | && go env -w GO111MODULE=on \ 94 | && CGO_ENABLED=0 ./api/build.sh 95 | 96 | # Build APISIX Dashboard - 3. build dashboard web-UI from source code 97 | FROM node:14-alpine as fe-builder 98 | 99 | ARG ENABLE_PROXY 100 | 101 | WORKDIR /usr/local/apisix-dashboard 102 | 103 | COPY --from=pre-build /usr/local/apisix-dashboard . 104 | 105 | WORKDIR /usr/local/apisix-dashboard/web 106 | 107 | RUN if [ "$ENABLE_PROXY" = "true" ] ; then yarn config set registry https://registry.npmmirror.com/ ; fi \ 108 | # FIXME: when the certificate is valid 109 | && yarn config set "strict-ssl" false -g \ 110 | && yarn install \ 111 | && yarn build 112 | 113 | # Finally combine all the resources into one image 114 | FROM alpine:3.13 AS last-stage 115 | 116 | ARG ENABLE_PROXY 117 | 118 | # add runtime for Apache APISIX 119 | RUN set -x \ 120 | && (test "${ENABLE_PROXY}" != "true" || /bin/sed -i 's,http://dl-cdn.alpinelinux.org,https://mirrors.aliyun.com,g' /etc/apk/repositories) \ 121 | && apk add --no-cache bash libstdc++ curl 122 | 123 | WORKDIR /usr/local/apisix 124 | 125 | COPY --from=production-stage /usr/local/openresty/ /usr/local/openresty/ 126 | COPY --from=production-stage /usr/local/apisix/ /usr/local/apisix/ 127 | COPY --from=production-stage /usr/bin/apisix /usr/bin/apisix 128 | COPY --from=production-stage /usr/local/lib/libyaml* /usr/local/lib/ 129 | 130 | COPY --from=etcd-stage /tmp/etcd/etcd /usr/bin/etcd 131 | COPY --from=etcd-stage /tmp/etcd/etcdctl /usr/bin/etcdctl 132 | 133 | ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin 134 | 135 | # dashboard 136 | 137 | RUN if [ "$ENABLE_PROXY" = "true" ] ; then sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories ; fi \ 138 | && apk add lua5.1 139 | 140 | WORKDIR /usr/local/apisix-dashboard 141 | 142 | COPY --from=api-builder /usr/local/apisix-dashboard/output/ ./ 143 | COPY --from=fe-builder /usr/local/apisix-dashboard/output/ ./ 144 | 145 | RUN mkdir logs 146 | 147 | EXPOSE 9080 9443 2379 2380 9000 148 | 149 | CMD ["sh", "-c", "(nohup etcd >/tmp/etcd.log 2>&1 &) && sleep 10 && (/usr/local/apisix-dashboard/manager-api &) && cd /usr/local/apisix && /usr/bin/apisix init && /usr/bin/apisix init_etcd && /usr/local/openresty/bin/openresty -p /usr/local/apisix -g 'daemon off;'"] 150 | 151 | STOPSIGNAL SIGQUIT 152 | -------------------------------------------------------------------------------- /all-in-one/apisix-dashboard/conf.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | conf: 19 | listen: 20 | host: 0.0.0.0 # `manager api` listening ip or host name 21 | port: 9000 # `manager api` listening port 22 | etcd: 23 | endpoints: # supports defining multiple etcd host addresses for an etcd cluster 24 | - 127.0.0.1:2379 25 | 26 | # etcd basic auth info 27 | # username: "root" # ignore etcd username if not enable etcd auth 28 | # password: "123456" # ignore etcd password if not enable etcd auth 29 | log: 30 | error_log: 31 | level: warn # supports levels, lower to higher: debug, info, warn, error, panic, fatal 32 | file_path: 33 | logs/error.log # supports relative path, absolute path, standard output 34 | # such as: logs/error.log, /tmp/logs/error.log, /dev/stdout, /dev/stderr 35 | authentication: 36 | secret: 37 | secret # secret for jwt token generation. 38 | # NOTE: Highly recommended to modify this value to protect `manager api`. 39 | # if it's default value, when `manager api` start, it will generate a random string to replace it. 40 | expire_time: 3600 # jwt token expire time, in second 41 | users: 42 | - username: admin # username and password for login `manager api` 43 | password: admin 44 | - username: user 45 | password: user 46 | 47 | plugin_attr: 48 | prometheus: 49 | export_addr: 50 | ip: "0.0.0.0" 51 | port: 9091 52 | -------------------------------------------------------------------------------- /all-in-one/apisix/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | ARG ENABLE_PROXY=false 19 | ARG ETCD_VERSION=v3.5.4 20 | 21 | # Build Apache APISIX 22 | FROM apache/apisix:latest 23 | 24 | 25 | ARG ETCD_VERSION 26 | LABEL etcd_version="${ETCD_VERSION}" 27 | 28 | WORKDIR /tmp 29 | 30 | USER root 31 | 32 | RUN wget https://github.com/etcd-io/etcd/releases/download/${ETCD_VERSION}/etcd-${ETCD_VERSION}-linux-amd64.tar.gz \ 33 | && tar -zxvf etcd-${ETCD_VERSION}-linux-amd64.tar.gz \ 34 | && mv etcd-${ETCD_VERSION}-linux-amd64/* /usr/bin/ \ 35 | && rm /usr/local/openresty/bin/etcdctl 36 | 37 | 38 | WORKDIR /usr/local/apisix 39 | 40 | ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin 41 | 42 | EXPOSE 9180 9080 9443 2379 2380 43 | 44 | CMD ["sh", "-c", "(nohup etcd >/tmp/etcd.log 2>&1 &) && sleep 10 && /usr/bin/apisix init && /usr/bin/apisix init_etcd && /usr/local/openresty/bin/openresty -p /usr/local/apisix -g 'daemon off;'"] 45 | 46 | STOPSIGNAL SIGQUIT 47 | -------------------------------------------------------------------------------- /all-in-one/apisix/config.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | apisix: 19 | node_listen: 9080 # APISIX listening port 20 | enable_ipv6: false 21 | 22 | deployment: 23 | admin: 24 | allow_admin: # https://nginx.org/en/docs/http/ngx_http_access_module.html#allow 25 | - 0.0.0.0/0 # We need to restrict ip access rules for security. 0.0.0.0/0 is for test. 26 | 27 | admin_key: 28 | - name: "admin" 29 | key: edd1c9f034335f136f87ad84b625c8f1 30 | role: admin # admin: manage all configuration data 31 | 32 | plugin_attr: 33 | prometheus: 34 | export_addr: 35 | ip: "0.0.0.0" 36 | port: 9091 37 | -------------------------------------------------------------------------------- /compose/apisix_conf/master/config.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | apisix: 19 | node_listen: 9080 # APISIX listening port 20 | enable_ipv6: false 21 | 22 | deployment: 23 | admin: 24 | allow_admin: # https://nginx.org/en/docs/http/ngx_http_access_module.html#allow 25 | - 0.0.0.0/0 # We need to restrict ip access rules for security. 0.0.0.0/0 is for test. 26 | 27 | admin_key: 28 | - name: "admin" 29 | key: edd1c9f034335f136f87ad84b625c8f1 30 | role: admin # admin: manage all configuration data 31 | 32 | etcd: 33 | host: # it's possible to define multiple etcd hosts addresses of the same etcd cluster. 34 | - "http://etcd:2379" # multiple etcd address 35 | prefix: "/apisix" # apisix configurations prefix 36 | timeout: 30 # 30 seconds 37 | -------------------------------------------------------------------------------- /compose/apisix_conf/release/config.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | apisix: 19 | node_listen: 9080 # APISIX listening port 20 | enable_ipv6: false 21 | 22 | deployment: 23 | admin: 24 | allow_admin: # https://nginx.org/en/docs/http/ngx_http_access_module.html#allow 25 | - 0.0.0.0/0 # We need to restrict ip access rules for security. 0.0.0.0/0 is for test. 26 | 27 | admin_key: 28 | - name: "admin" 29 | key: edd1c9f034335f136f87ad84b625c8f1 30 | role: admin # admin: manage all configuration data 31 | 32 | etcd: 33 | host: # it's possible to define multiple etcd hosts addresses of the same etcd cluster. 34 | - "http://etcd:2379" # multiple etcd address 35 | prefix: "/apisix" # apisix configurations prefix 36 | timeout: 30 # 30 seconds 37 | -------------------------------------------------------------------------------- /compose/dashboard-compose.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | version: "3" 19 | 20 | services: 21 | dashboard: 22 | image: "apache/apisix-dashboard:${APISIX_DASHBOARD_VERSION}" 23 | restart: always 24 | volumes: 25 | - ../example/dashboard_conf/conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml:ro 26 | depends_on: 27 | - etcd 28 | ports: 29 | - "9000:9000/tcp" 30 | networks: 31 | - apisix 32 | 33 | etcd: 34 | image: bitnami/etcd:3.4.9 35 | user: root 36 | restart: always 37 | volumes: 38 | - ../example/etcd_data:/etcd_data 39 | environment: 40 | ETCD_DATA_DIR: /etcd_data 41 | ETCD_ENABLE_V2: "true" 42 | ALLOW_NONE_AUTHENTICATION: "yes" 43 | ETCD_ADVERTISE_CLIENT_URLS: "http://etcd:2379" 44 | ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379" 45 | ports: 46 | - "2379:2379/tcp" 47 | networks: 48 | - apisix 49 | 50 | networks: 51 | apisix: 52 | driver: bridge 53 | -------------------------------------------------------------------------------- /compose/docker-compose-master.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | version: "3" 19 | 20 | services: 21 | apisix: 22 | image: "apache/apisix:${APISIX_DOCKER_TAG}" 23 | restart: always 24 | volumes: 25 | - ./apisix_conf/master/config.yaml:/usr/local/apisix/conf/config.yaml:ro 26 | depends_on: 27 | - etcd 28 | ports: 29 | - "9180:9180/tcp" 30 | - "9080:9080/tcp" 31 | - "9091:9091/tcp" 32 | - "9443:9443/tcp" 33 | networks: 34 | - apisix 35 | 36 | etcd: 37 | image: bitnami/etcd:3.4.9 38 | user: root 39 | restart: always 40 | volumes: 41 | - ../example/etcd_data:/etcd_data 42 | environment: 43 | ETCD_DATA_DIR: /etcd_data 44 | ETCD_ENABLE_V2: "true" 45 | ALLOW_NONE_AUTHENTICATION: "yes" 46 | ETCD_ADVERTISE_CLIENT_URLS: "http://etcd:2379" 47 | ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379" 48 | ports: 49 | - "2379:2379/tcp" 50 | networks: 51 | - apisix 52 | 53 | networks: 54 | apisix: 55 | driver: bridge 56 | -------------------------------------------------------------------------------- /compose/docker-compose-release.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | version: "3" 19 | 20 | services: 21 | apisix: 22 | image: "apache/apisix:${APISIX_DOCKER_TAG}" 23 | restart: always 24 | volumes: 25 | - ./apisix_conf/release/config.yaml:/usr/local/apisix/conf/config.yaml:ro 26 | depends_on: 27 | - etcd 28 | ports: 29 | - "9180:9180/tcp" 30 | - "9080:9080/tcp" 31 | - "9091:9091/tcp" 32 | - "9443:9443/tcp" 33 | networks: 34 | - apisix 35 | 36 | etcd: 37 | image: bitnami/etcd:3.4.9 38 | user: root 39 | restart: always 40 | volumes: 41 | - ../example/etcd_data:/etcd_data 42 | environment: 43 | ETCD_DATA_DIR: /etcd_data 44 | ETCD_ENABLE_V2: "true" 45 | ALLOW_NONE_AUTHENTICATION: "yes" 46 | ETCD_ADVERTISE_CLIENT_URLS: "http://etcd:2379" 47 | ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379" 48 | ports: 49 | - "2379:2379/tcp" 50 | networks: 51 | - apisix 52 | 53 | networks: 54 | apisix: 55 | driver: bridge -------------------------------------------------------------------------------- /dashboard/Dockerfile.alpine: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | ARG BUILDPLATFORM=amd64 18 | 19 | FROM --platform=$BUILDPLATFORM alpine:latest as pre-build 20 | 21 | ARG APISIX_DASHBOARD_TAG=v3.0.1 22 | 23 | RUN set -x \ 24 | && apk add --no-cache --virtual .builddeps git \ 25 | && git clone https://github.com/apache/apisix-dashboard.git -b ${APISIX_DASHBOARD_TAG} /usr/local/apisix-dashboard \ 26 | && cd /usr/local/apisix-dashboard && git clean -Xdf \ 27 | && rm -f ./.githash && git log --pretty=format:"%h" -1 > ./.githash \ 28 | && rm /usr/local/openresty/bin/etcdctl 29 | 30 | FROM --platform=$BUILDPLATFORM golang:1.19 as api-builder 31 | 32 | ARG ENABLE_PROXY=false 33 | 34 | WORKDIR /usr/local/apisix-dashboard 35 | 36 | COPY --from=pre-build /usr/local/apisix-dashboard . 37 | 38 | ARG TARGETOS 39 | ARG TARGETARCH 40 | 41 | RUN if [ "$ENABLE_PROXY" = "true" ] ; then go env -w GOPROXY=https://goproxy.io,direct ; fi \ 42 | && go env -w GO111MODULE=on \ 43 | && CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} ./api/build.sh 44 | 45 | FROM --platform=$BUILDPLATFORM node:14-alpine as fe-builder 46 | 47 | ARG ENABLE_PROXY=false 48 | 49 | WORKDIR /usr/local/apisix-dashboard 50 | 51 | COPY --from=pre-build /usr/local/apisix-dashboard . 52 | 53 | WORKDIR /usr/local/apisix-dashboard/web 54 | 55 | RUN if [ "$ENABLE_PROXY" = "true" ] ; then yarn config set registry https://registry.npm.taobao.org/ ; fi \ 56 | && yarn install \ 57 | && yarn build 58 | 59 | FROM alpine:latest as prod 60 | 61 | WORKDIR /usr/local/apisix-dashboard 62 | 63 | COPY --from=api-builder /usr/local/apisix-dashboard/output/ ./ 64 | 65 | COPY --from=fe-builder /usr/local/apisix-dashboard/output/ ./ 66 | 67 | RUN mkdir logs 68 | 69 | EXPOSE 9000 70 | 71 | ENTRYPOINT [ "/usr/local/apisix-dashboard/manager-api" ] 72 | -------------------------------------------------------------------------------- /dashboard/README.md: -------------------------------------------------------------------------------- 1 | ### build command 2 | 3 | ```shell 4 | $ docker build --build-arg APISIX_DASHBOARD_VERSION=$APISIX_DASHBOARD_VERSION -t $IMAGE_NAME . 5 | ``` 6 | 7 | Note: The minimum version of docker that supports building image is `docker 17.05.0-ce`. 8 | -------------------------------------------------------------------------------- /debian-dev/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | FROM api7/apisix-runtime:dev AS build 19 | 20 | ARG ENABLE_PROXY=false 21 | 22 | ENV DEBIAN_FRONTEND noninteractive 23 | 24 | RUN set -x \ 25 | && (test "${ENABLE_PROXY}" != "true" || /bin/sed -i 's,http://deb.debian.org,https://mirrors.aliyun.com,g' /etc/apt/sources.list) \ 26 | && apt-get -y update --fix-missing \ 27 | && apt-get install -y curl \ 28 | gawk \ 29 | git \ 30 | libldap2-dev \ 31 | liblua5.1-0-dev \ 32 | lua5.1 \ 33 | make \ 34 | sudo \ 35 | unzip \ 36 | wget \ 37 | libyaml-dev \ 38 | && curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | bash - \ 39 | && luarocks install https://raw.githubusercontent.com/apache/apisix/master/apisix-master-0.rockspec --tree=/usr/local/apisix/deps PCRE_DIR=/usr/local/openresty/pcre \ 40 | && cp -v /usr/local/apisix/deps/lib/luarocks/rocks-5.1/apisix/master-0/bin/apisix /usr/bin/ \ 41 | && mv /usr/local/apisix/deps/share/lua/5.1/apisix /usr/local/apisix \ 42 | # forward request and error logs to docker log collector 43 | && ln -sf /dev/stdout /usr/local/apisix/logs/access.log \ 44 | && ln -sf /dev/stderr /usr/local/apisix/logs/error.log 45 | 46 | FROM api7/apisix-runtime:dev AS production-stage 47 | 48 | # Install the runtime libyaml package 49 | RUN apt-get -y update --fix-missing \ 50 | && apt-get install -y libldap2-dev libyaml-0-2 \ 51 | && apt-get remove --purge --auto-remove -y 52 | 53 | COPY --from=build /usr/local/apisix /usr/local/apisix 54 | COPY --from=build /usr/bin/apisix /usr/bin/apisix 55 | 56 | ENV DEBIAN_FRONTEND noninteractive 57 | RUN apt-get -y update --fix-missing \ 58 | && apt-get install -y \ 59 | libldap2-dev \ 60 | && apt-get remove --purge --auto-remove -y 61 | 62 | COPY ./install-brotli.sh /install-brotli.sh 63 | RUN chmod +x /install-brotli.sh \ 64 | && cd / && ./install-brotli.sh && rm -rf /install-brotli.sh 65 | 66 | WORKDIR /usr/local/apisix 67 | 68 | ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin 69 | 70 | EXPOSE 9080 9443 71 | 72 | COPY ./docker-entrypoint.sh /docker-entrypoint.sh 73 | COPY ./check_standalone_config.sh /check_standalone_config.sh 74 | 75 | ENTRYPOINT ["/docker-entrypoint.sh"] 76 | 77 | CMD ["docker-start"] 78 | 79 | 80 | STOPSIGNAL SIGQUIT 81 | -------------------------------------------------------------------------------- /debian-dev/Dockerfile.local: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # Use this dockerfile to create a docker image of your apisix local/patched codebase 19 | 20 | FROM debian:bullseye-slim AS build 21 | 22 | ARG ENABLE_PROXY=false 23 | ARG CODE_PATH 24 | 25 | ENV DEBIAN_FRONTEND noninteractive 26 | ENV ENV_INST_LUADIR /usr/local/apisix 27 | 28 | COPY ${CODE_PATH} /apisix 29 | 30 | WORKDIR /apisix 31 | 32 | RUN set -x \ 33 | && apt-get -y update --fix-missing \ 34 | && apt-get install -y \ 35 | make \ 36 | git \ 37 | sudo \ 38 | libyaml-dev \ 39 | && ls -al \ 40 | && make deps \ 41 | && mkdir -p ${ENV_INST_LUADIR} \ 42 | && cp -r deps ${ENV_INST_LUADIR} \ 43 | && make install 44 | 45 | FROM debian:bullseye-slim 46 | 47 | ARG ENTRYPOINT_PATH=./docker-entrypoint.sh 48 | ARG INSTALL_BROTLI=./install-brotli.sh 49 | 50 | COPY --from=build /usr/local/apisix /usr/local/apisix 51 | COPY --from=build /usr/local/openresty /usr/local/openresty 52 | COPY --from=build /usr/bin/apisix /usr/bin/apisix 53 | COPY --from=build /usr/lib/x86_64-linux-gnu/libyaml* /usr/local/lib/ 54 | 55 | COPY ${INSTALL_BROTLI} /install-brotli.sh 56 | RUN chmod +x /install-brotli.sh \ 57 | && cd / && ./install-brotli.sh && rm -rf /install-brotli.sh 58 | 59 | ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin 60 | 61 | WORKDIR /usr/local/apisix 62 | 63 | RUN ln -sf /dev/stdout /usr/local/apisix/logs/access.log \ 64 | && ln -sf /dev/stderr /usr/local/apisix/logs/error.log 65 | 66 | EXPOSE 9080 9443 67 | 68 | COPY ${ENTRYPOINT_PATH} /docker-entrypoint.sh 69 | COPY ../utils/check_standalone_config.sh /check_standalone_config.sh 70 | 71 | ENTRYPOINT ["/docker-entrypoint.sh"] 72 | 73 | CMD ["docker-start"] 74 | 75 | STOPSIGNAL SIGQUIT 76 | -------------------------------------------------------------------------------- /debian-dev/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | set -eo pipefail 20 | 21 | PREFIX=${APISIX_PREFIX:=/usr/local/apisix} 22 | 23 | if [[ "$1" == "docker-start" ]]; then 24 | if [ "$APISIX_STAND_ALONE" = "true" ]; then 25 | # If the file is not present then initialise the content otherwise update relevant keys for standalone mode 26 | if [ ! -f "${PREFIX}/conf/config.yaml" ]; then 27 | cat > ${PREFIX}/conf/config.yaml << _EOC_ 28 | deployment: 29 | role: data_plane 30 | role_data_plane: 31 | config_provider: yaml 32 | _EOC_ 33 | else 34 | # Check if the deployment role is set to data_plane and config provider is set to yaml for standalone mode 35 | source /check_standalone_config.sh 36 | fi 37 | 38 | if [ ! -f "${PREFIX}/conf/apisix.yaml" ]; then 39 | cat > ${PREFIX}/conf/apisix.yaml << _EOC_ 40 | routes: 41 | - 42 | #END 43 | _EOC_ 44 | fi 45 | /usr/bin/apisix init 46 | else 47 | /usr/bin/apisix init 48 | /usr/bin/apisix init_etcd 49 | fi 50 | 51 | # For versions below 3.5.0 whose conf_server has not been removed. 52 | if [ -e "/usr/local/apisix/conf/config_listen.sock" ]; then 53 | rm -f "/usr/local/apisix/conf/config_listen.sock" 54 | fi 55 | 56 | if [ -e "/usr/local/apisix/logs/worker_events.sock" ]; then 57 | rm -f "/usr/local/apisix/logs/worker_events.sock" 58 | fi 59 | 60 | exec /usr/local/openresty/bin/openresty -p /usr/local/apisix -g 'daemon off;' 61 | fi 62 | 63 | exec "$@" 64 | -------------------------------------------------------------------------------- /debian-dev/install-brotli.sh: -------------------------------------------------------------------------------- 1 | install_brotli () { 2 | apt-get -qy update 3 | apt-get install -y sudo cmake wget unzip 4 | local BORTLI_VERSION="1.1.0" 5 | wget -q https://github.com/google/brotli/archive/refs/tags/v${BORTLI_VERSION}.zip || exit -1 6 | unzip v${BORTLI_VERSION}.zip && cd ./brotli-${BORTLI_VERSION} && mkdir build && cd build || exit -1 7 | local CMAKE=$(command -v cmake3 > /dev/null 2>&1 && echo cmake3 || echo cmake) || exit -1 8 | ${CMAKE} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/brotli .. || exit -1 9 | sudo ${CMAKE} --build . --config Release --target install || exit -1 10 | if [ -d "/usr/local/brotli/lib64" ]; then 11 | echo /usr/local/brotli/lib64 | sudo tee /etc/ld.so.conf.d/brotli.conf 12 | else 13 | echo /usr/local/brotli/lib | sudo tee /etc/ld.so.conf.d/brotli.conf 14 | fi 15 | sudo ldconfig || exit -1 16 | ln -sf /usr/local/brotli/bin/brotli /usr/bin/brotli 17 | cd ../.. 18 | rm -rf brotli-${BORTLI_VERSION} 19 | rm -rf /v${BORTLI_VERSION}.zip 20 | export SUDO_FORCE_REMOVE=yes 21 | apt purge -qy cmake sudo wget unzip 22 | apt-get remove --purge --auto-remove -y 23 | } 24 | install_brotli -------------------------------------------------------------------------------- /debian/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | FROM debian:bullseye-slim 19 | 20 | ARG APISIX_VERSION=3.12.0 21 | 22 | RUN set -ex; \ 23 | arch=$(dpkg --print-architecture); \ 24 | apt update; \ 25 | apt-get -y install --no-install-recommends wget gnupg ca-certificates curl;\ 26 | codename=`grep -Po 'VERSION="[0-9]+ \(\K[^)]+' /etc/os-release`; \ 27 | case "${arch}" in \ 28 | amd64) \ 29 | wget -O - https://repos.apiseven.com/pubkey.gpg | apt-key add - \ 30 | && echo "deb https://repos.apiseven.com/packages/debian $codename main" | tee /etc/apt/sources.list.d/apisix.list \ 31 | ;; \ 32 | arm64) \ 33 | wget -O - https://repos.apiseven.com/pubkey.gpg | apt-key add - \ 34 | && echo "deb https://repos.apiseven.com/packages/arm64/debian $codename main" | tee /etc/apt/sources.list.d/apisix.list \ 35 | ;; \ 36 | esac; \ 37 | apt update \ 38 | && apt install -y apisix=${APISIX_VERSION}-0 \ 39 | && apt-get purge -y --auto-remove \ 40 | && rm /usr/local/openresty/bin/etcdctl \ 41 | && openresty -V \ 42 | && apisix version 43 | 44 | COPY ./install-brotli.sh /install-brotli.sh 45 | RUN chmod +x /install-brotli.sh \ 46 | && cd / && ./install-brotli.sh && rm -rf /install-brotli.sh 47 | 48 | RUN apt-get -y purge --auto-remove curl wget gnupg --allow-remove-essential 49 | 50 | WORKDIR /usr/local/apisix 51 | 52 | ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin 53 | 54 | RUN groupadd --system --gid 636 apisix \ 55 | && useradd --system --gid apisix --no-create-home --shell /usr/sbin/nologin --uid 636 apisix \ 56 | && chown -R apisix:apisix /usr/local/apisix 57 | 58 | USER apisix 59 | 60 | # forward request and error logs to docker log collector 61 | RUN ln -sf /dev/stdout /usr/local/apisix/logs/access.log \ 62 | && ln -sf /dev/stderr /usr/local/apisix/logs/error.log 63 | 64 | EXPOSE 9080 9443 65 | 66 | COPY ./docker-entrypoint.sh /docker-entrypoint.sh 67 | COPY ./check_standalone_config.sh /check_standalone_config.sh 68 | 69 | ENTRYPOINT ["/docker-entrypoint.sh"] 70 | 71 | CMD ["docker-start"] 72 | 73 | 74 | STOPSIGNAL SIGQUIT 75 | -------------------------------------------------------------------------------- /debian/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | set -eo pipefail 20 | 21 | PREFIX=${APISIX_PREFIX:=/usr/local/apisix} 22 | 23 | if [[ "$1" == "docker-start" ]]; then 24 | if [ "$APISIX_STAND_ALONE" = "true" ]; then 25 | # If the file is not present then initialise the content otherwise update relevant keys for standalone mode 26 | if [ ! -f "${PREFIX}/conf/config.yaml" ]; then 27 | cat > ${PREFIX}/conf/config.yaml << _EOC_ 28 | deployment: 29 | role: data_plane 30 | role_data_plane: 31 | config_provider: yaml 32 | _EOC_ 33 | else 34 | # Check if the deployment role is set to data_plane and config provider is set to yaml for standalone mode 35 | source /check_standalone_config.sh 36 | fi 37 | 38 | if [ ! -f "${PREFIX}/conf/apisix.yaml" ]; then 39 | cat > ${PREFIX}/conf/apisix.yaml << _EOC_ 40 | routes: 41 | - 42 | #END 43 | _EOC_ 44 | fi 45 | /usr/bin/apisix init 46 | else 47 | /usr/bin/apisix init 48 | /usr/bin/apisix init_etcd 49 | fi 50 | 51 | # For versions below 3.5.0 whose conf_server has not been removed. 52 | if [ -e "/usr/local/apisix/conf/config_listen.sock" ]; then 53 | rm -f "/usr/local/apisix/conf/config_listen.sock" 54 | fi 55 | 56 | if [ -e "/usr/local/apisix/logs/worker_events.sock" ]; then 57 | rm -f "/usr/local/apisix/logs/worker_events.sock" 58 | fi 59 | 60 | exec /usr/local/openresty/bin/openresty -p /usr/local/apisix -g 'daemon off;' 61 | fi 62 | 63 | exec "$@" 64 | -------------------------------------------------------------------------------- /debian/install-brotli.sh: -------------------------------------------------------------------------------- 1 | install_brotli () { 2 | apt-get install -y sudo cmake wget unzip 3 | local BORTLI_VERSION="1.1.0" 4 | wget -q https://github.com/google/brotli/archive/refs/tags/v${BORTLI_VERSION}.zip || exit -1 5 | unzip v${BORTLI_VERSION}.zip && cd ./brotli-${BORTLI_VERSION} && mkdir build && cd build || exit -1 6 | local CMAKE=$(command -v cmake3 > /dev/null 2>&1 && echo cmake3 || echo cmake) || exit -1 7 | ${CMAKE} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/brotli .. || exit -1 8 | sudo ${CMAKE} --build . --config Release --target install || exit -1 9 | if [ -d "/usr/local/brotli/lib64" ]; then 10 | echo /usr/local/brotli/lib64 | sudo tee /etc/ld.so.conf.d/brotli.conf 11 | else 12 | echo /usr/local/brotli/lib | sudo tee /etc/ld.so.conf.d/brotli.conf 13 | fi 14 | sudo ldconfig || exit -1 15 | ln -sf /usr/local/brotli/bin/brotli /usr/bin/brotli 16 | cd ../.. 17 | rm -rf brotli-${BORTLI_VERSION} 18 | rm -rf /v${BORTLI_VERSION}.zip 19 | export SUDO_FORCE_REMOVE=yes 20 | apt purge -qy cmake sudo wget unzip 21 | apt-get remove --purge --auto-remove -y 22 | } 23 | install_brotli -------------------------------------------------------------------------------- /docs/en/latest/build.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Build an image from the source codes 3 | --- 4 | 5 | 23 | 24 | **Docker images are not official ASF releases but provided for convenience. Recommended usage is always to build the source.** 25 | 26 | ## Clone the repository 27 | 28 | Clone the [apisix-docker](https://github.com/apache/apisix-docker) repository and navigate into the project directory: 29 | 30 | ```shell 31 | git clone https://github.com/apache/apisix-docker.git 32 | cd apisix-docker 33 | ``` 34 | 35 | ## Build a Docker image 36 | 37 | Choose one of the following approaches to build a Docker image based on your requirements. 38 | 39 | ### Build an image from a release 40 | 41 | Find an APISIX [release version](https://github.com/apache/apisix/releases) to build an image of. 42 | 43 | Build a Docker image from the release: 44 | 45 | ```shell 46 | APISIX_VERSION=3.12.0 # specify release version 47 | DISTRO=debian # debian, redhat 48 | make build-on-$DISTRO 49 | ``` 50 | 51 | ### Build an image from master branch 52 | 53 | This is provided for developer's convenience. 54 | 55 | Build a Docker image from the master branch: 56 | 57 | ```shell 58 | APISIX_VERSION=master # master branch 59 | DISTRO=debian # debian, redhat 60 | make build-on-$DISTRO 61 | ``` 62 | 63 | ### Build an image from locally customized/patched source code 64 | 65 | Build a Docker image from locally customized/patched source code with this [Dockerfile](https://github.com/apache/apisix-docker/blob/master/debian-dev/Dockerfile.local): 66 | 67 | ```shell 68 | docker build -t apisix-dev-local -f /path/to/debian-dev/Dockerfile.local . 69 | ``` 70 | 71 | ## Check Docker image 72 | 73 | Check the built Docker images: 74 | 75 | ```shell 76 | docker images 77 | ``` 78 | 79 | If the image was built successfully, you should see the image listed, similar to the following: 80 | 81 | ```text 82 | REPOSITORY TAG IMAGE ID CREATED SIZE 83 | apache/apisix 3.5.0-debian 5c3b6ffdef06 About a minute ago 337MB 84 | ``` 85 | -------------------------------------------------------------------------------- /docs/en/latest/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1.0, 3 | "sidebar": [ 4 | { 5 | "type": "category", 6 | "label": "Installation", 7 | "items": [ "build", "manual", "example"] 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /docs/en/latest/example.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Example 3 | --- 4 | 5 | 23 | 24 | **This example is used for functional verification and is not recommended for performance testing. For performance testing, please refer to [benchmark](https://github.com/apache/apisix#benchmark).** 25 | 26 | ### Run 27 | 28 | ``` 29 | docker-compose -d 30 | ``` 31 | 32 | ### Configure 33 | 34 | ``` 35 | curl http://127.0.0.1:9180/apisix/admin/services/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' 36 | { 37 | "upstream": { 38 | "type": "roundrobin", 39 | "nodes": { 40 | "web1:80": 1 41 | } 42 | } 43 | }' 44 | 45 | curl http://127.0.0.1:9180/apisix/admin/services/2 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' 46 | { 47 | "upstream": { 48 | "type": "roundrobin", 49 | "nodes": { 50 | "web2:80": 1 51 | } 52 | } 53 | }' 54 | 55 | curl http://127.0.0.1:9180/apisix/admin/routes/12 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' 56 | { 57 | "uri": "/*", 58 | "host": "web1.lvh.me", 59 | "service_id": "1" 60 | }' 61 | 62 | curl http://127.0.0.1:9180/apisix/admin/routes/22 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' 63 | { 64 | "uri": "/*", 65 | "host": "web2.lvh.me", 66 | "service_id": "2" 67 | }' 68 | 69 | curl http://127.0.0.1:9180/apisix/admin/ssl/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d " 70 | { 71 | \"cert\": \"$( cat './mkcert/lvh.me+1.pem')\", 72 | \"key\": \"$( cat './mkcert/lvh.me+1-key.pem')\", 73 | \"sni\": \"lvh.me\" 74 | }" 75 | 76 | curl http://127.0.0.1:9180/apisix/admin/ssl/2 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d " 77 | { 78 | \"cert\": \"$( cat './mkcert/lvh.me+1.pem')\", 79 | \"key\": \"$( cat './mkcert/lvh.me+1-key.pem')\", 80 | \"sni\": \"*.lvh.me\" 81 | }" 82 | ``` 83 | 84 | ### Test 85 | 86 | When testing subdomains, using localhost is not a good option. Due to this, lets use [http://lvh.me/](http://lvh.me/) 87 | free service to resolve itself along with all subdomains to localhost. 88 | 89 | ``` 90 | curl http://web1.lvh.me:9080/hello -v # hello web1 91 | 92 | curl http://web2.lvh.me:9080/hello -v # hello web2 93 | ``` 94 | 95 | ``` 96 | curl https://web1.lvh.me:9443/ -v --cacert ./mkcert/rootCA.pem 97 | ``` 98 | 99 | ### Clean 100 | 101 | ``` 102 | docker-compose down 103 | 104 | sudo rm -rf etcd_data/member 105 | 106 | rm -rf apisix_log/*.log 107 | ``` 108 | -------------------------------------------------------------------------------- /docs/en/latest/manual.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Deploy Apache APISIX with Docker 3 | --- 4 | 5 | 23 | 24 | ## Manual deploy apisix via docker 25 | 26 | ### Create a network `apisix` 27 | 28 | ``` 29 | docker network create \ 30 | --driver=bridge \ 31 | --subnet=172.18.0.0/16 \ 32 | --ip-range=172.18.5.0/24 \ 33 | --gateway=172.18.5.254 \ 34 | apisix 35 | ``` 36 | 37 | ### Run etcd server with `apisix` network 38 | 39 | Specify ip `172.18.5.10` 40 | 41 | ``` 42 | docker run -it --name etcd-server \ 43 | -v `pwd`/example/etcd_conf/etcd.conf.yml:/opt/bitnami/etcd/conf/etcd.conf.yml \ 44 | -p 2379:2379 \ 45 | -p 2380:2380 \ 46 | --network apisix \ 47 | --ip 172.18.5.10 \ 48 | --env ALLOW_NONE_AUTHENTICATION=yes bitnami/etcd:3.4.9 49 | ``` 50 | 51 | > Note: 52 | > 53 | > 1. Windows OS use absolute paths to hang in the configuration file. 54 | > 2. e.g:Windows dir path `E:\GitHub\docker-apisix`,configuration file hang path is `-v /e/github/docker-apisix/example/etcd_conf/etcd.conf.yml:/opt/bitnami/etcd/conf/etcd.conf.yml` 55 | 56 | ### Run Apache APISIX server 57 | 58 | You need etcd docker to work with Apache APISIX. You can refer to [the docker-compose example](example.md). 59 | 60 | Or you can run APISIX with Docker directly(Docker name is test-api-gateway): 61 | 62 | Check or Modify etcd address to `http: //172.18.5.10:2379` in `pwd` / example / apisix_conf / config.yaml: /usr/local/apisix/conf/config.yaml 63 | 64 | ``` 65 | docker run --name test-api-gateway \ 66 | -v `pwd`/example/apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml \ 67 | -v `pwd`/example/apisix_log:/usr/local/apisix/logs \ 68 | -p 9080:9080 \ 69 | -p 9091:9091 \ 70 | -p 9443:9443 \ 71 | --network apisix \ 72 | --ip 172.18.5.11 \ 73 | -d apache/apisix 74 | ``` 75 | 76 | > Note: 77 | > 78 | > 1. Windows OS use absolute paths to hang in the configuration file and log dir. 79 | > 80 | 81 | ### Have a test 82 | 83 | Test with admin api 84 | 85 | e.g. Get route list, should be return 86 | 87 | ``` 88 | curl http://127.0.0.1:9080/apisix/admin/routes/ 89 | ... 90 | {"node":{"createdIndex":4,"modifiedIndex":4,"key":"\/apisix\/routes","dir":true},"action":"get"} 91 | ``` 92 | 93 | ### Clean 94 | 95 | ``` 96 | docker rm test-api-gateway 97 | docker rm etcd-server 98 | docker network rm apisix 99 | ``` 100 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | /apisix_log/* 2 | !/apisix_log/.keep 3 | 4 | /etcd_data/* 5 | !/etcd_data/.keep 6 | -------------------------------------------------------------------------------- /example/apisix_conf/apisix-standalone.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | routes: 19 | - 20 | uri: /get 21 | upstream: 22 | nodes: 23 | "web1:80": 1 24 | type: roundrobin 25 | #END 26 | -------------------------------------------------------------------------------- /example/apisix_conf/config-standalone.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | apisix: 19 | node_listen: 9080 # APISIX listening port 20 | enable_ipv6: false 21 | 22 | deployment: 23 | role: data_plane 24 | role_data_plane: 25 | config_provider: yaml 26 | -------------------------------------------------------------------------------- /example/apisix_conf/config.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | apisix: 19 | node_listen: 9080 # APISIX listening port 20 | enable_ipv6: false 21 | 22 | enable_control: true 23 | control: 24 | ip: "0.0.0.0" 25 | port: 9092 26 | 27 | deployment: 28 | admin: 29 | allow_admin: # https://nginx.org/en/docs/http/ngx_http_access_module.html#allow 30 | - 0.0.0.0/0 # We need to restrict ip access rules for security. 0.0.0.0/0 is for test. 31 | 32 | admin_key: 33 | - name: "admin" 34 | key: edd1c9f034335f136f87ad84b625c8f1 35 | role: admin # admin: manage all configuration data 36 | 37 | - name: "viewer" 38 | key: 4054f7cf07e344346cd3f287985e76a2 39 | role: viewer 40 | 41 | etcd: 42 | host: # it's possible to define multiple etcd hosts addresses of the same etcd cluster. 43 | - "http://etcd:2379" # multiple etcd address 44 | prefix: "/apisix" # apisix configurations prefix 45 | timeout: 30 # 30 seconds 46 | 47 | plugin_attr: 48 | prometheus: 49 | export_addr: 50 | ip: "0.0.0.0" 51 | port: 9091 52 | -------------------------------------------------------------------------------- /example/docker-compose-arm64.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | version: "3" 19 | 20 | services: 21 | apisix: 22 | image: apache/apisix:3.12.0-debian 23 | restart: always 24 | volumes: 25 | - ./apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro 26 | depends_on: 27 | - etcd 28 | ports: 29 | - "9180:9180/tcp" 30 | - "9080:9080/tcp" 31 | - "9091:9091/tcp" 32 | - "9443:9443/tcp" 33 | - "9092:9092/tcp" 34 | networks: 35 | apisix: 36 | 37 | etcd: 38 | image: rancher/coreos-etcd:v3.4.15-arm64 39 | user: root 40 | restart: always 41 | volumes: 42 | - ./etcd_data:/etcd-data 43 | environment: 44 | ETCD_UNSUPPORTED_ARCH: "arm64" 45 | ETCD_ENABLE_V2: "true" 46 | ALLOW_NONE_AUTHENTICATION: "yes" 47 | ETCD_ADVERTISE_CLIENT_URLS: "http://etcd:2379" 48 | ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379" 49 | ETCD_DATA_DIR: "/etcd-data" 50 | ports: 51 | - "2379:2379/tcp" 52 | networks: 53 | apisix: 54 | 55 | web1: 56 | image: nginx:1.19.10-alpine 57 | restart: always 58 | volumes: 59 | - ./upstream/web1.conf:/etc/nginx/nginx.conf 60 | ports: 61 | - "9081:80/tcp" 62 | environment: 63 | - NGINX_PORT=80 64 | networks: 65 | apisix: 66 | 67 | web2: 68 | image: nginx:1.19.10-alpine 69 | restart: always 70 | volumes: 71 | - ./upstream/web2.conf:/etc/nginx/nginx.conf 72 | ports: 73 | - "9082:80/tcp" 74 | environment: 75 | - NGINX_PORT=80 76 | networks: 77 | apisix: 78 | 79 | networks: 80 | apisix: 81 | driver: bridge 82 | -------------------------------------------------------------------------------- /example/docker-compose-standalone.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | version: "3" 19 | 20 | services: 21 | apisix: 22 | image: apache/apisix:${APISIX_IMAGE_TAG:-3.12.0-debian} 23 | restart: always 24 | volumes: 25 | - ./apisix_conf/apisix-standalone.yaml:/usr/local/apisix/conf/apisix.yaml:ro 26 | - ./apisix_conf/config-standalone.yaml:/usr/local/apisix/conf/config.yaml:ro 27 | environment: 28 | - APISIX_STAND_ALONE=true 29 | ports: 30 | - "9180:9180/tcp" 31 | - "9080:9080/tcp" 32 | - "9091:9091/tcp" 33 | - "9443:9443/tcp" 34 | - "9092:9092/tcp" 35 | networks: 36 | apisix: 37 | 38 | web1: 39 | image: nginx:1.19.0-alpine 40 | restart: always 41 | volumes: 42 | - ./upstream/web1.conf:/etc/nginx/nginx.conf 43 | ports: 44 | - "9081:80/tcp" 45 | environment: 46 | - NGINX_PORT=80 47 | networks: 48 | apisix: 49 | 50 | 51 | networks: 52 | apisix: 53 | driver: bridge 54 | 55 | 56 | -------------------------------------------------------------------------------- /example/docker-compose.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | version: "3" 19 | 20 | services: 21 | apisix: 22 | image: apache/apisix:${APISIX_IMAGE_TAG:-3.12.0-debian} 23 | restart: always 24 | volumes: 25 | - ./apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro 26 | depends_on: 27 | - etcd 28 | ##network_mode: host 29 | ports: 30 | - "9180:9180/tcp" 31 | - "9080:9080/tcp" 32 | - "9091:9091/tcp" 33 | - "9443:9443/tcp" 34 | - "9092:9092/tcp" 35 | networks: 36 | apisix: 37 | 38 | etcd: 39 | image: bitnami/etcd:3.5.11 40 | restart: always 41 | volumes: 42 | - etcd_data:/bitnami/etcd 43 | environment: 44 | ETCD_ENABLE_V2: "true" 45 | ALLOW_NONE_AUTHENTICATION: "yes" 46 | ETCD_ADVERTISE_CLIENT_URLS: "http://etcd:2379" 47 | ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379" 48 | ports: 49 | - "2379:2379/tcp" 50 | networks: 51 | apisix: 52 | 53 | web1: 54 | image: nginx:1.19.0-alpine 55 | restart: always 56 | volumes: 57 | - ./upstream/web1.conf:/etc/nginx/nginx.conf 58 | ports: 59 | - "9081:80/tcp" 60 | environment: 61 | - NGINX_PORT=80 62 | networks: 63 | apisix: 64 | 65 | web2: 66 | image: nginx:1.19.0-alpine 67 | restart: always 68 | volumes: 69 | - ./upstream/web2.conf:/etc/nginx/nginx.conf 70 | ports: 71 | - "9082:80/tcp" 72 | environment: 73 | - NGINX_PORT=80 74 | networks: 75 | apisix: 76 | 77 | prometheus: 78 | image: prom/prometheus:v2.25.0 79 | restart: always 80 | volumes: 81 | - ./prometheus_conf/prometheus.yml:/etc/prometheus/prometheus.yml 82 | ports: 83 | - "9090:9090" 84 | networks: 85 | apisix: 86 | 87 | grafana: 88 | image: grafana/grafana:7.3.7 89 | restart: always 90 | ports: 91 | - "3000:3000" 92 | volumes: 93 | - "./grafana_conf/provisioning:/etc/grafana/provisioning" 94 | - "./grafana_conf/dashboards:/var/lib/grafana/dashboards" 95 | - "./grafana_conf/config/grafana.ini:/etc/grafana/grafana.ini" 96 | networks: 97 | apisix: 98 | 99 | networks: 100 | apisix: 101 | driver: bridge 102 | 103 | volumes: 104 | etcd_data: 105 | driver: local 106 | -------------------------------------------------------------------------------- /example/etcd_conf/etcd.conf.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # This is the configuration file for the etcd server. 19 | 20 | # Human-readable name for this member. 21 | name: 'default' 22 | 23 | # Path to the data directory. 24 | data-dir: 25 | 26 | # Path to the dedicated wal directory. 27 | wal-dir: 28 | 29 | # Number of committed transactions to trigger a snapshot to disk. 30 | snapshot-count: 10000 31 | 32 | # Time (in milliseconds) of a heartbeat interval. 33 | heartbeat-interval: 100 34 | 35 | # Time (in milliseconds) for an election to timeout. 36 | election-timeout: 1000 37 | 38 | # Raise alarms when backend size exceeds the given quota. 0 means use the 39 | # default quota. 40 | quota-backend-bytes: 0 41 | 42 | # List of comma separated URLs to listen on for peer traffic. 43 | listen-peer-urls: http://localhost:2380 44 | 45 | # List of comma separated URLs to listen on for client traffic. 46 | listen-client-urls: http://localhost:2379 47 | 48 | # Maximum number of snapshot files to retain (0 is unlimited). 49 | max-snapshots: 5 50 | 51 | # Maximum number of wal files to retain (0 is unlimited). 52 | max-wals: 5 53 | 54 | # Comma-separated white list of origins for CORS (cross-origin resource sharing). 55 | cors: 56 | 57 | # List of this member's peer URLs to advertise to the rest of the cluster. 58 | # The URLs needed to be a comma-separated list. 59 | initial-advertise-peer-urls: http://localhost:2380 60 | 61 | # List of this member's client URLs to advertise to the public. 62 | # The URLs needed to be a comma-separated list. 63 | advertise-client-urls: http://localhost:2379 64 | 65 | # Discovery URL used to bootstrap the cluster. 66 | discovery: 67 | 68 | # Valid values include 'exit', 'proxy' 69 | discovery-fallback: 'proxy' 70 | 71 | # HTTP proxy to use for traffic to discovery service. 72 | discovery-proxy: 73 | 74 | # DNS domain used to bootstrap initial cluster. 75 | discovery-srv: 76 | 77 | # Initial cluster configuration for bootstrapping. 78 | initial-cluster: 79 | 80 | # Initial cluster token for the etcd cluster during bootstrap. 81 | initial-cluster-token: 'etcd-cluster' 82 | 83 | # Initial cluster state ('new' or 'existing'). 84 | initial-cluster-state: 'new' 85 | 86 | # Reject reconfiguration requests that would cause quorum loss. 87 | strict-reconfig-check: false 88 | 89 | # Accept etcd V2 client requests 90 | enable-v2: true 91 | 92 | # Enable runtime profiling data via HTTP server 93 | enable-pprof: true 94 | 95 | # Valid values include 'on', 'readonly', 'off' 96 | proxy: 'off' 97 | 98 | # Time (in milliseconds) an endpoint will be held in a failed state. 99 | proxy-failure-wait: 5000 100 | 101 | # Time (in milliseconds) of the endpoints refresh interval. 102 | proxy-refresh-interval: 30000 103 | 104 | # Time (in milliseconds) for a dial to timeout. 105 | proxy-dial-timeout: 1000 106 | 107 | # Time (in milliseconds) for a write to timeout. 108 | proxy-write-timeout: 5000 109 | 110 | # Time (in milliseconds) for a read to timeout. 111 | proxy-read-timeout: 0 112 | 113 | client-transport-security: 114 | # Path to the client server TLS cert file. 115 | cert-file: 116 | 117 | # Path to the client server TLS key file. 118 | key-file: 119 | 120 | # Enable client cert authentication. 121 | client-cert-auth: false 122 | 123 | # Path to the client server TLS trusted CA cert file. 124 | trusted-ca-file: 125 | 126 | # Client TLS using generated certificates 127 | auto-tls: false 128 | 129 | peer-transport-security: 130 | # Path to the peer server TLS cert file. 131 | cert-file: 132 | 133 | # Path to the peer server TLS key file. 134 | key-file: 135 | 136 | # Enable peer client cert authentication. 137 | client-cert-auth: false 138 | 139 | # Path to the peer server TLS trusted CA cert file. 140 | trusted-ca-file: 141 | 142 | # Peer TLS using generated certificates. 143 | auto-tls: false 144 | 145 | # Enable debug-level logging for etcd. 146 | debug: false 147 | 148 | logger: zap 149 | 150 | # Specify 'stdout' or 'stderr' to skip journald logging even when running under systemd. 151 | log-outputs: [stderr] 152 | 153 | # Force to create a new one member cluster. 154 | force-new-cluster: false 155 | 156 | auto-compaction-mode: periodic 157 | auto-compaction-retention: "1" 158 | -------------------------------------------------------------------------------- /example/grafana_conf/config/grafana.ini: -------------------------------------------------------------------------------- 1 | ##################### Grafana Configuration Example ##################### 2 | # 3 | # Everything has defaults so you only need to uncomment things you want to 4 | # change 5 | 6 | # possible values : production, development 7 | ;app_mode = production 8 | 9 | # instance name, defaults to HOSTNAME environment variable value or hostname if HOSTNAME var is empty 10 | ;instance_name = ${HOSTNAME} 11 | 12 | #################################### Paths #################################### 13 | [paths] 14 | # Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used) 15 | ;data = /var/lib/grafana 16 | 17 | # Temporary files in `data` directory older than given duration will be removed 18 | ;temp_data_lifetime = 24h 19 | 20 | # Directory where grafana can store logs 21 | ;logs = /var/log/grafana 22 | 23 | # Directory where grafana will automatically scan and look for plugins 24 | ;plugins = /var/lib/grafana/plugins 25 | 26 | # folder that contains provisioning config files that grafana will apply on startup and while running. 27 | ;provisioning = conf/provisioning 28 | 29 | #################################### Server #################################### 30 | [server] 31 | # Protocol (http, https, h2, socket) 32 | ;protocol = http 33 | 34 | # The ip address to bind to, empty will bind to all interfaces 35 | ;http_addr = 36 | 37 | # The http port to use 38 | ;http_port = 3000 39 | 40 | # The public facing domain name used to access grafana from a browser 41 | ;domain = localhost 42 | 43 | # Redirect to correct domain if host header does not match domain 44 | # Prevents DNS rebinding attacks 45 | ;enforce_domain = false 46 | 47 | # The full public facing url you use in browser, used for redirects and emails 48 | # If you use reverse proxy and sub path specify full url (with sub path) 49 | ;root_url = %(protocol)s://%(domain)s:%(http_port)s/ 50 | 51 | # Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons. 52 | ;serve_from_sub_path = false 53 | 54 | # Log web requests 55 | ;router_logging = false 56 | 57 | # the path relative working path 58 | ;static_root_path = public 59 | 60 | # enable gzip 61 | ;enable_gzip = false 62 | 63 | # https certs & key file 64 | ;cert_file = 65 | ;cert_key = 66 | 67 | # Unix socket path 68 | ;socket = 69 | 70 | #################################### Database #################################### 71 | [database] 72 | # You can configure the database connection by specifying type, host, name, user and password 73 | # as separate properties or as on string using the url properties. 74 | 75 | # Either "mysql", "postgres" or "sqlite3", it's your choice 76 | ;type = sqlite3 77 | ;host = 127.0.0.1:3306 78 | ;name = grafana 79 | ;user = root 80 | # If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;""" 81 | ;password = 82 | 83 | # Use either URL or the previous fields to configure the database 84 | # Example: mysql://user:secret@host:port/database 85 | ;url = 86 | 87 | # For "postgres" only, either "disable", "require" or "verify-full" 88 | ;ssl_mode = disable 89 | 90 | ;ca_cert_path = 91 | ;client_key_path = 92 | ;client_cert_path = 93 | ;server_cert_name = 94 | 95 | # For "sqlite3" only, path relative to data_path setting 96 | ;path = grafana.db 97 | 98 | # Max idle conn setting default is 2 99 | ;max_idle_conn = 2 100 | 101 | # Max conn setting default is 0 (mean not set) 102 | ;max_open_conn = 103 | 104 | # Connection Max Lifetime default is 14400 (means 14400 seconds or 4 hours) 105 | ;conn_max_lifetime = 14400 106 | 107 | # Set to true to log the sql calls and execution times. 108 | ;log_queries = 109 | 110 | # For "sqlite3" only. cache mode setting used for connecting to the database. (private, shared) 111 | ;cache_mode = private 112 | 113 | #################################### Cache server ############################# 114 | [remote_cache] 115 | # Either "redis", "memcached" or "database" default is "database" 116 | ;type = database 117 | 118 | # cache connectionstring options 119 | # database: will use Grafana primary database. 120 | # redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=0,ssl=false`. Only addr is required. ssl may be 'true', 'false', or 'insecure'. 121 | # memcache: 127.0.0.1:11211 122 | ;connstr = 123 | 124 | #################################### Data proxy ########################### 125 | [dataproxy] 126 | 127 | # This enables data proxy logging, default is false 128 | ;logging = false 129 | 130 | # How long the data proxy should wait before timing out default is 30 (seconds) 131 | ;timeout = 30 132 | 133 | # If enabled and user is not anonymous, data proxy will add X-Grafana-User header with username into the request, default is false. 134 | ;send_user_header = false 135 | 136 | #################################### Analytics #################################### 137 | [analytics] 138 | # Server reporting, sends usage counters to stats.grafana.org every 24 hours. 139 | # No ip addresses are being tracked, only simple counters to track 140 | # running instances, dashboard and error counts. It is very helpful to us. 141 | # Change this option to false to disable reporting. 142 | ;reporting_enabled = true 143 | 144 | # Set to false to disable all checks to https://grafana.net 145 | # for new vesions (grafana itself and plugins), check is used 146 | # in some UI views to notify that grafana or plugin update exists 147 | # This option does not cause any auto updates, nor send any information 148 | # only a GET request to http://grafana.com to get latest versions 149 | ;check_for_updates = true 150 | 151 | # Google Analytics universal tracking code, only enabled if you specify an id here 152 | ;google_analytics_ua_id = 153 | 154 | # Google Tag Manager ID, only enabled if you specify an id here 155 | ;google_tag_manager_id = 156 | 157 | #################################### Security #################################### 158 | [security] 159 | # disable creation of admin user on first start of grafana 160 | ;disable_initial_admin_creation = false 161 | 162 | # default admin user, created on startup 163 | ;admin_user = admin 164 | 165 | # default admin password, can be changed before first start of grafana, or in profile settings 166 | ;admin_password = admin 167 | 168 | # used for signing 169 | ;secret_key = SW2YcwTIb9zpOOhoPsMm 170 | 171 | # disable gravatar profile images 172 | ;disable_gravatar = false 173 | 174 | # data source proxy whitelist (ip_or_domain:port separated by spaces) 175 | ;data_source_proxy_whitelist = 176 | 177 | # disable protection against brute force login attempts 178 | ;disable_brute_force_login_protection = false 179 | 180 | # set to true if you host Grafana behind HTTPS. default is false. 181 | ;cookie_secure = false 182 | 183 | # set cookie SameSite attribute. defaults to `lax`. can be set to "lax", "strict", "none" and "disabled" 184 | ;cookie_samesite = none 185 | 186 | # set to true if you want to allow browsers to render Grafana in a ,