
Cloud Run Button: Click-to-deploy your Git repos to GCP - eloycoto
https://cloud.google.com/blog/products/serverless/introducing-cloud-run-button-click-to-deploy-your-git-repos-to-google-cloud
======
typpo
Back in June a Googler added a cloud run button to one of my open-source
repositories
([https://github.com/typpo/quickchart#deploy](https://github.com/typpo/quickchart#deploy)).

As a project maintainer, I like it because it gives prospective users a quick
and cheap way to test out service deployment, and it required nothing more
from me than the already existing Dockerfile.

------
leetrout
That is fascinating. It's one of those "feels so obvious" type of things. I
wonder how hard it will be to track versions of things?

I guess the "safest" workflow would be to fork the repo before you click run
but the article doesn't say how to handles repeat clicks... multiple
environments or if it prompts you? Off to test!

~~~
leetrout
To save anyone else some time if they stumble across my comment... It creates
multiple revisions, even from distinct forks, based on what appears to be the
repo name (cloud-run-hello).

First run from a fork:

This created the revision "cloud-run-hello-00001" of the Cloud Run service
"cloud-run-hello"...

After changing the button's HTML to point to my repo on my fork:

This created the revision "cloud-run-hello-00002" of the Cloud Run service
"cloud-run-hello"...

~~~
badrequest
Cloud Run requires a deployed container image somewhere. That can be Docker
Hub or GCR, but the image version is what it actually operates on.

------
mfer
Heroku has had this for years. I'm surprised others have not followed suite
more often.

~~~
leetrout
I didn't realize that. Saving anyone else a search
[https://devcenter.heroku.com/articles/heroku-
button](https://devcenter.heroku.com/articles/heroku-button)

There appears to be more vendor lock in with this one requiring heroku
specific files...

I'm a bit behind on best practices with Heroku so the heroku.yml[1] config is
new to me and it says it doesn't replace app.json. This is where I feel like
Cloud Run supporting "plain" docker files or build packs is great. I wonder if
Heroku will follow suit and make it a bit easier to deploy "just a container"?

[1] [https://devcenter.heroku.com/articles/build-docker-images-
he...](https://devcenter.heroku.com/articles/build-docker-images-heroku-yml)

~~~
michaelmior
`app.json` serves a different purpose from Dockerfiles (which Heroku also
supports). Google's Cloud Run also makes use of `app.json`.

~~~
alpb
Cloud Run doesn't recognize app.json natively. However this project (Cloud Run
Button) accepts an app.json that lets the developer configure env variables to
prompt to the user.

Disclaimer: I've worked on this project.

~~~
michaelmior
My mistake for confusing Cloud Run and Cloud Run Button.

------
julvo
I love this. Would be cool if the cloud run button (i.e. the image in the
readme) updates and shows whether it's running and some status info after it's
started (maybe it does already, didn't try it yet)

~~~
leetrout
I am a bit disappointed- I skipped the details and now that I've tried it
hands-on I see that it is hardcoding the link to the repo in the button's
HTML. So even after you fork it the button still point's to Google's repo.

That makes sense, of course, but if that step were gone (maybe by checking
referrer?) it would be a lot slicker!

~~~
alpb
Disclaimer: co-author of the project.

It's already on our list: [https://github.com/GoogleCloudPlatform/cloud-run-
button/issu...](https://github.com/GoogleCloudPlatform/cloud-run-
button/issues/16) Ideally you'd just link to a URL like deploy.cloud.run and
we'll figure out the rest from Referer.

~~~
leetrout
Awesome! Thanks for the quick response on that!

------
betatim
This looks pretty slick, will have to see which parts/ideas we should copy for
[https://mybinder.org](https://mybinder.org). Which is an open-source project
that lets you do something very similar, mostly based around people wanting to
share notebooks. Colab but with automatically detected environment/build
instructions.

------
intellix
Looks awesome. Loved the deploy to Heroku button in the past.

Now I just wait for websocket support to move my backend to cloud run as well

~~~
jkarneges
If you want to support websockets from a not-always-on backend, you can use
Fanout or Amazon API Gateway.

------
emersonrsantos
If you want to build your own micro PaaS, which is from Git to Deploy (on a
Kubernetes cluster), check out [https://rio.io](https://rio.io) (disclaimer:
happy user).

------
minimaxir
What's the best way to handle a button like this if you intentionally keep
certain dependencies out of Git/GitHub? (e.g. my gpt-2-cloud-run repos
[[https://github.com/minimaxir/gpt-2-cloud-
run](https://github.com/minimaxir/gpt-2-cloud-run)] have a 500MB dependency)

Can you do a conditional in the Dockerfile, e.g. download a remote file if
using Docker to build with certain parameters?

~~~
alpb
Off-topic but I think Dockerfile allows downloading remote URLs, e.g.:

    
    
         ADD http://example.com ./file.txt

~~~
jayd16
I've been using wget like a sucker?!

~~~
alpb
I think using RUN wget/curl is actually cached better than ADD [URL], which
will invalidate your build steps cache more often unless I'm mistaken.

~~~
orf
It's also easier to clean up, i.e download a file, do something with it and
then remove it. With ADD this is impossible.

------
ehPReth
i _want_ to love all these cloud run app engine cloud function type things
(and amazon type equals), but it seems like stuff takes like 30 years to start
up if it hasn’t been touched for a little bit even for super simple
functions... is this stuff just near unusable unless you’re patient or like
super baller with billions of hits per second?

~~~
evankanderson
It depends on the language you're using and how you manage your dependencies.

If you're using Java, see this writeup for how different frameworks can affect
startup time: [https://medium.com/google-cloud/java-frameworks-
performances...](https://medium.com/google-cloud/java-frameworks-performances-
on-cloud-run-eb243fd84a5c)

Similarly, if you're using Node or Python, you might want to see if any of
your dependencies are _enormous_ with lots of files and slow startup time --
you can check this locally by timing how long it takes to get to the initial
listen() call and just print that wall time as you adjust dependencies.

If you're building Golang and you're seeing slow cold starts... I have no idea
how you're doing that. For development, a lot of us on the open source
[http://knative.dev/](http://knative.dev/) side are using Go http servers that
take tens of milliseconds to start up, so there's probably some other
initialization that's slowing you down.

------
pier25
The free tier seems pretty generous but I'm not sure I'm making sense of all
these numbers [1].

Anyone has insight on how this compares to Heroku in terms of
pricing/performance?

[1]
[https://cloud.google.com/run/pricing](https://cloud.google.com/run/pricing)

------
sachinag
Is this different from how Netlify does it?

------
tango12
Any thoughts on auto-detecting the language/framework so that’s it’s just git
push and you don’t even need a dockerfile? For a zeit or Heroku like
experience.

It might require a lot of conventions (which might not be worth it finally)
but as a quick deploy and experiment solution, it’d be super awesome.

~~~
alpb
Disclaimer: working on this project.

When there are no Dockerfiles, we use CNCF Buildpacks
([https://buildpacks.io](https://buildpacks.io)) similar to Heroku buildpacks.

Some apps without Dockerfile are currently deployable using this, as
buildpacks detect the language/framework.

~~~
jacques_chester
> _similar to Heroku buildpacks._

In fact Heroku is one of the founding contributors for Cloud Native Buildpacks
(along with Pivotal, where I work).

------
slig
I'm about to launch a new website and would like to start using AWS or GCP.
Between Fargate and Cloud Run, which one would you recommend? (It's a simple
React + Django + Postgres + Redis project) Thanks!

~~~
cameronbrown
I personally make heavy use of classic App Engine tbh, the experience is
pretty similar to Cloud Run but it's much more of a mature platform (if you
can deal with the downsides).

~~~
slig
I used App Engine years ago, but didn't even consider it nowadays exactly
because it's mature and I fear Google might sunset it soon. Will have a look
now, thanks!

~~~
evankanderson
App Engine is still GA and is still having features added.

Disclaimer: I work on both Cloud Run and App Engine at Google.

------
alexandercrohde
Conceptually cool. I wonder though if this would work for those of us whose
application consists of multiple interdependent services living in multiple
repos.

~~~
nogbit
Exactly, going to production is 80%. This button while cool is only 20% of the
story.

~~~
arez
that's fine, sometimes you just want to try something out, test it, play
around

------
siquick
This is excellent. Any way to pass environment variables?

~~~
alpb
Disclaimer: I work on this project.

Yes, you can create a file named app.json that prompts the user for
environment variables that are set on the deployed application. See
[https://github.com/GoogleCloudPlatform/cloud-run-
button/](https://github.com/GoogleCloudPlatform/cloud-run-button/)

------
alexnewman
Is this free? How do I know google wont terminate it?

------
alephnan
Does this work with private repos? I don't see documentation on this.

------
galaxyLogic
[https://zeit.co/](https://zeit.co/)

------
gitgud
> sped up for your viewing pleasure...

Has anyone tested how long this button actually takes?

Last time I checked its at least a [1] 7 minute wait to deploy a "Hello World"
to GCP...

[1] [https://stackoverflow.com/questions/40205222/why-does-
google...](https://stackoverflow.com/questions/40205222/why-does-google-
appengine-deployment-take-several-minutes-to-update-service)

~~~
eliben
You're linking to a question about a different service (App Engine) from 3
years ago

~~~
thesandlord
Yup, OP's time is in reference to App Engine Flex, which is much slower to
deploy.

I normally see 1-2 minute deployment times depending on the application.

(I work for GCP)

~~~
gitgud
OP here, sorry my mistake. But what is this button deploying to then?

~~~
ernsheong
Cloud Run. Serverless containers

[https://cloud.google.com/run/](https://cloud.google.com/run/)

~~~
gitgud
Interesting looks like it's still in Beta, but will check it out.

We use Firebase and GCP at our company and have had a good experience aside
from slow deploys with App Engine. What parts do you get to work on?

~~~
ernsheong
I am using this in production for
[https://www.pagedash.com](https://www.pagedash.com)

It's holding up pretty well so far.

> What parts do you get to work on?

Not sure if this answers your question, but I also use Cloud SQL, Cloud Build,
GKE, GCE, Stackdriver, Bigquery etc.

