Assets and multiple servers

I have multiple servers in production.

The browser receives many 404 Not Found errors when I view a page:


player:139 GET

player:48 GET

player:140 GET

On one server, those assets are there:

$ ls web/assets

641929d4 997b9b6d ad1b17b7 d6882ed7

On the other server, they are not:

$ ls web/assets

56fcc41f afeea9a3 c2b6703 d253a200

Does Yii Asset Manager work with multiple servers? I found an old discussion where the answer was yes but I am not sure based on this. The NGINX servers do cache JS and CCS files.

I have such a similar problem with 5 servers, you have to think how to unify the naming approach on Asset manager, and override publish method to handle this issue, and if you are using combine and compress you must also override combine And Compress method by grant that the file name generated is not using filemtime approach cause this is what the problem is.

Have the same issue with a Yii 1.x app. I am running on AWS behind a load balancer and was looking at logs one day and spotted a problem where some assets were 404’s. For some reason the load balancer didn’t keep things sticky, or sessions times out, not sure.

What I ended up doing after I do updates is basically copy all assets folders across the servers (I only have 2 or 3) just to make sure that they all exist on all servers. It’s a very big hack, but seemed to work.

I would also like to hear any solutions by others, but would be nice if the hash that was used for the assets would always be consistent across servers.