-
-
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: Cache key id prefix #3453
Conversation
@antonmedv This is an updated version of this #3388 It now does all the operations on the server and should be a bit easier to see what's going on The general gist is that during deployment, we copy the configuration and update the cache keys for the new deployment so that it uses it own totally separate cache to the current live site. It then moves the updated configuration in place to be the live configuration ready for next deployment |
Looks good to me. 👍🏻 |
dde8ca9
to
795481b
Compare
@peterjaap please review |
795481b
to
cb9a5e9
Compare
Just rebasing the docs again |
@peterjaap merging? |
cb9a5e9
to
37b373e
Compare
Rebased docs again |
@valguss I'm still unsure what problem this exactly solves. I understand what it does, but I don't know which issues this fixes. So I'm hesitant to include new code for something that doesn't effect everyone. |
Ahh, The issue is based from here davidalger/capistrano-magento2#151 Hope that explains it more Cheers Tom |
@valguss so this is in the scenario where you run |
So it runs in the pipeline but because the cache in redis would be shared between the current version and the deploying version, the deploying version wouldn't necessarily generate all the classes required to run. We see this happening where we add new modules and the dependency injection is not created because the production cache dosen't know about the new module. |
@valguss ok so it does run in a pipeline, but it runs on the production machine and not on an isolated build runner? |
That's correct. Most of the Magento commands run in the deployment folder on the deployment server |
In that case I'm not in favor of merging this into the default recipe since running those commands on the production server instead of a build pipeline isn't standard (or advised) practice. What do you think @schmengler / @Schrank ? |
Not sure I follow. All the magent2 commands in the recipe run on a target server before being pushed live? Maybe I've confused the situation |
@valguss ok I misunderstood, this recipe does indeed run every command straight on the production server (I work on another one that does a push-only approach from a runner instance, hence the confusion). I've added some comments. |
Thanks @peterjaap I'll work through those and get another push later today. Appreciate the input :) |
@valguss what is the reason of manipulating |
It's like this because the |
it could be set after the symlink has been switched |
Oh, I should have read the whole conversation
I'm only using artifact deployment where setup:di:compile is not executed on the target server, so as long as this is not affected by default, I'm fine with whatever helps your use case |
Unfortunately, it needs to be set before then as the fresh cache is required during the Magento compile section. Without this change, the currently live and deploying codebases share the config and cache during |
f4ef8a1
to
1902823
Compare
1902823
to
99267c3
Compare
Now updated to use a config flag to enable |
@peterjaap @schmengler let's merge it and release? |
@valguss could you move the if check That way, the task itself doesn't start if So:
and
|
@peterjaap That's now added. Cheers |
Ok, LGTM! |
FYI, I don't mind this feature because it's optional, but it will break your env.php file if you follow good practices, such as using preload keys 'cache' => [
'frontend' => [
'default' => [
'id_prefix' => '061_',
'backend' => 'Magento\\Framework\\Cache\\Backend\\Redis',
'backend_options' => [
'preload_keys' => [
'061_EAV_ENTITY_TYPES',
'061_GLOBAL_PLUGIN_LIST',
'061_DB_IS_UP_TO_DATE',
'061_SYSTEM_DEFAULT',
],
],
'page_cache' => [
'id_prefix' => '061_'
]
]
] The prefix of the preload keys must match the cache id prefix so it's a very bad idea to change it during each deployment. |
Thanks @guvra i'll work on updating the repload keys as well for a future update |
- Also updated to remove the config set and instead manually add the hocks to your deployer file - And move var-exporter into the main composer require - deployphp#3453 (comment)
- Also updated to remove the config set and instead manually add the hocks to your deployer file - And move var-exporter into the main composer require - deployphp#3453 (comment)
By the way, this is also helpful in edge cases if you don't compile on the target server, for example when you deploy an update where a cache type was removed:
|
- Also updated to remove the config set and instead manually add the hocks to your deployer file - And move var-exporter into the main composer require - deployphp#3453 (comment)
* DD#0000: feat: Magento2: Add support for preload keys - Also updated to remove the config set and instead manually add the hocks to your deployer file - And move var-exporter into the main composer require - #3453 (comment) * DD#0000: feat: Reverted composer updates * DD#0000: feat: Updated docs * DD#0000: feat: Updated replace to use preg to make sure it only checks beginning of string Updated readme use better grammer * DD#0000: feat: Updated md docs
(cherry picked from commit 7fa09a2)
* DD#0000: feat: Magento2: Add support for preload keys - Also updated to remove the config set and instead manually add the hocks to your deployer file - And move var-exporter into the main composer require - deployphp#3453 (comment) * DD#0000: feat: Reverted composer updates * DD#0000: feat: Updated docs * DD#0000: feat: Updated replace to use preg to make sure it only checks beginning of string Updated readme use better grammer * DD#0000: feat: Updated md docs (cherry picked from commit 48193c6)
Bug fix #…?
New feature?
BC breaks?
Tests added?
Docs added?