将uWSGI快速路由器放在docker容器中运行的uWSGI服务器前

我在Docker容器中运行了多个基于Flask的webapps(他们的进程需要与主机操作系统隔离)。 要运行这些应用程序,我使用容器内的uWSGI服务器。 传入的请求应该与具有订阅服务器的uWSGI FastRouter匹配(如下所述: http ://uwsgi-docs.readthedocs.org/en/latest/SubscriptionServer.html)。 当启动一个容器时,uWSGI应该根据一些内部configuration来公布自己作为一个子域

所以设置看起来像这样:

Request ---> FastRouter ----> container | myapp1 | | ----> container | myapp2 | 

我试图在一台运行快速路由器以及一些docker容器的主机上进行testing。

FastRouter开始使用

 uwsgi --fastrouter :1717 --fastrouter-subscription-server localhost:2626 --fastrouter-subscription-slot 1000 

问题1我需要做其他事情来使订阅服务器运行吗? 这是否与fastrouter进程一起启动?

容器有两个从主机映射到容器的端口:5000(webapp)和2626(订阅快速路由器)。

所以他们是这样开始的:

 docker run -d -p 5000:5000 -p 2626:2626 myImage $PATH_TO_START/start.sh 

在start.sh中,uWSGI开始于

 uwsgi --http :5000 -M --subscribe-to 127.0.0.1:2626:/test --module server --callable env --enable-threads 

输出看起来不错,最后打印:

 spawned uWSGI master process (pid: 58) spawned uWSGI worker 1 (pid: 73, cores: 1) spawned uWSGI http 1 (pid: 74) subscribing to 127.0.0.1:2626:/test 

在主机上,我可以做

curllocalhost:5001

我看到Webserver在容器里问候我。 但是,在做

curl本地主机:1717 /testing

得不到回应。

问题2

我在这里得到任何根本的错误? 我应该testing不同吗?

问题3

我如何debuggingFastRouter?

编辑:

仍然挣扎着这个设置。 我正在使用一个单独的VPS作为ftrtrouter。 它开始使用

 uwsgi --uid fastrouter --master --fastrouter :80 --fastrouter-subscription-server :2626 --daemonize uwsgi.log --pidfile ./uwsgi.pid --chmod-socket --chown-socket fastrouter 

警告 :在复制上述呼叫之前,请考虑一下,因为它公开开放了订阅服务 – 我的计划是使用uwsgi提供的密钥签名工具保护它,因为VPS没有可用的专用networking。

netstat -anp显示

 tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 843/uwsgi udp 0 0 0.0.0.0:2626 0.0.0.0:* 843/uwsgi unix 3 [ ] STREAM CONNECTED 9089 843/uwsgi unix 3 [ ] STREAM CONNECTED 9090 843/uwsgi unix 3 [ ] SEQPACKET CONNECTED 8764 843/uwsgi unix 3 [ ] SEQPACKET CONNECTED 8763 843/uwsgi 

无论如何,使用--http :5000 --module server --callable env --enable-threads --subscribe-to [Subscription-Server-IP-Address]2626:/test --socket-timeout 120 --listen 128 --buffer-size 32768 --honour-stdin节点与--http :5000 --module server --callable env --enable-threads --subscribe-to [Subscription-Server-IP-Address]2626:/test --socket-timeout 120 --listen 128 --buffer-size 32768 --honour-stdin仍会导致相同的结果 – --http :5000 --module server --callable env --enable-threads --subscribe-to [Subscription-Server-IP-Address]2626:/test --socket-timeout 120 --listen 128 --buffer-size 32768 --honour-stdin to',但是http://[Subscription-Server-IP-Address]/test不可达。 这种路由甚至可能吗? 我所能find的每个例子都只分配了一些子域名,例如[mysub] .example.com,根域名或具有某个端口号的根域名。 这个页面包含一个暗示订阅服务器应该是可路由地址的一部分: http : //projects.unbit.it/uwsgi/wiki/Example 。

所以我有一个后续问题

FastRouter是否意味着让节点发布尚未在DNS区域文件中静态设置的新路由? 我真的不在乎它是http:// [key] .example.com还是http://example.com/ [key],重要的是这些密钥可以在Docker容器中生成uwsgi服务器。

一般来说,“dockered”应用程序运行在不同的networking名称空间中,所以Docker应用程序的环回与fastrouter并不相同。

使用unix套接字进行订阅,它们是进行inter-namespace通信的好方法。

你的命令是好的,fastrouter是非常详细的,所以如果你没有看到它的日志中的消息,它不工作(最终你可以strace它)