herokuish
herokuish copied to clipboard
File modification time are changed after application is copied to /app
Currently after coping application to /app during building in herokuish, original file modification time are all lost and time for coping will be used.
This may cause issue when running some commands in custom buildpack. Such as in default python buildpack, collectstatic command will be run and this command should collect static files which modificaiton time are older than existed ones.
But since original file modification time are lost, this command will collect all static files no matter they have been collected before or not.
Can we keep original file modification time during buidling, such as using cp -p?
Do you mean here? If so, does mv have a preserve-timestamps property?
Also, I'm not really sure as to what collectstatic is supposed to do based on what you're saying. Like, what is a potential use case of that?
I'm not so sure, Maybe it is here?https://github.com/gliderlabs/herokuish/blob/591fb59252e82348538256a4002cc49947659a2c/include/buildpack.bash#L152
But I can confirm that the modified time have already been changed in /bin/compile process such as in python's buildpack as following.
https://github.com/heroku/heroku-buildpack-python/blob/0fe4f91395c1498dc97124d8606a65558009ab93/bin/compile#L315-L322
We could try -p on that too.
It looks like mv does not have a -p option, but maybe we could also use cp -p but delete original files.
The collectstatic command in python's django framework is used for collecting static files for web applications and then upload to remote/local storage which can be used for static file serving such as for nginx. This command won't collect static files which modified time are older than the existed ones (This means the files are not modified and shouldn't be re-collected/uploaded). The problem here is herokuish will fresh the modified time all the time and so collectstatic will always collect/upload all the static files even they are not modified. This slows down the deploy process and should not be neccessary.
So could we keep the original modified time for our applications during building? Thanks.
Thanks for the explanation.
Is this verified to not be the case - the collectstatic affecting old assets - on Heroku? Or do you have the same issue with your app? If you can validate that on Heroku (please gist the output) that would be helpful.
I'd be happy to take a PR if we can verify the above.
This is verified to not be the case on heroku. Here is the gist. I deployed same application both in heroku and in dokku. https://gist.github.com/jxltom/2896f8f3b7b024a07caad5bd06c7a888
Note that in dokku, https://gist.github.com/jxltom/2896f8f3b7b024a07caad5bd06c7a888#file-deploy-by-dokku-L219, all 579 static files copied by collectstatic but in heroku, https://gist.github.com/jxltom/2896f8f3b7b024a07caad5bd06c7a888#file-deploy-by-heroku-L204, only 431 static files copied but 148 unmodified since their modified time are not changed.
Pull requests welcome, though I wonder if a cp vs a mv has any impact on the build time.