Dokku: Listen to multiple ports from an app
Asked Answered
R

2

8

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!

Redness answered 7/8, 2014 at 13:58 Comment(2)
Did you manage to find a work around?Expensive
Haven't tried but: https://mcmap.net/q/1473196/-dokku-expose-two-ports-from-an-applicationRios
T
2

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.

Tummy answered 29/10, 2014 at 12:14 Comment(0)
E
0

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.

Emmyemmye answered 11/10, 2014 at 13:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.