polaru opened a new issue, #10277:
URL: https://github.com/apache/apisix/issues/10277

   ### Current Behavior
   
   When starting docker-compose with `environment: APISIX_STAND_ALONE=true`, 
the configuration for `plugin_metadata` in not loaded. 
   
   ### Expected Behavior
   
   _No response_
   
   ### Error Logs
   
   _No response_
   
   ### Steps to Reproduce
   
   1. Start `docker compose` with the following files:
   ```
   $ ls -1 *
   compose.yaml
   
   apisix_conf:
   apisix-standalone.yaml
   
   upstream:
   web1.conf
   
   $ cat compose.yaml            
   #
   # Licensed to the Apache Software Foundation (ASF) under one or more
   # contributor license agreements.  See the NOTICE file distributed with
   # this work for additional information regarding copyright ownership.
   # The ASF licenses this file to You under the Apache License, Version 2.0
   # (the "License"); you may not use this file except in compliance with
   # the License.  You may obtain a copy of the License at
   #
   #     http://www.apache.org/licenses/LICENSE-2.0
   #
   # Unless required by applicable law or agreed to in writing, software
   # distributed under the License is distributed on an "AS IS" BASIS,
   # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   # See the License for the specific language governing permissions and
   # limitations under the License.
   #
   
   version: "3"
   
   services:
     apisix:
       image: apache/apisix:${APISIX_IMAGE_TAG:-3.5.0-debian}
       restart: always
       volumes:
         - 
./apisix_conf/apisix-standalone.yaml:/usr/local/apisix/conf/apisix.yaml:ro
       environment:
         - APISIX_STAND_ALONE=true
       ports:
         - "9180:9180/tcp"
         - "9080:9080/tcp"
         - "9091:9091/tcp"
         - "9443:9443/tcp"
         - "9092:9092/tcp"
       networks:
         apisix:
   
     web1:
       image: nginx:1.19.0-alpine
       restart: always
       volumes:
         - ./upstream/web1.conf:/etc/nginx/nginx.conf
       ports:
         - "9081:80/tcp"
       environment:
         - NGINX_PORT=80
       networks:
         apisix:
   
   
   networks:
     apisix:
       driver: bridge
   
   
   $ cat apisix_conf/apisix-standalone.yaml 
   #
   # Licensed to the Apache Software Foundation (ASF) under one or more
   # contributor license agreements.  See the NOTICE file distributed with
   # this work for additional information regarding copyright ownership.
   # The ASF licenses this file to You under the Apache License, Version 2.0
   # (the "License"); you may not use this file except in compliance with
   # the License.  You may obtain a copy of the License at
   #
   #     http://www.apache.org/licenses/LICENSE-2.0
   #
   # Unless required by applicable law or agreed to in writing, software
   # distributed under the License is distributed on an "AS IS" BASIS,
   # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   # See the License for the specific language governing permissions and
   # limitations under the License.
   #
   
   routes:
     -
       uri: /get
       upstream:
           nodes:
               "web1:80": 1
           type: roundrobin
   
   plugin_metadata:
     datadog:
       host: "datadog.datadog.svc.cluster.local"
   
   #END
   
   $ cat upstream/web1.conf                                                     
 
   worker_processes 1;
   error_log stderr notice;
   events {
       worker_connections 1024;
   }
   
   http {
       variables_hash_max_size 1024;
       access_log off;
       real_ip_header X-Real-IP;
       charset utf-8;
   
       server {
           listen 80;
   
           location / {
               return 200 "hello web1";
           }
   
           location /static/ {
               alias static/;
           }
       }
   }
   
   $ docker compose up --detach           
   [+] Running 3/3
    ✔ Network apisix-upstream-standalone_apisix      Created                    
                                                                                
           0.1s 
    ✔ Container apisix-upstream-standalone-apisix-1  Started                    
                                                                                
           0.5s 
    ✔ Container apisix-upstream-standalone-web1-1    Started                    
                                                                                
           0.5s 
   ```
   
   The only addition compared to the files found upstream is:
   ```
   plugin_metadata:
     datadog:
       host: "datadog.datadog.svc.cluster.local"
   ```
   
   2. Confirm `datadog` is listed in the allowed plugins (coming from 
`config-default.yaml`) included in the upstream image:
   ```
   $ docker compose logs apisix | grep datadog | tail -n 1
   apisix-upstream-standalone-apisix-1  | 2023/09/28 09:11:51 [warn] 51#51: *5 
[lua] plugin.lua:202: load(): new plugins: 
{"splunk-hec-logging":true,"uri-blocker":true,"inspect":true,"wolf-rbac":true,"serverless-pre-function":true,"workflow":true,"client-control":true,"real-ip":true,"degraphql":true,"mocking":true,"referer-restriction":true,"authz-casbin":true,"kafka-logger":true,"echo":true,"clickhouse-logger":true,"proxy-mirror":true,"sls-logger":true,"chaitin-waf":true,"cors":true,"proxy-cache":true,"example-plugin":true,"openfunction":true,"loki-logger":true,"grpc-web":true,"ua-restriction":true,"google-cloud-logging":true,"http-logger":true,"csrf":true,"cas-auth":true,"basic-auth":true,"ldap-auth":true,"udp-logger":true,"consumer-restriction":true,"ai":true,"proxy-control":true,"redirect":true,"ext-plugin-post-req":true,"traffic-split":true,"gzip":true,"authz-casdoor":true,"limit-req":true,"proxy-rewrite":true,"tencent-cloud-cls":true,"grpc-transcode":true,"tcp-logger":true,"dat
 
adog":true,"ext-plugin-post-resp":true,"zipkin":true,"serverless-post-function":true,"syslog":true,"openid-connect":true,"azure-functions":true,"response-rewrite":true,"fault-injection":true,"aws-lambda":true,"file-logger":true,"openwhisk":true,"rocketmq-logger":true,"opa":true,"key-auth":true,"limit-conn":true,"skywalking-logger":true,"forward-auth":true,"authz-keycloak":true,"request-validation":true,"public-api":true,"ip-restriction":true,"limit-count":true,"ext-plugin-pre-req":true,"body-transformer":true,"jwt-auth":true,"loggly":true,"prometheus":true,"server-info":true,"kafka-proxy":true,"request-id":true,"hmac-auth":true,"elasticsearch-logger":true,"api-breaker":true},
 context: init_worker_by_lua*
   ```
   
   3. Confirm the configured route works as expected:
   ```
   $ docker compose exec -ti apisix curl -v http://127.0.0.1:9080/get           
     
   *   Trying 127.0.0.1:9080...
   * Connected to 127.0.0.1 (127.0.0.1) port 9080 (#0)
   > GET /get HTTP/1.1
   > Host: 127.0.0.1:9080
   > User-Agent: curl/7.74.0
   > Accept: */*
   > 
   * Mark bundle as not supporting multiuse
   < HTTP/1.1 200 OK
   < Content-Type: text/plain; charset=utf-8
   < Content-Length: 10
   < Connection: keep-alive
   < Date: Thu, 28 Sep 2023 09:38:47 GMT
   < Server: APISIX/3.5.0
   < 
   * Connection #0 to host 127.0.0.1 left intact
   hello web1%  
   ```
   
   4. Use the control API to list metadata for all plugins:
   ```
   $ docker compose exec -ti apisix curl -v 
http://127.0.0.1:9090/v1/plugin_metadatas
   *   Trying 127.0.0.1:9090...
   * Connected to 127.0.0.1 (127.0.0.1) port 9090 (#0)
   > GET /v1/plugin_metadatas HTTP/1.1
   > Host: 127.0.0.1:9090
   > User-Agent: curl/7.74.0
   > Accept: */*
   > 
   * Mark bundle as not supporting multiuse
   < HTTP/1.1 200 OK
   < Server: openresty
   < Date: Thu, 28 Sep 2023 09:12:05 GMT
   < Content-Type: application/json
   < Transfer-Encoding: chunked
   < Connection: keep-alive
   < 
   {}
   * Connection #0 to host 127.0.0.1 left intact
   ```
   
   
   ### Environment
   
   - APISIX version (run `apisix version`):
   ```
   apisix@479159ed59e5:/usr/local/apisix$ apisix version
   /usr/local/openresty//luajit/bin/luajit ./apisix/cli/apisix.lua version
   3.5.0
   ```
   - Operating system (run `uname -a`):
   ```
   apisix@479159ed59e5:/usr/local/apisix$ uname -a
   Linux 479159ed59e5 6.2.0-33-generic #33-Ubuntu SMP PREEMPT_DYNAMIC Tue Sep  
5 14:49:19 UTC 2023 x86_64 GNU/Linux
   ```
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
   ```
   apisix@479159ed59e5:/usr/local/apisix$ openresty -V
   nginx version: openresty/1.21.4.2
   built by gcc 10.2.1 20210110 (Debian 10.2.1-6) 
   built with OpenSSL 1.1.1s  1 Nov 2022
   TLS SNI support enabled
   configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 
-DAPISIX_BASE_VER=1.21.4.2.0 
-DNGX_GRPC_CLI_ENGINE_PATH=/usr/local/openresty/libgrpc_engine.so 
-DNGX_HTTP_GRPC_CLI_ENGINE_PATH=/usr/local/openresty/libgrpc_engine.so 
-DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/zlib/include 
-I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl111/include' 
--add-module=../ngx_devel_kit-0.3.2 --add-module=../echo-nginx-module-0.63 
--add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 
--add-module=../set-misc-nginx-module-0.33 
--add-module=../form-input-nginx-module-0.12 
--add-module=../encrypted-session-nginx-module-0.09 
--add-module=../srcache-nginx-module-0.33 --add-module=../ngx_lua-0.10.25 
--add-module=../ngx_lua_upstream-0.07 
--add-module=../headers-more-nginx-module-0.34 
--add-module=../array-var-nginx-module-0.06 
--add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 
--add-module=../redis-nginx-module-0.3.9 --ad
 d-module=../ngx_stream_lua-0.0.13 
--with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib 
-Wl,-rpath,/usr/local/openresty/wasmtime-c-api/lib 
-L/usr/local/openresty/zlib/lib -L/usr/local/openresty/pcre/lib 
-L/usr/local/openresty/openssl111/lib 
-Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl111/lib'
 --add-module=/tmp/tmp.0EeoYgSz2t/openresty-1.21.4.2/../mod_dubbo-1.0.2 
--add-module=/tmp/tmp.0EeoYgSz2t/openresty-1.21.4.2/../ngx_multi_upstream_module-1.1.1
 
--add-module=/tmp/tmp.0EeoYgSz2t/openresty-1.21.4.2/../apisix-nginx-module-1.14.0
 
--add-module=/tmp/tmp.0EeoYgSz2t/openresty-1.21.4.2/../apisix-nginx-module-1.14.0/src/stream
 
--add-module=/tmp/tmp.0EeoYgSz2t/openresty-1.21.4.2/../apisix-nginx-module-1.14.0/src/meta
 --add-module=/tmp/tmp.0EeoYgSz2t/openresty-1.21.4.2/../wasm-nginx-module-0.6.5 
--add-module=/tmp/tmp.0EeoYgSz2t/openresty-1.21.4.2/../lua-var-nginx-module-v0.5.3
 --add-module=/tmp/tmp.0EeoYgSz2t/openresty-1.21.4.2/../grp
 c-client-nginx-module-v0.4.3 --with-poll_module --with-pcre-jit --with-stream 
--with-stream_ssl_module --with-stream_ssl_preread_module --with-http_v2_module 
--without-mail_pop3_module --without-mail_imap_module 
--without-mail_smtp_module --with-http_stub_status_module 
--with-http_realip_module --with-http_addition_module 
--with-http_auth_request_module --with-http_secure_link_module 
--with-http_random_index_module --with-http_gzip_static_module 
--with-http_sub_module --with-http_dav_module --with-http_flv_module 
--with-http_mp4_module --with-http_gunzip_module --with-threads --with-compat 
--with-stream --with-http_ssl_module
   ```
   - etcd version, if relevant (run `curl 
http://127.0.0.1:9090/v1/server_info`):
   ```
   apisix@479159ed59e5:/usr/local/apisix$ curl 
http://127.0.0.1:9090/v1/server_info
   
{"id":"d3b6cf3a-3078-4080-992f-3dfb99db11ae","boot_time":1695893898,"etcd_version":"unknown","hostname":"479159ed59e5","version":"3.5.0"}
   ```
   - APISIX Dashboard version, if relevant:
   - Plugin runner version, for issues related to plugin runners:
   - LuaRocks version, for installation issues (run `luarocks --version`):
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to