New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add official image for PM2 runtime #3888

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
5 participants
@vmarchaud

vmarchaud commented Jan 10, 2018

Summary

This PR add the pm2 file as requested in the README, the PR for the documentation is here.

Github repo: https://github.com/Unitech/pm2

Checklist for Review

NOTE: This checklist is intended for the use of the Official Images maintainers both to track the status of your PR and to help inform you and others of where we're at. As such, please leave the "checking" of items to the repository maintainers. If there is a point below for which you would like to provide additional information or note completion, please do so by commenting on the PR. Thanks! (and thanks for staying patient with us ❤️)

  • associated with or contacted upstream?
    - @keymetrics / @Unitech / @vmarchaud
  • does it fit into one of the common categories? ("service", "language stack", "base distribution")
    - not sure but i would say service
  • is it reasonably popular, or does it solve a particular use case well?
    - see https://github.com/Unitech/pm2
  • does a documentation PR exist? (should be reviewed and merged at roughly the same time so that we don't have an empty image page on the Hub for very long)
    - docker-library/docs#1118
  • dockerization review for best practices and cache gotchas/improvements (ala the official review guidelines)?
  • 2+ dockerization review?
  • existing official images have been considered as a base? (ie, if foobar needs Node.js, has FROM node:... instead of grabbing node via other means been considered?)
  • if FROM scratch, tarballs only exist in a single commit within the associated history?
  • passes current tests? any simple new tests that might be appropriate to add? (https://github.com/docker-library/official-images/tree/master/test)
    - We have our tests here and the build are done here
@vmarchaud

This comment has been minimized.

Show comment
Hide comment
@vmarchaud

vmarchaud Jan 10, 2018

We know that currently we use the latest version each time we build the image, and we are looking for solution but since we need the have different image for each node version, we will need to build 20 images (5 for each node version) and our versioning would be weird :

  • pm2:2.9.2-node8-alpine
  • pm2:2.8.0-node7-wheezy

Do someone has an idea on how to handle this without these problems ?

vmarchaud commented Jan 10, 2018

We know that currently we use the latest version each time we build the image, and we are looking for solution but since we need the have different image for each node version, we will need to build 20 images (5 for each node version) and our versioning would be weird :

  • pm2:2.9.2-node8-alpine
  • pm2:2.8.0-node7-wheezy

Do someone has an idea on how to handle this without these problems ?

@TimWolla

This comment has been minimized.

Show comment
Hide comment
@TimWolla

TimWolla Jan 10, 2018

Contributor

As a Docker user that previously used pm2 outside of containers [1] I feel like this encourages users to not use Docker in a way Docker is optimized for: Immutable, reproducible containers that run a single atomic service.

The main issue of the PID 1 problem inside containers is easily solved by adding the --init flag, clustering should be done using Docker swarm and the last major issue “Graceful application Start and Shutdown” I don't understand (though I'm a bit out of the loop with pm2's features).

All in all I don't really see the benefit in an official pm2 image that after all only saves the user a single RUN npm install pm2 -g in their Dockerfile and causes maintenance work for both you and the official images team.

Am I missing something?

[1] In fact I still do on a machine for a few legacy services.

Contributor

TimWolla commented Jan 10, 2018

As a Docker user that previously used pm2 outside of containers [1] I feel like this encourages users to not use Docker in a way Docker is optimized for: Immutable, reproducible containers that run a single atomic service.

The main issue of the PID 1 problem inside containers is easily solved by adding the --init flag, clustering should be done using Docker swarm and the last major issue “Graceful application Start and Shutdown” I don't understand (though I'm a bit out of the loop with pm2's features).

All in all I don't really see the benefit in an official pm2 image that after all only saves the user a single RUN npm install pm2 -g in their Dockerfile and causes maintenance work for both you and the official images team.

Am I missing something?

[1] In fact I still do on a machine for a few legacy services.

@Unitech

This comment has been minimized.

Show comment
Hide comment
@Unitech

Unitech Jan 11, 2018

Hi @TimWolla,

Using PM2 to run Node.js in production is beneficial for these reasons:

  • Faster restart; instead of having the whole containers being restarted in case of exception / memory overflow etcetera, having pm2 handling this directly inside containers reduce the downtime of the instance (from seconds to milliseconds)
  • Process fallback; having two stateless processes load balanced with pm2 (you might be familiar with the cluster mode) avoid sending http queries to a a dying process, increasing again the SLA of the application
  • Process flow control; pm2 offers different methods for executing code before and after the process get online/shutdown
  • Automatic source map discovery; when running transpiled source code with pm2, in case of exception, pm2 will automatically resolve the exception and will print out the original line

Just to cite some of the key features when using pm2 inside containers (w/o speaking about process files, automatic json logs transposition and so on) and we are moving toward offering more and more features for Node.js users that use containers.

I don't think the "single atomic service" is still a credo at Docker; I let you compare how PHP, Python, Java applications are handled inside containers.

After all it's a question of technical choice. We have a growing user base using Docker & PM2 and we are now doing efforts to answer to the community by offering a good integration with Docker (now there is even a pm2-docker binary that is a pre-configured PM2 for Docker + we built an Docker official image and now there is this PR).

Best,
Alexandre

Unitech commented Jan 11, 2018

Hi @TimWolla,

Using PM2 to run Node.js in production is beneficial for these reasons:

  • Faster restart; instead of having the whole containers being restarted in case of exception / memory overflow etcetera, having pm2 handling this directly inside containers reduce the downtime of the instance (from seconds to milliseconds)
  • Process fallback; having two stateless processes load balanced with pm2 (you might be familiar with the cluster mode) avoid sending http queries to a a dying process, increasing again the SLA of the application
  • Process flow control; pm2 offers different methods for executing code before and after the process get online/shutdown
  • Automatic source map discovery; when running transpiled source code with pm2, in case of exception, pm2 will automatically resolve the exception and will print out the original line

Just to cite some of the key features when using pm2 inside containers (w/o speaking about process files, automatic json logs transposition and so on) and we are moving toward offering more and more features for Node.js users that use containers.

I don't think the "single atomic service" is still a credo at Docker; I let you compare how PHP, Python, Java applications are handled inside containers.

After all it's a question of technical choice. We have a growing user base using Docker & PM2 and we are now doing efforts to answer to the community by offering a good integration with Docker (now there is even a pm2-docker binary that is a pre-configured PM2 for Docker + we built an Docker official image and now there is this PR).

Best,
Alexandre

@tianon

This comment has been minimized.

Show comment
Hide comment
@tianon

tianon Jan 11, 2018

Member

@vmarchaud I think there's been a little misunderstanding here -- @TimWolla is definitely not confused about the benefits of PM2, but on the contrary is a fan (and is actively using it in at least one deployment, from the sounds of it)

The thing @TimWolla is trying to point out is that having a dedicated pm2 image doesn't make much sense, and that it'd make a lot more sense for folks to simply include RUN npm install ... and CMD in their own images (since that's all that's required). That would cut out the maintenance burden on you folks for maintaining every FROM node + supported pm2 version combination, us the maintenance burden of reviewing those, and our servers the queue length to build/push them all.

There have been other images somewhat similar to what's proposed here, at least in their intended usage, that have since been deprecated.

The most similar that comes to mind is celery: docker-library/docs#880 (docker-library/celery#12, docker-library/celery#1 (comment)). It's only useful in the context of adding one's own application code, and is not meaningful to run as a standalone service (similar to pm2).

Other examples I can think of are django (docker-library/docs#630) and rails (docker-library/docs#503).

Member

tianon commented Jan 11, 2018

@vmarchaud I think there's been a little misunderstanding here -- @TimWolla is definitely not confused about the benefits of PM2, but on the contrary is a fan (and is actively using it in at least one deployment, from the sounds of it)

The thing @TimWolla is trying to point out is that having a dedicated pm2 image doesn't make much sense, and that it'd make a lot more sense for folks to simply include RUN npm install ... and CMD in their own images (since that's all that's required). That would cut out the maintenance burden on you folks for maintaining every FROM node + supported pm2 version combination, us the maintenance burden of reviewing those, and our servers the queue length to build/push them all.

There have been other images somewhat similar to what's proposed here, at least in their intended usage, that have since been deprecated.

The most similar that comes to mind is celery: docker-library/docs#880 (docker-library/celery#12, docker-library/celery#1 (comment)). It's only useful in the context of adding one's own application code, and is not meaningful to run as a standalone service (similar to pm2).

Other examples I can think of are django (docker-library/docs#630) and rails (docker-library/docs#503).

@simonepri simonepri referenced this pull request Jan 12, 2018

Open

Change of direction #53

@vmarchaud

This comment has been minimized.

Show comment
Hide comment
@vmarchaud

vmarchaud May 10, 2018

@tianon Forgot to answer but thanks for the explanation, i understand that the cost is too high here !

vmarchaud commented May 10, 2018

@tianon Forgot to answer but thanks for the explanation, i understand that the cost is too high here !

@vmarchaud vmarchaud closed this May 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment