gcloudrig icon indicating copy to clipboard operation
gcloudrig copied to clipboard

Use cloud functions

Open putty182 opened this issue 7 years ago • 8 comments

This would allow users to setup/start/stop rigs from a wider range of clients, without needing to launch a bash shell, e.g.

  • webhook from a discord bot, IFTTT button, google-oauth'd webpage
  • ~~pub/sub handlers to deal with preemption and maintainence reported by #32~~ not nessessary, boot disks persist just fine when terminated/stopped, providing you don't delete/replace the instance.

putty182 avatar Nov 01 '18 20:11 putty182

do you have language in mind for this?

deekue avatar Mar 09 '19 23:03 deekue

Probably nodejs, but I'm not sure when I'll get a chance to dig into this.

Open to suggestions :)

putty182 avatar Mar 10 '19 04:03 putty182

Just curious, instead of using cloud functions to cleanup upon shutdown, how about using gcloud alpha cloud-shell + nohup as an alternative to run the cleanup script(snapshots and so on).

This can help avoid the cloud function compute cost, although it would have the other benefits stated in op.

juzkev avatar Oct 30 '20 11:10 juzkev

The idea of using cloud functions was to start handling each of the stateless activities that gcloudrig currently provides (setup, launch, shutdown, snapshot), ultimately leading way for a cloud-native port that once setup, you could trigger from your web browser. The cost of compute for cloud functions would be negligible (especially when weighed against the cost of running the rig itself).

But that's a lot of work... so until then I'll do exactly what you just said, over in #32 👍

putty182 avatar Dec 02 '20 12:12 putty182

Maybe instead of cloud functions, we could use Google Cloud Run with a custom docker image that incorporates the gcloud cli and node docker images. Whenever the node server gets hit, it simply executes the respective shell scripts, so we don't have to rewrite all the bash scripts in javascript

SwiftWinds avatar Jan 25 '21 08:01 SwiftWinds

I know this is old, but I agree with @SwiftWinds. I think it is easiest to build off of the already good bash scripts you have and just wrap it in an express server that calls the scripts. It could serve a simple webpage to login and pipe the output over sockets to monitor from the frontend?

I could get started if you think this is something to pursue? I have some experience with Cloud Run and things like this.

oschwartz10612 avatar Feb 14 '21 16:02 oschwartz10612

I think this is an interesting approach so I am getting started here: https://github.com/oschwartz10612/gcloudrig/tree/cloud-run/api

Feel free to contribute or tell me what I am doing wrong.

oschwartz10612 avatar Feb 15 '21 02:02 oschwartz10612

Nice work, @oschwartz10612! Unfortunately, I currently have little time in my schedule to contribute, but best of luck getting the server working!

SwiftWinds avatar Feb 16 '21 21:02 SwiftWinds