magento / magento/community-features
improve setup:static-content:deploy downtime period
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 46
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
Summary (*)
setup:static-content deploy is very annoying to use in production because it produces huge downtime for websites.
Examples (*)
Currently in order to force any changes in CSS no matter how small, change red to yellow for example requires the following process.
rm -rf var/view/preprocessed/* pub/static/frontend/*
Any other procedure will force obsolete files to be used.
While everything is deleted there is downtime.
While everything is recreated there is downtime.
Depending on the server this can range from a few seconds to 10minutes+ and it's unacceptable for all users, customers and developers.
Proposed solution
Is it possible to change the way deployment is handled by using a basic way of temporary folders?
For example everytime we issue the command setup:static-content:deploy a temporary folder is created to execute the procedure in and then the final contents are moved back to the locations we need.
This would mean that cached files and files that are currently being used in the website will be accessible during the whole deployment process without causing downtime. Afterwards, only renaming the top level directories and changing the version would be enough.
To depict better
Currently the pub/static folder structure in production mode looks like this
adminhtml
_cache
deployed_version.txt
frontend
and in var/view/preprocessed we have the folder
pub
So my recommendation would be,
create the folder var/view/preprocessed/pub_version
create the folders in pub/static folder
adminhtml_version
frontend_version
Do all the work in the temp folders, and then rename them accordingly.
Although it will not reduce the time for compilation it will still reduce the downtime.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the setup:static-content:deploy entry point and the handling of pub/static and var/view/preprocessed. Review how deployed content and deployed_version.txt are created; done means new content can be prepared without removing files currently serving requests, then switched with no deployment downtime.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system, devops, release
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100