How can I speed up Rails Docker deployments on Google Cloud Platform?

后端 未结 1 651
长情又很酷
长情又很酷 2020-12-03 16:26

I\'m experimenting with more cost effective ways to deploy my Rails apps, and went through the Ruby Starter Projects to get a feel for Google Cloud Platform.

It\'s <

相关标签:
1条回答
  • 2020-12-03 16:55

    Well, you're kinda mixing up 2 different cases:

    • re-deploying the exact same app code - indeed Google doesn't check if there was any change in the app to be deployed in which case the entire docker image could be re-used - but you already have that image, effectively you don't even need to re-deploy. Unless you suspect something went wrong and you really insist on re-building the image (and the deployment utility does exactly that). A rather academic case with little bearing to cost-effectiveness of real-life app deployments :)
    • you're deploying a different app code (doesn't matter how much different) - well, short of re-using the cached artifacts during the image building (which happens, according to your build logs) - the final image still needs to be built to incorporate the new app code - unavoidable. Re-using the previously built image is not really possible.

    Update: I missed your point earlier, upon a closer look at both your logs I agree with your observation that the cache seems to be local to each build VM (explained by the cache hits only during building the worker modules, each on the same VM where the corresponding default module was built beforehand) and thus not re-used across deployments.

    Another Update: there might be a way to get cache hits across deployments...

    The gcloud preview app deploy DESCRIPTION indicates that the hosted build could also be done using the Container Builder API (which appears to be the default setting!) in addition to a temporary VM:

    To use a temporary VM (with the default --docker-build=remote setting), rather than the Container Builder API to perform docker builds, run:

    $ gcloud config set app/use_cloud_build false
    

    Builds done using the Container Builder API might use a shared storage, which might allow cache hits across deployments. IMHO it's worth a try.

    0 讨论(0)
提交回复
热议问题