Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: mac os m1 External Plugin Local MODO #10865

Closed
zhangchaoyanggit opened this issue Jan 24, 2024 · 16 comments
Closed

bug: mac os m1 External Plugin Local MODO #10865

zhangchaoyanggit opened this issue Jan 24, 2024 · 16 comments
Labels
bug Something isn't working

Comments

@zhangchaoyanggit
Copy link

Current Behavior

docker desktop 通过 docker-compose 启动apisix 并配置config.yaml
ext-plugin:
path_for_test: "/usr/local/apisix/x.sock" # without 'unix:' prefix

在docker-compose中挂在宿主机下的x.sock 本地idea启动加入环境变量APISIX_LISTEN_ADDRESS 赋予宿主机地址,插件正常启动.但是apisix无法找到这个文件,导致apisix执行路由的时候无法到我本地的插件代码.

Expected Behavior

通过访问apisix路由地址,能走到我本地的插件代码中

Error Logs

phase_func(): failed to connect to the unix socket unix:/usr/local/apisix/x.sock: connection refused, client: 172.20.0.1, server: _, request: "GET /order2/test HTTP/1.1", host: "localhost:9080"

Steps to Reproduce

创建一个路由,并配置插件,然后访问这个路由,正常应该走入我本地的插件代码,但是现在连接失败,以上配置参考apisix官网的文档,在windows环境下按照windows的配置方式可以正常到我本地. 参考https://apache-apisix.netlify.app/zh/docs/apisix/next/external-plugin/

Environment

  • APISIX version 3.6
  • mac os m1
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
  • APISIX Dashboard 3.0
  • Plugin runner version, for issues related to plugin runners: java 1.8,使用的是0.4版本,自己降级jdk
@sheharyaar
Copy link
Contributor

Hi @zhangchaoyanggit , can you please communicate im English ?

@zhangchaoyanggit
Copy link
Author

Hi @zhangchaoyanggit , can you please communicate im English ?

Sorry, my English proficiency is limited

@hanqingwu
Copy link
Contributor

@zhangchaoyanggit , when you do this step APISIX_LISTEN_ADDRESS=unix:/usr/local/apisix/x.sock ./the_runner ,
And /usr/local/apisix/x.sock has been create in you host machine ?
when you get in docker apisix , can you see the /usr/local/apisix/x.sock ?

@zhangchaoyanggit
Copy link
Author

@zhangchaoyanggit , when you do this step APISIX_LISTEN_ADDRESS=unix:/usr/local/apisix/x.sock ./the_runner , And /usr/local/apisix/x.sock has been create in you host machine ? when you get in docker apisix , can you see the /usr/local/apisix/x.sock ?

As can be seen, it has been mapped to the interior of the container

@sheharyaar
Copy link
Contributor

sheharyaar commented Jan 24, 2024

Can you please check the permission of the socket and send the output here, without proper permissions docker may mount it as a directory.

Run : stat <path to socket> inside the container

@zhangchaoyanggit
Copy link
Author

Can you please check the permission of the socket and send the output here, without proper permissions docker may mount it as a directory.

Run : stat <path to socket> inside the container

stat x.sock
File: x.sock
Size: 0 Blocks: 0 IO Block: 4096 socket
Device: 82h/130d Inode: 107442842 Links: 1
Access: (0777/srwxrwxrwx) Uid: ( 636/ apisix) Gid: ( 636/ apisix)
Access: 2024-01-24 08:41:14.180624602 +0000
Modify: 2024-01-24 08:41:14.180624602 +0000
Change: 2024-01-24 08:41:14.218946031 +0000
Birth: -

@hanqingwu
Copy link
Contributor

@zhangchaoyanggit , can you try nc -U -z /usr/local/apisix/x.sock to check the unix socket is normal in host machine ?

@zhangchaoyanggit
Copy link
Author

@zhangchaoyanggit , can you try nc -U -z /usr/local/apisix/x.sock to check the unix socket is normal in host machine ?

Sorry, this command is not available in the container, but it works normally on the mounted host

@hanqingwu
Copy link
Contributor

hanqingwu commented Jan 24, 2024

sorry, I can not reproduce.
I try listen unix domain socket in host , and run unix domain client in apisix container, then communicate is normal.
what you docker-compose.yml config mount sock to docker container ?
maybe you can try to test permission in container, touch /usr/local/apisix/test

@zhangchaoyanggit
Copy link
Author

zhangchaoyanggit commented Jan 24, 2024

to check the unix socket is normal in host machine ?

sorry, I can not reproduce. I try listen unix domain socket in host , and run unix domain client in apisix container, then communicate is normal. what you docker-compose.yml config mount sock to docker container ? maybe you can try to test permission in container, touch /usr/local/apisix/test

This is my configuration in docker-compose-arm64.yaml
services:
apisix:
image: apache/apisix:3.6.0-debian
restart: always
volumes:
- ./apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro
- /tmp/x.sock:/usr/local/apisix/x.sock

touch /usr/local/apisix/test Command executed normally

@zll600
Copy link
Contributor

zll600 commented Jan 24, 2024

@zhangchaoyanggit I found an issue which maybe useful. apache/apisix-java-plugin-runner#161

in the doc: https://apisix.apache.org/docs/java-plugin-runner/the-internal-of-apisix-java-plugin-runner/

apisix-java-plugin-runner and APISIX use the Unix Domain Socket for inter-process communication, so they need to be deployed in the same instance.

@shreemaan-abhishek shreemaan-abhishek added the bug Something isn't working label Jan 24, 2024
@zhangchaoyanggit
Copy link
Author

@zhangchaoyanggit I found an issue which maybe useful. apache/apisix-java-plugin-runner#161

in the doc: https://apisix.apache.org/docs/java-plugin-runner/the-internal-of-apisix-java-plugin-runner/

apisix-java-plugin-runner and APISIX use the Unix Domain Socket for inter-process communication, so they need to be deployed in the same instance.

It should be able to support Mac, otherwise how could there be documentation on the official website? Without a Mac, debugging costs would greatly increase. It's best for the community to provide support thanks

@hanqingwu
Copy link
Contributor

@zhangchaoyanggit , You should try to check unix domain socket is work normal in you macos docker env first ,
I found some issue about unix domain socket in macos docker env.
docker/for-mac#483

And the apisix will not be supported MacOS
#10864

@zll600
Copy link
Contributor

zll600 commented Jan 25, 2024

@shreemaan-abhishek So now I think this issue is resolved. If we need to add support for mac. we can create a new issue.

@zhangchaoyanggit
Copy link
Author

And the apisix will not be supported MacOS

Very disappointed, it's hard to understand

@Vacant2333
Copy link
Contributor

yes APISIX is not support for mac now, we can close this issue @shreemaan-abhishek

@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Apache APISIX backlog Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

6 participants