2

What is the recommended way to deploy changes (for example change in some Content Type model) from development to production without downtime?

I’m using this setup.

setup

I have development instance with development postgres database. On production I have 3 strapi instances (serving both api & admin, using the same production postgres database) and those instances are behind loadbalancer.

Lets say that I have Content Type named: Article (both on development and deployed on production). Lets assume that I want to change that content type for example I want to add some fields and remove some fields in Article content type.

How to deploy changes to production without downtime?

I’ve done some tests and when I for example update Strapi Production Instance #1 to pull new code for updated models, strapi will update database of course. And from that time Strapi Production Instance #2 and #3 have problems serving Admin panel for example (javascript errors because database was changes but JS model files are not updated). After I updated code on instance #2 and #3 everything works as expected.

But doing something like this on “working product” will be visible as downtime.

How to properly handle this situation? Thanks for help!

Tereska
  • 751
  • 1
  • 7
  • 25

1 Answers1

0

Could PM2 solve this problem? Strapi mentiones this in their documentation

PM2 Runtime allows you to keep your Strapi project alive and to reload it without downtime.

Strapi Docs v4

Enrique
  • 361
  • 4
  • 13
  • I doubt that this will solve the problem. When the database has changed and one strapi instance os on the pre-database-change code level, I guess PM2 can't do anything about that. Maybe you have to resort to switch off #2 and #3 as soon as you have updated #1 and re-enable each of them when they are updated as well. – Robert Hufsky Jun 11 '23 at 14:42