apache / apisix-go-plugin-runner

Go Plugin Runner for APISIX
https://apisix.apache.org/
Apache License 2.0
167 stars 69 forks source link

request help: running plugin runner with apisix - no socket file #61

Closed pawanmsr closed 2 years ago

pawanmsr commented 2 years ago

Go Version: 1.17.6 APISIX Version: 2.11.0 APISIX-GO_PLUGIN_RUNNER: release/0.2.0

2022/01/24 00:07:05 [warn] 72671#72671: *68 [lua] init.lua:753: 2022-01-24T00:07:05.123-0600    INFO    plugin/plugin.go:66 register plugin limit-req
2022-01-24T00:07:05.123-0600    INFO    plugin/plugin.go:66 register plugin say
2022-01-24T00:07:05.123-0600    WARN    server/server.go:177    conf cache ttl is 1h0m0s
2022-01-24T00:07:05.123-0600    WARN    server/server.go:185    listening to /usr/local/apisix/logs/conf/apisix-72666.sock
2022-01-24T00:07:05.123-0600    FATAL   server/server.go:200    listen /usr/local/apisix/logs/conf/apisix-72666.sock: listen unix /usr/local/apisix/logs/conf/apisix-72666.sock: bind: no such file or directory
github.com/apache/apisix-go-plugin-runner/internal/server.Run
    /home/svmlp17/go-plugin-runner/apisix-go-plugin-runner/internal/server/server.go:200
github.com/apache/apisix-go-plugin-runner/pkg/runner.Run
    /home/svmlp17/go-plugin-runner/apisix-go-plugin-runner/pkg/runner/runner.go:43
main.newRunCommand.func1
    /home/svmlp17/go-plugin-runner/apisix-go-plugin-runner/cmd/go-runner/main.go:134
github.com/spf13/cobra.(*Command).execute
    /home/svmlp17/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
    /home/svmlp17/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:960
github.com/spf13/cobra.(*Command).Execute
    /home/svmlp17/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:897
main.main
    /home/svmlp17/go-plugin-runner/apisix-go-plugin-runner/cmd/go-runner/main.go:160
runtime.main
    /usr/local/go/src/runtime/proc.go:255
, context: ngx.timer
2022/01/24 00:07:05 [warn] 72671#72671: *68 [lua] init.lua:759: runner exited with reason: exit, status: 1, context: ngx.timer
2022/01/24 00:07:05 [warn] 72671#72671: *68 [lua] init.lua:329: flush_token(): flush conf token in shared dict, context: ngx.timer
2022/01/24 00:07:05 [warn] 72671#72671: *68 [lua] init.lua:664: flush conf token lrucache, context: ngx.timer
2022/01/24 00:07:05 [warn] 72671#72671: *68 [lua] init.lua:769: respawn runner 3 seconds later with cmd: ["\/home\/svmlp17\/go-plugin-runner\/apisix-go-plugin-runner\/go-runner","run"], context: ngx.timer
2022/01/24 00:07:05 [warn] 72667#72667: *23985 [lua] init.lua:329: flush_token(): flush conf token in shared dict, context: ngx.timer
2022/01/24 00:07:05 [warn] 72667#72667: *23985 [lua] init.lua:664: flush conf token lrucache, context: ngx.timer
2022/01/24 00:07:05 [warn] 72668#72668: *23986 [lua] init.lua:329: flush_token(): flush conf token in shared dict, context: ngx.timer
2022/01/24 00:07:05 [warn] 72668#72668: *23986 [lua] init.lua:664: flush conf token lrucache, context: ngx.timer
spacewander commented 2 years ago

How do you configure the ext-plugin in APISIX? Could you show us the way you run go-runner?

pawanmsr commented 2 years ago

Hi:

Here is the configuration for ext-plugin

ext-plugin:
    # path_for_test: /tmp/runner.sock
    cmd: ["APISIX_LISTEN_ADDRESS=unix:/tmp/runner.sock", "/home/[redacted]/go-plugin-runner/apisix-go-plugin-runner/go-runner", "run"]

The go plugin runner is built inside apisix-go-plugin-runner directory.
It is running in a Virtual Machine with CentOS.

I start the APISIX with sudo: sudo apisix start
I am getting this error in the error.log:

2022/01/25 06:09:15 [warn] 93002#93002: *68 [lua] init.lua:771: respawning new runner..., context: ngx.timer
2022/01/25 06:09:15 [error] 93002#93110: lua pipe child execvp() failed while executing APISIX_LISTEN_ADDRESS=unix:/tmp/runner.sock (2: No such file or directory)
2022/01/25 06:09:15 [warn] 93002#93002: *68 [lua] init.lua:759: runner exited with reason: exit, status: 1, context: ngx.timer
2022/01/25 06:09:15 [warn] 93002#93002: *68 [lua] init.lua:329: flush_token(): flush conf token in shared dict, context: ngx.timer
2022/01/25 06:09:15 [warn] 93002#93002: *68 [lua] init.lua:664: flush conf token lrucache, context: ngx.timer
2022/01/25 06:09:15 [warn] 93002#93002: *68 [lua] init.lua:769: respawn runner 3 seconds later with cmd: ["APISIX_LISTEN_ADDRESS=unix:\/tmp\/runner.sock","\/home\/svmlp17\/go-plugin-runner\/apisix-go-plugin-runner\/go-runner","run"], context: ngx.timer
2022/01/25 06:09:15 [warn] 92999#92999: *1206 [lua] init.lua:329: flush_token(): flush conf token in shared dict, context: ngx.timer
2022/01/25 06:09:15 [warn] 92999#92999: *1206 [lua] init.lua:664: flush conf token lrucache, context: ngx.timer
2022/01/25 06:09:15 [warn] 92998#92998: *1207 [lua] init.lua:329: flush_token(): flush conf token in shared dict, context: ngx.timer
2022/01/25 06:09:15 [warn] 92998#92998: *1207 [lua] init.lua:664: flush conf token lrucache, context: ngx.timer
spacewander commented 2 years ago

Let's remove the "APISIX_LISTEN_ADDRESS=unix:/tmp/runner.sock". It's only for development purposes.

See https://github.com/apache/apisix-go-plugin-runner/blob/master/docs/en/latest/getting-started.md

APISIX will automatically assign a unix socket address for the runner to listen to when it starts. environment variables do not need to be set manually.

pawanmsr commented 2 years ago

I removed it but then the earlier error messages appear.
I think it is permission issue on the VM, because it worked within a docker container.

Alternate option found. Closing the issue.