-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zero downtime on non-upgrade deployments #34
Comments
Also introduced 'smart' command `magento:setup:db:upgrade` which only updates the database if necessary. issue #34
When will you integrate this enhancement to deploy.rake? |
@michael811 Unfortunately it's still a work-in-progress and I have no ETA, but I hope to have it complete in the next couple of weeks. Been working on it a good bit over the last few days, and am making progress though! :) |
@davidalger care to look another look at this feature? Would really love to see it. |
At this moment |
@alinalexandru - it's mentioned in the original issue why this is the case.
It's not possible to know programatically if the upgrade commands are needed or not, so they will run every time to ensure the database is upgraded when needed. |
I saw that the output is checked. So there is a way to check if is needed or not |
Alright everybody, @roman204 sent in PR #104 which got me started on this more in earnest. I'm polishing it up and it'll be out soon as v0.8.0! Once it's done, you'll see something like the following in a deployment:
Maintenance mode disablement is going to work by setting :magento_deploy_maintenance to false when the checks indicates maintenance mode is not required. Both of the following will need to pass for this to happen:
|
And an example of where the config.php has not changed, but some modules are requiring db updates:
|
Finally the test output when db changes are not made, but the config.php file differs:
|
@davidalger awesome feature! Thank you very much, this helps us a lot. |
The current deployment process uses
bin/magento setup:upgrade
for the purpose of upgrading the schema and data in a Magento 2 installation if needed. This command also re-generates the app/etc/config.php file. Due to the errors Magento 2 will throw up if a site has modules requiring schema and/or data updates installed, the site must be put into maintenance mode before linking the new release and running setup:upgrade. This results in a downtime between 5 and 8 seconds on average (by my rather unscientific estimation based on real-life experience… ;)).Stated goal of this task: eliminate all downtime for deployments which do not trigger schema or data upgrades.
Additionally, as the app/etc/config.php file is regenerated by the setup:ugprade command, this causes a potential fringe situation on a multi-node cluster deployment (as of 0.5.3) where setup:upgrade updates this file on one (but not all) nodes in the deployment. This is only an issue if the config.php file re-created when this runs is different (for some reason or other) than the one committed to the repository. Eliminating the use of setup:upgrade will have the effect of eliminating this potential issue as well.
At the suggestion of @hostep over on issue #33 I went looking into the use of
setup:db:status
and found the following:The built-in
setup:db:status
command will report on whether or not any installed module(s) require schema and/or data upgrade. Example output of this command:or
The command returns the same exit code of
0
regardless of the db status.There are also two other interesting built-in console commands,
setup:db-schema:upgrade
andsetup:db-data:upgrade
. Upon my investigation into the code, the difference between these commands andsetup:upgrade
is the following:setup:upgrade
callsupdateModulesSequence
,installSchema
, andinstallDataFixtures
whereas the other two commands only callinstallSchema
andinstallDataFixtures
respectively.These additional commands are available in versions 2.0 and 2.1 making no special version checks necessary.
The result of this task will be to cease use of setup:upgrade and transition to only calling the schema/data upgrade specific tasks on deploy, eliminating the potential fringe issue with a deploy creating unexpected changes to config.php as well as eliminate all downtime on deploys which do not introduce module (schema and/or data) version changes.
The text was updated successfully, but these errors were encountered: