-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Generate CSS/JS on all servers in a multi-server environment? #9542
Comments
Are you running in production mode? Did you do your static-asset deployment and compile on each server? |
Yes & Yes.. however the md5 hash on the merged files & timestamp version was different on each server.... so I was I ended up resolving the issue by extending the following classes, \Magento\Framework\View\Asset\Merged & \Magento\Framework\App\View\Deployment\Version to provide static files that are based on the git commit hash |
@alloylab we also experiencing the same issue. It does not generate merged CSS files during static content deploy. I believe It should be part of the static content deployment process. BTW, we have shared _cache folder between all servers to minimize the effect caused by less compilation process. |
Hello @alloylab , can you share your extending classes? I have the same issue here with Magento 2 under a load balancer. Thank you so much, |
Hi, Better use static-content generator with --content-version param in order to have the same deployed_version + same md5 hash on merged files on all your servers. |
Hello All, So is there any solution or patch is available ? Please confirm because I am facing same issue |
How you have done that ? Please share the code or URL so I can do it fix |
Preconditions
We have multiple servers running Magento 2.1.6, PHP 7.0.18 w/Varnish & Hitch SSL Termination... in front of the web servers we have a two HA-Proxy Load Balancers
For Static files we use AWS CloudFront, with the origin being the server
For Media files we use AWS CloudFront, with the origin being an S3 Bucket
Currently we deploy updates to the webservers using Docker, however one issue we have run into is how to ensure the CSS/JS is generated on every server...
Steps to reproduce
We run "bin/magento setup:static-content:deploy;" on each server when deploying an update but we have found that CSS/JS files are sometimes missing within this directory,
/pub/static/_cache/merged/ & /pub/static/frontend/
A temporary patch to this issue has been to curl the localhost within the container to ensure at least one page has been loaded on each server to ensure that the CSS/JS has been generated. However, this fix doesn't work on the admin interface.
Expected result
All CSS/JS should be generated in /pub/static/_cache/merged & /pub/static/frontend without a page load
Actual result
I believe the issue is that a page load has to occur for the CSS and JS to be generated within "/pub/static/_cache/merged/", Is there anyway to generate it from bin/magento ??
The text was updated successfully, but these errors were encountered: