You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ch...@apache.org on 2021/04/19 06:24:59 UTC

[apisix-dashboard] branch master updated: change: remove listen.host from api/conf/conf.yaml (#1767)

This is an automated email from the ASF dual-hosted git repository.

chenjunxu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
     new 5406ba3  change: remove listen.host from api/conf/conf.yaml (#1767)
5406ba3 is described below

commit 5406ba3bc6ed60809fb5154711933820bd6677ca
Author: nic-chen <33...@users.noreply.github.com>
AuthorDate: Mon Apr 19 14:24:53 2021 +0800

    change: remove listen.host from api/conf/conf.yaml (#1767)
---
 .github/workflows/backend-e2e-test.yml   |  6 ++----
 .github/workflows/deploy-with-docker.yml |  7 +++++--
 api/conf/conf.yaml                       | 18 +++++++++++-------
 api/internal/conf/conf.go                |  2 +-
 api/test/docker/setup.sh                 |  3 +--
 api/test/shell/cli_test.sh               |  6 +++---
 6 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/.github/workflows/backend-e2e-test.yml b/.github/workflows/backend-e2e-test.yml
index 2914e9b..a7a3545 100644
--- a/.github/workflows/backend-e2e-test.yml
+++ b/.github/workflows/backend-e2e-test.yml
@@ -29,10 +29,9 @@ jobs:
       - name: Modify conf.yaml
         run: |
           sed -i 's/127.0.0.1:2379/172.16.238.10:2379/' ./api/conf/conf.yaml
-          sed -i 's/127.0.0.1/0.0.0.0/' ./api/conf/conf.yaml
+          sed -i 's@127.0.0.1@0.0.0.0/0@' ./api/conf/conf.yaml
           sed -i '/172.16.238.10:2379/a\      - 172.16.238.11:2379' ./api/conf/conf.yaml
           sed -i '/172.16.238.10:2379/a\      - 172.16.238.12:2379' ./api/conf/conf.yaml
-          sed -i 's@127.0.0.0/24@0.0.0.0/0@' ./api/conf/conf.yaml
           sed -i 's@# - dubbo-proxy@- dubbo-proxy@' ./api/conf/conf.yaml
 
       - name: download file Dockerfile-apisix
@@ -98,10 +97,9 @@ jobs:
       - name: Modify conf.yaml Configure for use by the manage-api cluster
         run: |
           sed -i 's/127.0.0.1:2379/172.16.238.10:2379/' ./api/conf/conf.yaml
-          sed -i 's/127.0.0.1/0.0.0.0/' ./api/conf/conf.yaml
+          sed -i 's@127.0.0.1@0.0.0.0/0@' ./api/conf/conf.yaml
           sed -i '/172.16.238.10:2379/a\      - 172.16.238.11:2379' ./api/conf/conf.yaml
           sed -i '/172.16.238.10:2379/a\      - 172.16.238.12:2379' ./api/conf/conf.yaml
-          sed -i 's@127.0.0.0/24@0.0.0.0/0@' ./api/conf/conf.yaml
 
       - name: download file Dockerfile-apisix
         working-directory: ./api/test/docker
diff --git a/.github/workflows/deploy-with-docker.yml b/.github/workflows/deploy-with-docker.yml
index de7af3d..21415f1 100644
--- a/.github/workflows/deploy-with-docker.yml
+++ b/.github/workflows/deploy-with-docker.yml
@@ -33,8 +33,11 @@ jobs:
       - name: Modify Config
         run: |
           sed -i 's/127.0.0.1:2379/172.16.238.10:2379/' api/conf/conf.yaml
-          sed -i 's/host: 127.0.0.1/host: 0.0.0.0/' api/conf/conf.yaml
-          sed -i 's@127.0.0.0/24@0.0.0.0/0@' ./api/conf/conf.yaml
+          sed -i 's@127.0.0.1@0.0.0.0/0@' ./api/conf/conf.yaml
+
+          # At present, the docker CI is still running the code of the master branch
+          # So we need to configure `listen.host` so that it can be accessed outside docker
+          sed -i '/port: 9000/i\    host: 0.0.0.0' ./api/conf/conf.yaml
 
       - name: Run Docker Compose
         working-directory: ./api/test/docker-deploy
diff --git a/api/conf/conf.yaml b/api/conf/conf.yaml
index 70efac7..8d4414b 100644
--- a/api/conf/conf.yaml
+++ b/api/conf/conf.yaml
@@ -16,13 +16,17 @@
 #
 
 conf:
-  listen:
-    host: 127.0.0.1     # `manager api` listening ip or host name
-    port: 9000          # `manager api` listening port
-  allow_list:           # If we don't set any IP list, then any IP access is allowed by default.
-    - 127.0.0.0/24
+  listen:                 # yamllint disable rule:comments-indentation
+    # host: 127.0.0.1     # the address on which the `Manager API` should listen.
+                          # The default value is 0.0.0.0, if want to specify, please enable it.
+                          # This value accepts IPv4, IPv6, and hostname.
+    port: 9000            # The port on which the `Manager API` should listen.
+  allow_list:             # If we don't set any IP list, then any IP access is allowed by default.
+    - 127.0.0.1           # The rules are checked in sequence until the first match is found.
+    - ::1                 # In this example, access is allowed only for IPv4 network 127.0.0.1, and for IPv6 network ::1.
+                          # It also support CIDR like 192.168.1.0/24 and 2001:0db8::/32
   etcd:
-    endpoints:          # supports defining multiple etcd host addresses for an etcd cluster
+    endpoints:            # supports defining multiple etcd host addresses for an etcd cluster
       - 127.0.0.1:2379
                           # yamllint disable rule:comments-indentation
                           # etcd basic auth info
@@ -32,7 +36,7 @@ conf:
       key_file: ""          # Path of your self-signed client side key
       cert_file: ""         # Path of your self-signed client side cert
       ca_file: ""           # Path of your self-signed ca cert, the CA is used to sign callers' certificates
-    # prefix: /apisix     # apisix config's prefix in etcd, /apisix by default
+    # prefix: /apisix       # apisix config's prefix in etcd, /apisix by default
   log:
     error_log:
       level: warn       # supports levels, lower to higher: debug, info, warn, error, panic, fatal
diff --git a/api/internal/conf/conf.go b/api/internal/conf/conf.go
index 0e30df4..40af007 100644
--- a/api/internal/conf/conf.go
+++ b/api/internal/conf/conf.go
@@ -44,7 +44,7 @@ var (
 	ENV              string
 	Schema           gjson.Result
 	WorkDir          = "."
-	ServerHost       = "127.0.0.1"
+	ServerHost       = "0.0.0.0"
 	ServerPort       = 80
 	ETCDConfig       *Etcd
 	ErrorLogLevel    = "warn"
diff --git a/api/test/docker/setup.sh b/api/test/docker/setup.sh
index a45d2a0..9bcce6b 100755
--- a/api/test/docker/setup.sh
+++ b/api/test/docker/setup.sh
@@ -99,10 +99,9 @@ up() {
 
     #modifying config
     sed -i 's/127.0.0.1:2379/172.16.238.10:2379/' "$YAML_FILE"
-    sed -i 's/127.0.0.1/0.0.0.0/' "$YAML_FILE"
+    sed -i 's@127.0.0.1@0.0.0.0/0@' "$YAML_FILE"
     sed -i '/172.16.238.10:2379/a\      - 172.16.238.11:2379' "$YAML_FILE"
     sed -i '/172.16.238.10:2379/a\      - 172.16.238.12:2379' "$YAML_FILE"
-    sed -i 's@127.0.0.0/24@0.0.0.0/0@' "$YAML_FILE"
     sed -i 's@# - dubbo-proxy@- dubbo-proxy@' "$YAML_FILE"
 
   fi
diff --git a/api/test/shell/cli_test.sh b/api/test/shell/cli_test.sh
index 9ff655a..d1c3b90 100755
--- a/api/test/shell/cli_test.sh
+++ b/api/test/shell/cli_test.sh
@@ -189,7 +189,7 @@ if [[ `grep -c "${LOGLEVEL}" ${STDOUT}` -ne '1' ]]; then
     exit 1
 fi
 
-if [[ `grep -c "${HOST}:${PORT}" ${STDOUT}` -ne '1' ]]; then
+if [[ `grep -c "0.0.0.0:${PORT}" ${STDOUT}` -ne '1' ]]; then
     echo "failed: the manager server didn't show started info"
     exit 1
 fi
@@ -252,9 +252,9 @@ clean_up
 
 # set ip allowed list
 if [[ $KERNEL = "Darwin" ]]; then
-  sed -i "" 's@127.0.0.0/24@10.0.0.1@' conf/conf.yaml
+  sed -i "" 's@- 127.0.0.1 @- 10.0.0.1 @' conf/conf.yaml
 else
-  sed -i 's@127.0.0.0/24@10.0.0.1@' conf/conf.yaml
+  sed -i 's@- 127.0.0.1 @- 10.0.0.1 @' conf/conf.yaml
 fi
 
 ./manager-api &