Anudeep Chandra
Anudeep Chandra

Reputation: 11

How to reload sails.js application without "restarting" the process?

I have a sails.js application configured for ssl with key,cert and ca files in config/local.js with fs.readFileSync(), I would like to know if we have a way to reload the application(managed by pm2) without restarting the process whenever the ssl cert files are changed. I tried with watch and pm2 reload but in both the cases it restarts the process, but i want the server to reload but not restart. If this is not possible please let me know if there is a way to achieve my service using latest certs whenever they are changed accordingly. Any suggestions regarding this would be of great help!!

I have tried pm2 reload, and watch for the certificate changes but these are restarting the server which is not as expected

If the certificates configured for ssl are changed the pm2 process should be reloaded instead of being restart

Upvotes: 0

Views: 215

Answers (1)

Nay Lin Aung
Nay Lin Aung

Reputation: 73

You can run your application in 'cluster mode' with at least 2 clusters and when you want to apply changes, you can restart/reload one cluster at a time.That way, your application can be 0-second-downtime.

Upvotes: 0

Related Questions