andruschka / pm2-meteor

Simplest way to deploy, scale and run Meteor Apps with PM2.
https://www.npmjs.com/package/pm2-meteor
160 stars 38 forks source link

How to deploy separate json file (pm2-meteor-uat.json, pm2-meteor-pre.json, pm2-meteor-pro.json) #83

Open mahadoang opened 5 years ago

mahadoang commented 5 years ago

How to deploy separate json file ?

pm2-meteor deploy --pm2-meteor-uat.json pm2-meteor deploy --pm2-meteor-pre.json pm2-meteor deploy --pm2-meteor-pro.json

Thank you.

eleventy commented 3 years ago

A bit late, but I just had the same problem. I solved it using package.json deploy scripts:

First, install pm2-meteor as a dev-dependency, not a global package: npm i -d pm2-meteor Also, install cpy-cli as a dev-dependency: npm i -d cpy-cli

Next, put your configs in a deploy folder like .deploy/pm2-meteor-staging.json .deploy/pm2-meteor-production.json and add the normal pm2-meteor.json to your .gitignore

Finally, add a script to your package.json per pm2 file: "deploy-staging": "cpy .deploy/pm2-meteor-staging.json ./ --rename=pm2-meteor.json && pm2-meteor deploy" "deploy-prod": "cpy .deploy/pm2-meteor-production.json ./ --rename=pm2-meteor.json && pm2-meteor deploy"

Once this is setup, you can deploy using: npm run deploy-staging