Open samdark opened 8 years ago
A static path is required: http://www.yiiframework.com/doc-2.0/yii-web-assetmanager.html#%24hashCallback-detail
There is one more issue though. For non session-sticky load balancing, you might fail finding an asset.
Let's say 1st request hit server A, the asset will be generated in the local storage inside server A. And then when the 2nd request sent to get the asset but hit server B which hasn't generated the asset, it will return 404.
My suggestion are
yii asset
in build process and store it in centralized storage like AWS S3.Or you can just configure the load balancer to use session-sticky.
Good suggestions. Do you have time to include these into the article?
Working on it. Now that there is a topic about scaling. I think I haven't found any topic about continuous integration. Might be useful.
Absolutely. Would be great if you'll share your experience.
i run an api for user creation so avatars and user photos are created in production so shared storage, google cloud storage is necessary. May i know how it can be configured so all the servers have a central storage on google cloud storage.
Second @chizuoka request. I am using google app engine flex custom environment, everything works great, the last issue is sharing user generated content (such as, for example, avatars) via a single google cloud storage across horizontally scaled VM's with stateless Yii2 application. Any pointers would be appreciated so that I could develop it myself.
If we could have a pluggable storage AssetManager
class, for example with creocoder/yii2-flysystem, then all our problems would be solved.
That's something for Yii 3.0.
For https://github.com/samdark/yii2-cookbook/blob/master/book/scaling.md it's necessary to describe on how to deal with assets.