"datasette publish cloudrun" command to publish to Google Cloud Run#434
"datasette publish cloudrun" command to publish to Google Cloud Run#434simonw merged 8 commits intosimonw:masterfrom rprimet:cloudrun
Conversation
|
Thanks for looking into this! To clarify: currently, the Dockerfile that we generate looks something like this: Your code here changes that CMD line to look like this instead, in order to set the port based on an environment variable: I wonder if this is the only way to do this? |
datasette/publish/cloudrun.py
Outdated
| "about_url": about_url, | ||
| }, | ||
| ): | ||
| image_id = f"gcr.io/{project}/{name}" |
There was a problem hiding this comment.
Datasette still supports Python 3.5 so we can't use format strings just yet.
|
I asked @andrewgodwin about this and he confirmed that if we want to read an environment variable we can't use the He did suggest that if we're doing
We should apply some command-line escaping here - if the user passes It looks like shlex.quote is the right way to do that. |
|
This is amazing - works an absolute treat. Thank you very much! |
|
This is exactly what I needed. Thank you. |
|
Here's my first working deployment: https://datasette-j7hipcg4aq-uc.a.run.app/fixtures-c35b6a5/facetable?_facet_array=tags I deployed it using this: The second time I ran the command I got an error: So I ran the command it suggested and then everything worked: |
|
Documentation is now available here: https://datasette.readthedocs.io/en/latest/publish.html#publishing-to-google-cloud-run |
Yes, I was able to reproduce this; I used to get prompted for a run region interactively by the Not sure which course of action is best: making |
|
Since there's a useful error message I'm OK with revisiting this in a few weeks to see if they change the CLI tool. |
This is a very rough draft to start a discussion on a possible datasette cloud run publish plugin (see issue #400).
The main change was to dynamically set the listening port in
make_dockerfileto satisfy cloud run's requirements.This was done by running
datasettethroughshto get environment variable substitution. Not sure if that's the right approach?