-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Magento 2: Changed upgrading database #3812
Magento 2: Changed upgrading database #3812
Conversation
… once if multiple servers are selected for the deployment
Thanks for the PR! Changing However, I don't see this working;
Afaik As a sidenote, we ran into accidentally enabling non-listed modules error with <?php
$output = [];
exec('php bin/magento module:status --disabled', $output, $exitCode);
// If No disabled modules, exit with exit code 1
if ($exitCode === 1) {
exit(0);
}
$config = include 'app/etc/config.php';
$whitelistedDisabledModules = $config['whitelisted_disabled_modules'] ?? [];
$messages = [];
foreach ($output as $module) {
if (!in_array($module, $whitelistedDisabledModules)) {
$messages[] = $module . ' is disabled in modules but not whitelisted under whitelisted_disabled_modules in app/etc/config.php.';
}
}
if (!empty($messages)) {
foreach ($messages as $message) {
echo $message . PHP_EOL;
}
exit(1);
} else {
exit(0);
} Maybe you'll find it useful too. |
Yeap. Once should be applied to tasks |
…is only executed once.
Perfect! |
@dverkade I just had time to take a deeper look at this, and I have some concerns. The installSchema is now ran from The installDataFixtures is now ran from So far so good. However, now $installer->removeUnusedTriggers();` seems not to be triggered. Also, app:config:import is not ran at this point. Won't this cause issues when people put configuration settings in I feel like we should add |
@peterjaap I've checked and the app:config:import command is already triggered before the db:upgrade here. So no issue there. Regarding the removeUnusedTriggers() function. That's interesting and IMHO is an issue of Magento itself. Shouldn't that be part of the |
@dverkade I guess it won't immediately introduce issues when the unused triggers aren't removed, it's more a part of good database hygiene. Weirdly enough, that |
It also looks like that the |
The nicest solution would be that core Magento will contain a console command to delete the unused triggers, so we can call that too. Or that it is behind a flag in the |
* origin/master: (40 commits) Improve the configuration options console output in provision:configure (deployphp#3840) Update Craft CMS deploy recipe (deployphp#3839) [automatic] Update docs with bin/docgen Update provision.php Feature/UI enhancements (deployphp#3835) Hotfix/v7.4.0: Fixes caddyfile and realpath errors in provision:website (deployphp#3837) [automatic] Update docs with bin/docgen docs(recipe/shopware): add code syntax highlighting (deployphp#3834) [automatic] Update docs with bin/docgen docs(recipe/magento2): fix typo in conccurent (deployphp#3830) [automatic] Update docs with bin/docgen magento2 theme processing fix for 3786 (deployphp#3818) use md5 of task name for section id in gitlab ci (deployphp#3817) [automatic] Update docs with bin/docgen Magento 2: Changed upgrading database (deployphp#3812) [automatic] Update docs with bin/docgen Shopware: Added `deploy:update_code` (deployphp#3816) [automatic] Update docs with bin/docgen Update nodejs to LTS version (deployphp#3815) Update LICENSE ...
Hi guys, we recently upgraded our deployer package from v4.7.0 to v7.5.5 and noticed that this change breaks deployments (to production) if dev modules are committed in the app/etc/config.php file. Due to this change, we had to rollback the module update. Is this something that can be fixed? |
@rickvb97-io why would there be dev modules in an config.php that goes to production? |
@rickvb97-io your issue is unrelated to this pull request. If you have modules in the dev section of your composer.json they should not be in your app/etc/config.php file as PHP Deployer will only install non dev modules when deploying (to production). So this will cause your module not to be available in Magento and cause issues that the enabled module in app/etc/config.php can't be found. |
@peterjaap Because I don't think there is currently no option to exclude dev modules on a production environment in the config.php. Symlinking the config.php isn't an option, because new modules aren't added. Not committing the dev modules in the config.php is inconvenient and only causes hassle among (our) developers. If you have an idea, I would like to hear it. |
@rickvb97-io we use a system where we symlink the config.php in the repository to |
@rickvb97-io @peterjaap As mentioned in my earlier comment, this is not an issue related to this PR. IMHO this should not be discussed here and if you want to continue the conversation you should open up a separate issue for it. |
Agreed |
This PR addresses two issues:
setup:upgrade
however this command does more then only upgrading the database. It can change the sort order of the modules listed in app/etc/config.php or if a module is not listed in that file it will enable that module. IMHO deployments should be consistent, and the app/etc/config.php shouldn't be changed during deployment. That's why I changed this into two commands that actually only update the DB schema and DB data. I've borrowed this from the Magento 2 Capistrano implementation, which already does it like this: https://github.com/davidalger/capistrano-magento2/blob/master/lib/capistrano/tasks/magento.rake#L261