apache / apache/apisix-go-plugin-runner

request help: failed to connect to the unix socket unix:/usr/local/apisix/conf/apisix-1.sock: no such file or directory

Open
#163 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
198
Forks
68
PR merge metrics
No merged PRs in 30d

Description

### Issue description
Sending a request to http://localhost:9080 will result in an error. I'm running apisix in docker.

Error
```bash
2024/09/01 04:11:33 [error] 33#33: *396 [lua] init.lua:889: phase_func(): failed to connect to the unix socket unix:/usr/local/apisix/conf/apisix-1.sock: no such file or directory
```

Dockerfile
```Dockerfile
FROM golang:1.22.5 AS plugin-builder

WORKDIR /builder

COPY go-runner .

RUN CGO_ENABLED=0 go build .

FROM apache/apisix:3.9.1-debian

ENV APISIX_STAND_ALONE=true

EXPOSE 9080 9180 9091 9443 9092

COPY apisix.yaml /usr/local/apisix/conf/apisix.yaml

COPY --from=plugin-builder /builder/go-runner /usr/local/apisix-go-plugin-runner/go-runner
```

apisix.yaml
```yaml
routes:
- uri: /
plugin_config_id: 1
upstream:
nodes:
"upstream-nlb-9780037035286027.elb.ap-northeast-2.amazonaws.com": 1
type: roundrobin

plugin_configs:
- id: 1
plugins:
ext-plugin-pre-req:
name: ext-plugin-pre-req
config:
name: "say"
value:
body: "Hello, APISIX!"

ext-plugin:
cmd: ["/usr/local/apisix-go-plugin-runner/go-runner", "run"]
#END
```
Furthermore, when I checked `/usr/local/apisix/config` in Docker, there is no sock file and no environment variable named `APISIX_LISTEN_ADDRESS`.

```bash
apisix@fe350b633c44:/usr/local/apisix/conf$ ls
apisix.uid apisix.yaml cert config-default.yaml config.yaml debug.yaml mime.types nginx.conf
```
```bash
apisix@fe350b633c44:/usr/local/apisix/conf$ printenv
APISIX_STAND_ALONE=true
HOSTNAME=fe350b633c44
PWD=/usr/local/apisix/conf
HOME=/home/apisix
TERM=xterm
SHLVL=1
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin
_=/usr/bin/printenv
OLDPWD=/usr/local/apisix
```
### Environment

* APISIX Go Plugin Runner's version:
* APISIX version: apache/apisix:3.9.1-debian
* Go version: 1.22.5
* OS (cmd: `uname -a`): Darwin sanghyeonkimui-MacBookPro.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 arm64

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Dockerfile and apisix.yaml, then inspect the ext-plugin configuration and the reported unix socket path inside the apache/apisix:3.9.1-debian container. Compare the configured Go plugin runner command with the container's generated configuration and runtime files. Done means identifying why the socket is absent and documenting or correcting the configuration so requests to localhost:9080 succeed.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
backend, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.