Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel elixer versioning (cache buster) multiple servers

At the moment we have a new server environment with multiple servers, so the cache busting functionality of laravel elixer doesn't work if we download the repository and run gulp, as each server has a different version of the .js and .css file.

The problem is load balancing can send the user to either server per request. Some browsers seem to be immune from the problem but for example I can't load the css or js properly using JMeter for load testing.

Is there a way to syncronize the build without adding the compiled files to the repository or FTPing everything?

We are trying to automate the deployment by running a script that pulls down the latest repo every time productiosn branch is updated.

like image 605
brianlmerritt Avatar asked Jul 14 '16 12:07

brianlmerritt


1 Answers

I think that the only solution for this problem is to commit compiled assets files.

I found this solution strange at first, because we don't version vendor folder for example.

But at the end, I found that most of the front-end projects are always comitting a dist folder with compiled files.

So you would need to commit your build folder of your public path every time you make a modification to an asset file.

Of course, don't forget to make a gulp --production before pushing to minimize your files.

like image 123
Hammerbot Avatar answered Oct 23 '22 20:10

Hammerbot