-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
AssetManager problem in cloud platform #8
Comments
I have built this: https://github.com/SAM-IT/yii2-static-assets Things that are reusable for this use case include:
https://github.com/SAM-IT/yii2-static-assets/blob/master/src/helpers/AssetHelper.php#L241 This could be used to publish to a directory on S3 during build. |
I am using https://gitlab.com/mikk150/yii2-asset-manager-flysystem I had same issue, but even kind of worse, because I do not know(or care) about servers or how many of them I have(auto scaling applications based on load, by purchasing cheapest one from amazon, azure or digitalocean by bidding).. This is uploading them to CDN and CDN deals with it's thing |
@kamarton @mikk150 @SamMousa @samdark @rustamwin @roxblnfk I have been working with assets, and that problem with flysystems is effectively eliminated, since it works with relative routes and part of it does not work with symlinks, now just working with the local adapter would be completely resolved, they think it is worth implementing that you can work with two adapters at the same time, example: $mountManager->copy('local://sourcePath/file.ext', 'publish://basePath/file.ext'); Where local can be the local adapter and publish could be local, aws, digital ocean, google cloud storage, or any other adapter. On the other hand, the other version problem can be solved by adding at the end of the hash 'v0' -> default version, and it can be customized in the assetBundle |
I'm not sure how this is relevant @terabytesoftw, I'm assuming the flysystem asset manager already publishes data to any flysystem filesystem; how would having support for multiple help? Note that there are already composite adapters that will allow you to write to multiple filesystems (local & remote) and then read with fallback (local first, remote otherwise): I'm not sure how having a mount manager that copies between paths is relevant here. |
This is valid and serious problem that could be solved in multiple ways @SamMousa and @mikk150 suggested:
Related #24 may greatly simplify asset list assembly for 2 and 3. |
I think for the future we should do pre publishing. Moving to containers and immutable deploy artifacts is always safer. Even when wanting to deploy assets to a cdn doing so in advance is better. |
I like the idea.
An interesting question here is whether it is always known in advance or not the path. Forces the deploy to receive a different route (path) from the previous state in each case. For example, if the asset files of one package have not changed for 2 years, it will destroy the CDN function in an intensive development status by e.g. forces downloads to mobile devices up to several times a day. |
You could still use the file hash as input for path generation, doing it in advance is no different from doing it at runtime.. |
I've recently wrote down about how to solve it in Yii 2: https://rmcreative.ru/blog/post/yii-2-za-balansirovschikom-nagruzki It is in Russian but may be relevant. |
Seems to be possible with current master. Need to document it. |
This one is now solved. An example added to readme. |
What steps will reproduce the problem?
Yii2 asset manager specified to any file storage and file serving. There is a small problem with this in a cloud platform.
Yii2 schema:
Idea:
What is the expected result?
files serving any servers
What do you get instead?
not found asset files (onlye copy files server A)
Additional info
yii2 solution (with my source codes):
The text was updated successfully, but these errors were encountered: