Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve UI of "datasette publish cloudrun" to reduce chances of accidentally over-writing a service #608

Closed
simonw opened this issue Oct 27, 2019 · 6 comments

Comments

@simonw
Copy link
Owner

@simonw simonw commented Oct 27, 2019

The concept of a "service" in Cloud Run is crucial: if you deploy to the same service, you will over-write what you deployed there last!

As such, I'd like to make service a required positional argument for publish cloudrun:

datasette publish cloudrun my-service one.db two.db three.db
@simonw

This comment has been minimized.

Copy link
Owner Author

@simonw simonw commented Nov 8, 2019

I'm nervous about how this will affect existing automation scripts that use this command.

@simonw

This comment has been minimized.

Copy link
Owner Author

@simonw simonw commented Nov 8, 2019

I'm going to improve the UI to make it less likely people will accidentally over-write an existing service instead.

@simonw

This comment has been minimized.

Copy link
Owner Author

@simonw simonw commented Nov 8, 2019

Right now you're not asked to select a service until AFTER the image has been compiled and pushed:

7f41a4f30654: Pushed
60c95c8aac78: Pushed
5bad104547b2: Pushed
latest: digest: sha256:7737f14d8490bbea49f29a750401fe2bf8a69f3da3bc2fd1ec5d1a031abf1b06 size: 2849
DONE
------------------------------------------------------------------------------------------------------------------------------------------------------------------

ID                                    CREATE_TIME                DURATION  SOURCE                                                                                      IMAGES                                       STATUS
55b495e1-6862-464b-a99c-ee6eb1d8ac31  2019-11-08T02:08:14+00:00  35S       gs://datasette-222320_cloudbuild/source/1573178893.56-8a2500be28d540e1baac7c6726c5c975.tgz  gcr.io/datasette-222320/datasette (+1 more)  SUCCESS
...

Service name (datasette): 

This defaults to datasette which means you'll over-ride your previous deployment if you don't fully understand what is going on.

@simonw simonw changed the title Make service a required argument (not an option) for 'publish cloudrun' Improve UI of "datasette publish cloudrun" to reduce chances of accidentally over-writing a service Nov 8, 2019
@simonw

This comment has been minimized.

Copy link
Owner Author

@simonw simonw commented Nov 8, 2019

If the user specifies --service I will use that without further questions.

If they don't I'm going to ask them to enter a service manually (like happens at the moment) BUT I'm not going to give them a default and I'm going to show them the list of currently deployed services in the UI.

I can get that by shelling out to gcloud beta run services list --platform=managed --format json

@simonw simonw closed this in 83fc516 Nov 8, 2019
@simonw

This comment has been minimized.

Copy link
Owner Author

@simonw simonw commented Nov 8, 2019

Here's the new interface:

$ datasette publish cloudrun fixtures.db
Please provide a service name for this deployment

Using an existing service name will over-write it

Your existing services:

  csvconf - created 2019-05-09T18:52:17.829Z - https://csvconf-j7hipcg4aq-uc.a.run.app
  fixtures - created 2019-11-08T02:22:14.048160Z - https://fixtures-j7hipcg4aq-uc.a.run.app

Service name: 
@simonw

This comment has been minimized.

Copy link
Owner Author

@simonw simonw commented Nov 8, 2019

A nice undocumented bonus feature of this change is that you can see a full list of your Cloud Run services by running datasette publish cloudrun fixtures.db and then hitting Ctrl+C rather than continuing with the deploy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.