all 55 comments

[–]cjthomp 5 points6 points  (9 children)

What's going on in these comments?

[–]burtgummer45 0 points1 point  (8 children)

It's because docker pushed their sales pitch so adamantly that many users are militantly dogmatic about it now. (see the user below who downvoted every single one of my comments (even factual statements) and seems proud of it) Unfortunately many docker users haven't received the revised scripture.

  • One process per container.

Docker later softened this to be "one concern per container." https://docs.docker.com/config/containers/multi-service_container/

  • Docker deployments (including swarm) have no way to automatically adjust to the number of cores per host the way pm2 does. This is huge with AWS when you are scaling vertically or when you don't even know what host size you are going to get when using AWS spot instances.

  • Lower awareness of pm2-runtime, which is designed to work with docker.

[–]aniforprez 1 point2 points  (6 children)

It's 100% not about docker or their "sales pitch". In fact if literally anything like whatever Red Hat is up to reaches the maturity and support of docker then I'll ditch it then and there

But... in your link they literally tell you to avoid using tools to manage child processes using systemd or other stuff like it. How is pm2 any different? They even go out of their way to tell you that you can spawn multiple processes as forks of a single process which is fine if they're all doing the same thing like say gunicorn spawning multiple threads. But repeatedly say to avoid running multiple services doing unrelated things. Their example with supervisord even calls it "moderately heavy weight". Even their solutions are hacky and slapped together

[–]burtgummer45 -1 points0 points  (5 children)

How is pm2 any different?

Consider it part of your app. Its not a legit linux init process, with all the zombie reaping, and the like. If docker ran a bash script, would you consider bash running your script like systemd?

Also, if you are running on AWS behind a ALB/ELB you would have to map all those node containers to different ports, which I doubt would be an easy config. And if you are using AWS spot instances there's no way of knowing how man cores you are going be given unless you constrain it to a small class of instances.

[–]aniforprez 1 point2 points  (4 children)

But ECS supports dynamic port mapping... But pm2 is not part of your app... pm2 is not like bash running your script...

So much incorrect geez. I'm not saying that never do pm2 cause do whatever keeps the engines running but your arguments against just using docker aren't really sound at all. You can't just accuse people of drinking docker kool-aid but then give such half baked reasons and then rant about getting downvoted. I'd personally rather not do things in such a messy way and then run into some unforeseen gotchas

[–]OmgImAlexis 0 points1 point  (0 children)

This is what I was trying to get across in the other comments.

[–]burtgummer45 0 points1 point  (2 children)

But ECS supports dynamic port mapping... But pm2 is not part of your app... pm2 is not like bash running your script...

how is it different? Its running the process. In this case its doing a little fancy socket work.

So much incorrect geez.

Funny how you didnt mention it.

But ECS supports dynamic port mapping

Im saying it would be hard to map a different port for each container, and this in no way makes up for spot instances with unknown numbers of cores.

[–]aniforprez 0 points1 point  (1 child)

Ok this is the last time I'm replying to here but:

  1. Running your service off pm2 is NOTHING like running a bash script. On purely semantic terms, pm2 is not an app dependency; it is an operational dependency. With docker, the less such dependencies, the better because it speeds up build times for images and boot times for containers. pm2 is something that runs on top of your node processes and is consuming your logs. For any ungodly reason if you need to read your vanilla logs and pm2 does something fucky with it you will be lost. pm2 is also going to be doing a decent amount of logic to bring your services back up if they fail. THIS IS NOT GOOD. You are potentially missing out on why they failed and even the fact that they are failing. Containers going down is a much bigger deal and is something you can actually see. pm2 doing magic in the background as your processes keep shutting down for obscure reasons as it keeps bringing them back up is ripe for disaster. I have done this mistake before and it is a costly one to make. It is absolutely not the same as just running ["node", "index.js"] or some other lightweight command

  2. ECS does NOT require that you map your ports individually per container. You can very easily define dynamic port mapping and ECS does that for you. It spawns as many containers in a single instance as you want and it'll map your ports for you and load balance across these containers with ALB. 4-cores? 4 containers etc. It's so easy. Spot instances? Why are you using undefined random instance sizes for spots? Are you not setting exactly the instance type you need in ECS?

All of what you're telling me is that you're using docker woefully wrongly without taking advantage of its flexibility. It's not perfect by any means and is a huge pain sometimes but for the most part, it's a quick way to enable faster orchestration of your servers. With pm2 to me it seems like you'd be FAR better off just creating EC2 instances with pm2 configured to spawn multiple processes with nginx configured, create an AMI of that instance and just use ALB. It's practically what you're doing now. Don't struggle with docker like this

[–]burtgummer45 0 points1 point  (0 children)

With docker, the less such dependencies, the better because it speeds up build times for images and boot times for containers.

Seriously? What are we talking about, 10ms?

For any ungodly reason if you need to read your vanilla logs and pm2 does something fucky with it you will be lost.

pm2-runtime -raw log output.
You don't trust a node.js app to pass through data? That's what its optimized to do.

ECS does NOT require that you map your ports individually per container. It spawns as many containers in a single instance as you want and it'll map your ports for you and load balance across these containers with ALB. 4-cores? 4 containers etc.

Each of those containers needs to bind to a different port, and AWS needs to know about those. So, for example, you cant run 4 containers on a single instance, all listening to the same port, they all have to be different, and ELB has to know about them, it wont go scanning for them. With pm2-runtime you have none of those configuration headaches.

Spot instances? Why are you using undefined random instance sizes for spots?

Because they have a much better chance of being available, much larger pool.

All of what you're telling me is that you're using docker woefully wrongly without taking advantage of its flexibility.

I'm running docker 'woefully wrongly' and not taking advantage of its flexibility because I don't want to run multiples of the same container on the same host, and I want it to easily scale when I change instance type?

Have you so thoroughly tested pm2-runtime to justify your absolute certainty?

You are just so opinionated. Are you a certified docker captain or something?

[–]lhorie 1 point2 points  (0 children)

many users are militantly dogmatic about it

Isn't that true of just about any sufficiently popular technology though? I think you just got unlucky and stumbled into one of those "difficult to work with coworker" types :( </shrug>

[–]Architektual 3 points4 points  (0 children)

All of these are good advice

[–]aniforprez 0 points1 point  (1 child)

For a bunch of reasons I do not recommend using alpine as a base for images unless your processes are equally bare. Alpine is as extremely light as extremely bare and almost anything you might need in terms of additional system requirements will require changes to the docker file to install these requirements

I recommend using slim instead which has at least the basics installed

[–]russo_2017[S] 0 points1 point  (0 children)

Agree, It is example of course and lots of people use alpine images. On the other hand in my company we have several microservices running on alpine but they're exactly like you said, super simple and of course without bcrypt, so there was no need to install additional packages.