Unitech / pm2-deploy

Deploy part of PM2
http://pm2.keymetrics.io/docs/usage/deployment/
MIT License
178 stars 72 forks source link

How to deploy a single app from a monorepo without deploying the whole monorepo? #164

Open bitliner opened 5 years ago

bitliner commented 5 years ago

Let's assume to have a monorepo (e.g. Lerna based).

Example:

packages/
  app1/
    web.js
  app2/
    web.js

When I run pm2 deploy, I would like to deploy a sub-folder of the monorepo - e.g. app1, not the whole mono-repo.

Unfortunately, I don't find any option to allow such a similar case.

Avoiding to deploy the whole monorepo would speed up deploy time, save space and make the deployment result more handy to manage (without unwanted folders/packages, etc.)

Do you plan to add any support for it?

rblmdst commented 5 years ago

@bitliner Do you found a solution to manage a monorepo ? I am looking for something similar.

bitliner commented 5 years ago

Not really.

pm2 does not allow to overwrite the git command to clone the repo (otherwise you could use git subtree to get only a sub-folder).

You could manually handle such case in the pm2 post-deploy hook (to transform the monorepo folder into a single package folder).

Do you have other recommendations?

rblmdst commented 5 years ago

No I don't have other recommendation, I had also think about using git subtree/submodule (but the are generally harder to maintain). I am working on a multi-platform (Admin, Public, Private, ) but each part need to be deployed separately (different domains). So the idea is to be able to build and auto-deploy one part of the platform without touching the others, but not to deploy all at the same time, one can be updated without the others. I finally wrote a custom script to do it.

Thank you.

TheSalarKhan commented 5 years ago

Any updates on this? I ran into the same complication, I don't want to move to ansible for simply doing this. This would be a great pm2 feature.

Unitech commented 5 years ago

But that involves having a different git repo for each service?

Else a simple restart of the specified application would do the job too, or maybe using a different ecosystem file like service1.config.js, service2.config.js

So you can run:

pm2 deploy service1.config.js production

pm2 deploy service2.config.js production