OpenWhisk Docker Compose部署下函数Playground UI的访问及API Gateway配置疑问
OpenWhisk Docker Compose部署下函数Playground UI的访问及API Gateway配置疑问
你好!我来帮你梳理下OpenWhisk Docker Compose部署里关于Playground UI和API Gateway的问题:
关于Playground UI的访问问题
你之前用standalone模式能访问Playground UI,是因为standalone默认集成了这个UI服务,所以3232端口会开放。但官方的docker-compose部署(就是你用的devtools里的那个)默认并没有包含Playground UI服务,这就是为什么你看不到3232端口在暴露列表里,也没法直接访问。
如果想要在这个部署中启用Playground UI,你需要手动修改docker-compose配置,添加Playground服务:
- 打开你的docker-compose.yml文件,在services块里新增如下配置:
playground: image: apache/openwhisk-playground:latest ports: - "3232:3232" environment: - API_HOST=<你的服务器IP或localhost> - API_PORT=80 - API_PROTOCOL=http
- 保存后,重新启动部署:
docker-compose up -d - 之后就能通过
http://<你的服务器IP>:3232访问Playground UI了。
关于API Gateway代理到Playground的配置问题
你现在访问80端口看到的默认NGINX欢迎页,是因为当前的Gateway配置里没有把根路径(/)指向Playground UI。如果你想让API Gateway的根路径直接跳转Playground,可以这么修改:
- 找到你贴的那个generated-conf.d里的server配置块,添加一个新的location规则:
location / { proxy_pass http://playground:3232; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; }
这里的playground是你刚才在docker-compose里添加的服务名称,确保两者一致。
- 修改完配置后,重启API Gateway容器:
docker-compose restart apigateway - 之后访问
http://<你的服务器IP>就能直接进入Playground UI了。
另外补充一点:如果你不想修改Gateway配置,直接通过3232端口访问Playground也是完全可以的,不用走API Gateway的代理。
备注:内容来源于stack exchange,提问作者Areej Fatimah
相关产品推荐
相关产品推荐

