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.
I'm not sure if I've misunderstood the problem but finding out the endpoints of both apps might help? It's done like this:
dokku url [App #1]
dokku url [App #2]
If you're running nginx, you might want to look at /opt/nginx/conf/nginx.conf
.
来源:https://stackoverflow.com/questions/25184496/dokku-listen-to-multiple-ports-from-an-app