2
ngCry
2y

Would you consider compression (gzip static files) as a prepare step of the deploy stage or as a part of the build stage?

It's somewhat irrelevant but its bugging me

Comments
  • 0
    It doesn't need to happen if the deploy stage is not needed but it somehow feels like the responsibility of the build
  • 1
    What is the thing that gets deployed? The uncompressed files? Then it is purely a deploy step. If you deploy it and it stays compressed. Then it might be the build.
    That's just my opinion.
  • 0
    So long as it's automated and fault-tolerant, sure why not
    I for one don't really care about the distinction
  • 0
    I consider it a part of the webserver config
  • 0
    Anyway, IMO the difference between build and pre-deploy is which tool automates the given task. If it's the build system, it's a build task. If it's the deploy script or the CD pipeline separately, it's a pre-deploy task.
  • 1
    Depends on where the bottleneck is. Under normal circumstances I don't bother with it at all.

    Is it slow to upload or download build artifacts? Zip the files in the build pipeline before you publish them.

    Is it slow to deploy your files on the target? Zip the files in the deployment pipeline before you transfer them.
  • 0
    First question....

    When do you apply environment specifics?

    If you generate assets with an environment specific configuration in the build step - which is usually seen as an anti pattern - then you _could_ do it in the build step.

    If you modify the assets to apply environment specific configuration before deployment / on container start, it would be bad to gzip it.

    Another question: Do you need to GZIP it? If you have e.g. an caching server like Varnish, a WAF like cloudflare or stuff like that - it would be a far better idea to leave it to them to handle compression... After all, they are the ones who need to deal with the cache fuckity and who directly know from the client what the client supports and how to cater for it (e.g. supporting different compression types for better results).
  • 0
    @IntrusionCM Thank you for the answer.

    Under normal circumstances that would be absolutely the way to go, however im using Gitlab Pages to host a page with a SSG (just a toy project) and to have any compression at all, the static files have to compresed already thats why I can't do it the "normal" way
Add Comment