apisix-docker icon indicating copy to clipboard operation
apisix-docker copied to clipboard

bug: error related to mounted `config.yaml` in standalone mode (3.8.0, 3.9.0)

Open kayx23 opened this issue 1 year ago • 10 comments

Current State

With the new 3.8.0-debian image, I was unable to access route defined in the apisix.yaml:

standalone-not-working

Note that:

  1. the problem goes away if I do not mount config.yaml. In other words, if I just mount apisix.yaml with a route config, I could access the route successfully.
  2. this was not an issue in 3.5.0 (unable to test with 3.6.0 and 3.7.0 due to sed error), so something may have changed. See screenshot below:

350-no-issue

Therefore, this looks like an error related to mounting config.yaml.

Logs

2024/01/16 14:11:04 [error] 35#35: *6 [lua] config_yaml.lua:211: failed to check item data of [routes] err:allOf 1 failed: value should match only one schema, but matches none ,val: {"priority":0,"status":1}, context: init_worker_by_lua*
2024/01/16 14:11:04 [warn] 39#39: *5 [lua] plugin.lua:255: load_stream(): new plugins: {"limit-conn":true,"ip-restriction":true,"syslog":true,"mqtt-proxy":true}, context: init_worker_by_lua*
2024/01/16 14:11:04 [error] 38#38: *2 [lua] config_yaml.lua:211: failed to check item data of [routes] err:allOf 1 failed: value should match only one schema, but matches none ,val: {"priority":0,"status":1}, context: init_worker_by_lua*
2024/01/16 14:11:04 [warn] 41#41: *8 [lua] plugin.lua:255: load_stream(): new plugins: {"limit-conn":true,"ip-restriction":true,"syslog":true,"mqtt-proxy":true}, context: init_worker_by_lua*
2024/01/16 14:11:04 [error] 39#39: *5 [lua] config_yaml.lua:211: failed to check item data of [routes] err:allOf 1 failed: value should match only one schema, but matches none ,val: {"priority":0,"status":1}, context: init_worker_by_lua*
2024/01/16 14:11:04 [error] 41#41: *8 [lua] config_yaml.lua:211: failed to check item data of [routes] err:allOf 1 failed: value should match only one schema, but matches none ,val: {"priority":0,"status":1}, context: init_worker_by_lua*
2024/01/16 14:11:04 [warn] 46#46: *9 [lua] plugin.lua:255: load_stream(): new plugins: {"limit-conn":true,"ip-restriction":true,"syslog":true,"mqtt-proxy":true}, context: init_worker_by_lua*
2024/01/16 14:11:04 [error] 46#46: *9 [lua] config_yaml.lua:211: failed to check item data of [routes] err:allOf 1 failed: value should match only one schema, but matches none ,val: {"priority":0,"status":1}, context: init_worker_by_lua*

kayx23 avatar Jan 16 '24 14:01 kayx23

@jingzhao-self I remembered you said your fix worked so it might or might not related to your change. When you are available, could you please test with the new image 3.8.0-debian to see if you could reproduce this issue? Thanks.

cc: @monkeyDluffy6017 @shreemaan-abhishek

kayx23 avatar Jan 16 '24 14:01 kayx23

This issue is caused by docker-entrypoint.sh https://github.com/apache/apisix-docker/blob/2ddd3045bcc3a6f54116bf7559fa5918892423d8/debian/docker-entrypoint.sh#L23C1-L45C6

When in standalone mode this script tries to create the config.yaml file or update it's keys. I'm not quite sure why this done as we are able to provide ourselves a valid config.yaml when working in standalone mode.

I suggest removing the file update part. This way if the provided file is invalid the deployment would simply fail, but if it is not provided the script would create it for us.

fvilla-netnix avatar Mar 07 '24 16:03 fvilla-netnix

I've come up with a simple fix to bypass the issue.

When working with the Docker image I override the entrypoint with bash and set the command as -c "/usr/bin/apisix init && exec /usr/local/openresty/bin/openresty -p /usr/local/apisix -g 'daemon off;'"

This will start the gateway and forgo the entrypoint config file initialization.

fvilla-netnix avatar Mar 11 '24 14:03 fvilla-netnix

Thanks, will you be opening a PR?

kayx23 avatar Mar 11 '24 15:03 kayx23

Yeah, sure. I can try that.

fvilla-netnix avatar Mar 11 '24 15:03 fvilla-netnix

I've opened the pull request (https://github.com/apache/apisix-docker/pull/547). Hope we can fix it.

fvilla-netnix avatar Mar 12 '24 18:03 fvilla-netnix

apache/apisix:3.9.0出现同样问题,volume配置文件没有效果

Jacky-Law avatar Apr 12 '24 05:04 Jacky-Law

yep, it's not fixed yet...

kayx23 avatar Apr 12 '24 05:04 kayx23

This issue has been marked as stale due to 30 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the [email protected] list. Thank you for your contributions.

github-actions[bot] avatar May 12 '24 10:05 github-actions[bot]

This issue has been marked as stale due to 30 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the [email protected] list. Thank you for your contributions.

github-actions[bot] avatar Jul 03 '24 10:07 github-actions[bot]

Issue is still relevant

kayx23 avatar Jul 03 '24 18:07 kayx23

This issue has been marked as stale due to 30 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the [email protected] list. Thank you for your contributions.

github-actions[bot] avatar Aug 04 '24 10:08 github-actions[bot]