Unitech / pm2

Node.js Production Process Manager with a built-in Load Balancer.
https://pm2.keymetrics.io/docs/usage/quick-start/
Other
41.49k stars 2.62k forks source link

declare app dependencies inside ecosystem #2831

Open mario-mui opened 7 years ago

mario-mui commented 7 years ago

Supporting information

I has json file like this:

"apps": [

  {
       "name": "app1"
       "scripe" : "app.js"
       "cwd": "/app1/"
       "wait_ready": true
  },

 {
       "name": "app2"
       "scripe" : "app.js"
       "cwd": "/app2/"
        "wait_ready": true
  }

]

Can pm2 start /app2/app.js after App name 'app1' status is online?

PM2 version: 2.4.4
Node version: 6.9.4
Linux
vmarchaud commented 7 years ago

We should add a option to be able to declare dependencies between app like docker-compose do.

abawchen commented 4 years ago

Any update? Thanks.

ParagMeshram commented 4 years ago

This would be a really good idea as this is a common scenario in production. Any update on this?

yoonwaiyan commented 3 years ago

Any update on this? I would like to use this feature too.

gtrabanco commented 2 years ago

2022 any update?

bgfernandes commented 1 year ago

This would be a good feature to have.

patric0889 commented 1 month ago

No updates? :(

DesignByOnyx commented 1 week ago

This would be useful for having startup parity between k8s, docker, and others. K8s provides "init-containers", and docker compose allows you to declare depends_on - both allow you to do things before your app runs. This includes (but is not limited to):

These tasks are required for the app to run, but are not the concern of application code. Many of these processes need to run with special admin/root privileges and should run separately (sandboxed) from the app. I know we can wrap pm2 in our own scripts to do all of this, but it would be much cleaner to make it declarative inside pm2 configs. This would allow pm2 configs to mirror k8s and docker.