If you have a new module and you need to run setup:upgrade then I don't see a way where you can have zero downtime. It's always going to be 10-20 seconds down because you need to upgrade the database. Or am I missing something?

Even if you're deploying to a different folder and then when all files are generated you symlink the live environment to this folder, you still have to take care of the database.

2 Answers 2


I wonder what environment you are working in where 10-20 seconds, or even a few minutes, of downtime would be a dealbreaker. Naturally, that's not ideal, but I have to imagine that's a pretty small price to pay, especially if you deploy during non-peak hours.

M2 developer documentation: Deploy Magento to production. As of this writing, the docs are sparse, and link to an external GitHub issue for discussion. However, those official docs are a good place to keep an eye on.

My team is investigating using Capistrano to deploy M2. We have not settled on a final process yet, but a simple Google search ("capistrano magento 2") shows that a number of people are experimenting with the same.

Finally there are various schemes like blue-green deployment that also seek to minimize downtime. Blue-green in particular is like having a staging server, but at the critical time you update DNS to point from blue to green, making green into live and blue into "staging." For the next deployment blue becomes live again. This way downtime is theoretically zero, and changes happen as quickly as the DNS change propagates.

  • 1
    thanks for the useful links. DNS never propagates fast enough in my opinion. I'd stick to symlinking folders. Deployments during non-peak time are risky. Non-peak time would essentially be very early in the morning or very late at night. If you're a small company you may not have enough staff for it. Commented Dec 4, 2016 at 15:22
  • 1
    I don't really understand how blue-green can work here without requiring all sorts of database syncing to happen, which seems risky. The issue is that module installation requires db updates to be done.
    – Rich S
    Commented Jan 26, 2018 at 14:05
  • @RichS As far as the software is concerned, the syncing is not a problem. But yes it can get tricky to avoid losing orders or other customer data - see the source I linked. It recommends actually using the same db. Again, going back to the premise of the question, when is 10 min of downtime really going to be an issue? I would first seek a non-technical solution, like deploying at 2am, before introducing needless complexity.
    – nshiff
    Commented Jan 26, 2018 at 16:47

The easiest way for me is to use Magefan Magento 2 Zero Downtime module. It takes 5 min to install it, as a regular Magento 2 extension. And then just run this single command:

bin/magento magefan:zero-downtime:deploy

instead of these:

bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.