3 ms·
We used cloud run for a while and it's great. It does not allow for background threads though and that caused us to upgrade the setup eventually. Upgrading fro
by jillesvangurp 3y ago
We used cloud run for a while and it's great. It does not allow for background threads though and that caused us to upgrade the setup eventually.
Upgrading from cloud run to use proper vms was very easy because vms can be booted with a docker container as one of the arguments. It will just go off and run that with a default OS. Running docker containers in gcloud is super easy.
And scaling that is easy too. Basically you define an instance template that defines vm details; including the docker container url. And then you update your instance group with that template and all the instances are replaced one by one. You use the instance group as a service for your load balancer and with the right health checks configured this basically gives you zero down time deployments, auto scaling, etc. If there's an issue starting the container, it just aborts the restart and continues running the old containers.
The closest thing in AWS would be ECS but it's a lot more hassle to setup.
One great feature in gcloud is "copy this screen/dialog/whatever as a gcloud command". That made scripting the above super easy. We use github actions for all this. For each service, we use 1 command to update the template and 1 command to deploy it.
- QasimK 3y agoI’ve used Cloud Run and it does allow for background threads.
- anisov 3y agoI think they introduced this feature lately: https://cloud.google.com/run/docs/configuring/cpu-allocation https://cloud.google.com/run/docs/configuring/cpu-allocation you can set --no-cpu-throttling which keeps the cpu allocated even if the request lifetime is over. Used it for Background tasks
- jillesvangurp 3y agoRight; that is indeed new. We might give this another try.