/
[deployment] Warm cache during deployment [5.3.0-B1]
[deployment] Warm cache during deployment [5.3.0-B1]
The deployment process of In-Portal looks like this:
- update code (usually from VCS)
- execute database migrations (implemented via In-Portal itself)
- mark caches as stale (implemented via In-Portal itself)
- install latest dependencies (via Composer)
The problem with current approach is that cache is only marked as stale, but isn't rebuilt immediately and next website visitor can see a delay in page loading that happens right after deploy.
Solution
- add "RelativeCacheWarmupUrls" system setting (textarea); format: one URL per line format
- when user tries to change "RelativeCacheWarmupUrls" system setting value, then:
- validate each line to be a relative URL
- validate each line to be an existing page on this website (just CURL in there and see that 2x response is shown)
- during deployment process (the "adm:OnDeploy" event) make a CURL requests to each of URLs specified above to warm up the cache