Skip to content

Generate CSS/JS on all servers in a multi-server environment?  #9542

Closed
@alloylab

Description

@alloylab

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 ??

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions