Open timkelty opened 6 years ago
@timkelty Why do you run craft asset-bundler/publish
on each server? You should run it once (in your deploy/build process) and then distribute the files to all servers.
@ostark good point -- the reason is because we're deploying docker images and currently we don't ship our images with composer as to keep our image size down.
Our deployment process builds the image, distributes it, and then runs composer install (and craft asset-bundler/publish).
@timkelty I'd prefer something like this:
craft asset-bundler/publish --forceRevision=$TIMESTAMP_OF_RELEASE
https://github.com/fortrabbit/craft-asset-bundler/commit/4b32dc4e1cf12f0a87834531b9e804ecadfd813d
time()
andDirectoryIterator::getMTime
are used to generate and update the timestamp used for the directory revision, however, this is not necessarily going to be consistent when deployed across multiple servers (e.g. a load balanced app).I'm not sure the best way to address this, but it was the first thing I ran into.
At the moment, I seem to have it working by parsing a consistent env var that exists in our deploy, from which I can extract a timestamp: https://github.com/timkelty/craft-asset-bundler/commit/0941726cd923d9eaea6bcaf00bb506b16fd32e08