Replies: 4 comments 11 replies
-
You can adjust You also have IMHO the current asset-manager can be configured to fit "state-of-the-art cloud needs", but anyway, if you want to reimplement the publish logic, just create an extension. |
Beta Was this translation helpful? Give feedback.
-
I think one does not want to break all the asset cache on each app version bump, but rather only when the version of the asset itself was changed. This is where the logic gets pretty complicated and would love to put this logic into the framework itself, rather than expect each developer to implement this on their own, the right way.
I would love to learn that this is a skill issue on my part, so please let me know how you would do it then: how do you make the docker image stateless with read-only disk and how do you publish the YiiAsset to a CDN, before deployment, in a build pipeline? |
Beta Was this translation helpful? Give feedback.
-
CC @mikk150 |
Beta Was this translation helpful? Give feedback.
-
I imagine an AssetManager which allows to define assets to be either bundled into a bundle, or standalone using it directly with registerAsset in a view. Then a a cli command, which creates the effective bundle configuration, which is then passed to webpack, rollupjs or similar (maybe even vite, but vite is based on rollupjs, I would prefer rollupjs). Then the JS bundler, creates the minified versions and everything necessary so it can be published to /assets. Lastly use the existing JS oecosystem, that is package.json and one of its package managers. Yii can either publish there assets to npm, or use the AssetManager. |
Beta Was this translation helpful? Give feedback.
-
hello,
We are planning the deployment of a new Yii2 app to production and from past experience, the most painful thing is related to DevOps, docker containers or multi server setup: the AssetManager needs to be refactored in a way to make stateless deployments possible, since asset publishing mechanism does not work in this new era of cloud native apps.
To explain this better, imagine you pack your yii2 app in a docker container and deploy it in a service with 10 replicated pods.
yii\web\YiiAsset
internal assets for example are not publicly published to any CDN.hashCallback
function -- maybe we should change it by default with this new release).Now, I'm not sure what the best way to improve/fix this is, but:
I'm willing to work on this after we brainstorm ideas.
Thank you & I'm really excited for this new release!
R
Beta Was this translation helpful? Give feedback.
All reactions