Dokku:从应用程序中收听多个端口 [英] Dokku: Listen to multiple ports from an app
问题描述
当我部署应用程序时,我需要运行这两个应用程序,并访问端口80上的主应用程序和某个其他端口上的kue(最好是该应用程序侦听的端口)。
我把这两个应用程序放在Procfile上,如:
web:server = thats-wow NODE_ENV =生产节点服务器/ app.js
worker:node server / kueUi.js
procfile上的多个进程由dokku-supervisord插件处理: https://github.com/statianzo/dokku-supervisord (它支持所有流程类型:web,worker等)。
我已经尝试过第二个进程类型的web和worker应用程序
问题
部署时,Dokku只是使最后一个应用在procfile(在这种情况下是kueUi)中指定的可以通过端口80访问,似乎没有办法访问指定的那个。
我尝试通过第一个应用程序侦听的端口访问,但不能工作。
我想它需要一些nginx配置来转发请求某些端口到应用程序监听的docker容器中的端口。
我需要如何
1。 http://example.com - 达到我的主要应用程序
2. http://example.com:5000 - 到达第二个应用程序(Kue UI)
找不到有关如何实现这一点的任何文档。任何帮助都非常感谢!
这可以通过使用 https://github.com/statianzo/dokku-shoreman 或 https://github.com/statianzo/dokku-supervisord ,但您需要手动确保dokku主机上没有端口冲突。
当 https://github.com / progrium / dokku / issues / 732 已解决,您将能够部署第二个应用程序作为工作人员,将在由docker分配的端口上侦听。
I'm deploying a node app (with express js) with dokku. My app consists of 2 express js apps that listen to two different ports. One being the main app and the other is web inteface for kue - A simple job queue for node js. When I deploy the app I need to run both of these apps and access the main app on port 80 and the kue one on some other port(preferably the port that the express app listens to).
I have put both of these apps on the Procfile like:
web: server=thats-wow NODE_ENV=production node server/app.js
worker: node server/kueUi.js
The multiple processes on the procfile are handled by dokku-supervisord plugin: https://github.com/statianzo/dokku-supervisord (It supports all process types: web, worker, etc).
I have tried both 'web' and 'worker' for process type of the second app.
The problem
On deploying, Dokku simply makes the last app specified in the procfile (kueUi in this case) accessible via port 80 and there seems to be no way to access the one specified first. I tried accessing via the port the first app listens to, but that din't work.
I guess it needs some nginx config to forward requests on a certain port to that port in the docker container that the app listens to.
How I need it to be
1. http://example.com - reaches my main app
2. http://example.com:5000 - reaches the second app (Kue UI)
Couldn't find any documentation on how to achieve this. Any help is much appreciated!
This can be hacked together by using https://github.com/statianzo/dokku-shoreman or https://github.com/statianzo/dokku-supervisord, but you need to manually make sure that there are no port collisions on the dokku host.
When https://github.com/progrium/dokku/issues/732 is resolved, you will be able to deploy the second app as a worker that will listen on a port assigned by docker.
这篇关于Dokku:从应用程序中收听多个端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!