1

I've successfully deployed a meteor app with mupx on an EC2-Ubuntu server. Now I've created an additional Websocket server inside the meteor app, which is listening to port 8080, because meteor already uses its own Websocket implementation on port 80. I tested it on my local machine and it works.

I already edited the AWS Security Groups to allow port 8080 from all addresses.

docker ps shows: docker ps output

sudo iptables -L -n shows: iptables list output

How can I forward everything from port 8080 into port 8080 in my meteor application inside the docker container? And does these settings remain, if I redeploy with mupx?

The docker configuration is handled by mupx and you can find the responsible script here: https://github.com/arunoda/meteor-up/blob/mupx/templates/linux/start.sh.

I never used docker before btw

SebKas
  • 342
  • 3
  • 19
  • Do you need to handle traffic on both ports 80 and 8080 from the same docker container? Does meteor allow you to handle more than one port with the same process, or do you need to run multiple processes inside the docker container in order to handle both ports? – Ken Cochrane May 01 '16 at 10:25
  • I need to handle both ports from the same docker container. I basically created a server inside of meteor, like in this answer: http://stackoverflow.com/a/36045419/3049705 – SebKas May 01 '16 at 10:38
  • Ok, does the same meteor process handle traffic for both ports? Or do you need two processes, one for each port? The example you linked to, only shows one port. – Ken Cochrane May 01 '16 at 10:55
  • It's one process which handles both traffics, I guess. On my local machine I start only the one meteor process and it handles the traffic on both ports. – SebKas May 01 '16 at 10:59
  • Ok great, can you update your question with the current docker run command you use, and your dockerfile (if you are using one) and I'll show you how to expose the second port – Ken Cochrane May 01 '16 at 11:02

1 Answers1

3

Two expose a second port in a docker container, you just need to pass the publish flag again with the second port, shown below with the new $PORT2

docker run \
-d \
--restart=always \
--publish=$PORT:80 \
--publish=$PORT2:8080 \
--volume=$BUNDLE_PATH:/bundle \
--env-file=$ENV_FILE \
--link=mongodb:mongodb \
--hostname="$HOSTNAME-$APPNAME" \
--env=MONGO_URL=mongodb://mongodb:27017/$APPNAME \
--name=$APPNAME \
meteorhacks/meteord:base
Ken Cochrane
  • 75,357
  • 9
  • 52
  • 60
  • I've added the line and now `docker ps` shows that it's redirecting from port 32768 to 8080: [](http://i.imgur.com/uaQqehR.png?1) `0.0.0.0:80->80/tcp, 0.0.0.0:32768->8080/tcp` So this worked. Can I also define that it should listen to port 8080 to have something like this: 0.0.0.0:8080->8080/tcp? – SebKas May 01 '16 at 11:39
  • Ok did you set the `$PORT2` variable? If you make that 8080:8080 it will redirect 8080 on the host to 8080 in the container – Ken Cochrane May 01 '16 at 11:41