Serverless IDE for Google Cloud? Yes, now there is one!

https://cloud.google.com/_static/images/cloud/icons/favicons/onecloud/apple-icon.png

Google Cloud: Build What's Next!

A while back, we announced basic support for Google Cloud Platform in SLAppForge Sigma, the one-and-only serverless IDE.

SLAppForge Sigma: Think Serverless!

SLAppForge Sigma: Think Serverless!

That was good news for AWS fans who want to use Google APIs in their projects; but not so much for the native Google Cloud lovers.But today, we have good news for y'all!

Sigma the serverless IDE, can now deploy directly to Google Cloud Platform; just like AWS!

Tip: If you want to skip the rest and dive straight in, check out our step-by-step guide!

 

How did you do it?

magic!

Magic!

In fact, there's no black magic involved; we use Cloud Build for building your project, and Deployment Manager to bind your resources into one deployment stack.

Currently Cloud Functions are the compute target of the Sigma serverless IDE on Google Cloud; but we are considering the Firebase stack as a potential candidate as well.

Everything is bound to a GCP Project, to which you can authorize Sigma using a service account key; right from the start, or after firing up your Sigma project, via the GCP Resources pane.

 

'GCP Resources' pane, awaiting authorization

'GCP Resources' pane, awaiting authorization

 

Oh, and we don't give that key away to anybody; not even to GCP, as the functions utilize Application Default Credentials (ADC) at runtime.

 

What can I do with Sigma on GCP?

You can use the serverless IDE to develop your end-to-end Google Cloud solution, right within your browser!

You can use Cloud Storage, Cloud Pub/Sub and HTTPS endpoints to trigger your functions; not much, but that's about everything that GCP offers 🙂

Inside, you can use any GCP service in writing your application logic. We support a few fancy drag-n-drop code generators as well - Storage, Pub/Sub, Cloud Datastore for NoSQL/schemaless stuff and Cloud SQL for relational stuff.

 

Google Cloud Platform: a rich mosaic of cloud services! (source: https://www.cloudsolutions.co.uk/content/uploads/2016/12/GCP750x390.jpg)

Google Cloud Platform: a rich mosaic of cloud services! (source: https://www.cloudsolutions.co.uk/content/uploads/2016/12/GCP750x390.jpg)

 

By nature, GCP doesn't need explicit authorization for its various services; your project's default service accounts have access to it all. So you can just import googleapis and summon your favorite Google API to do the job for you - even if it isn't available in our palette!

 

Handling Google Cloud auth in the serverless IDE

While ADC simplifies things, it needs some boilerplate code for initialization.

For GCP, the code is fairly simple:

const google = require("googleapis").google;
google.options({auth: new google.auth.Compute()});

 

If you are using GCP inside a different platform like AWS, things are a bit more complicated:

const google = require("googleapis").google;

const key = JSON.parse(process.env.GCP_SERVICE_ACCOUNT_KEY);
const jwtClient = new google.auth.JWT({
    email: key.client_email,
    key: key.private_key,
    scopes: ["https://www.googleapis.com/auth/cloud-platform"]
});

google.options({auth: jwtClient, project: process.env.GCP_PROJECT});

If you use drag-n-drop for some GCP service in your project, we would automatically add the appropriate snippet; in which case you simply have to import it into whatever other files that you need:

let google = require('googleapis').google;
require('../../Authorizer');

If not, you can simply copy-paste the above (or any other auth logic of your choice) into your function; or to a separate file, for the sake of reusability.

 

And how about using AWS within GCP?

You guessed it - Sigma IDE now supports that as well; just like you can use GCP inside an AWS project, now you can use AWS services inside your GCP project!

Simply authorize Sigma for your AWS account, by providing a key pair via its Cloud Credentials page; or right inside the IDE, via the AWS Resources pane on the left!

Currently AWS-in-GCP support is limited to a single AWS region, so you need to pick a region before you can start working; but we hope to make it more flexible in the future.

 

Known bugs and pitfalls in Sigma's GCP mode

 

Know thy pitfalls before ye step in.

Know thy pitfalls before ye step in.

 

GCP full-stack support is very much beta, so prepare to be amazed if we have missed trivial stuff here and there!

Also, let's face it: Cloud Functions itself was in beta, until just a few months ago; not to put the blame on them, but there are some surprising shortcomings.

Anyway, here they come:

  • You cannot change the triggers of an already-deployed function. (Sigma doesn't prevent you, but GCP will simply fail the next deployment.)
  • You have to pick the correct function type (HTTP vs event-based) right at creation; and if you want to change it later, you'll have to switch the method signature yourself.
  • New entity creation is pretty basic; you can provide a bucket name or topic name, but most of the advanced configs still on the way.
  • Deployments don't have a proper status indicator (progressbar; need to play around with the APIs a bit more).
  • From our tests, it seemed that Deployment Manager can be 'buggy' at times; if you immediately retry a failed deployment, the stack will end up in a successful state, but without any of the intended (and previously failed) updates. Need to investigate further on this.
  • Some features, like the test button, are "coming soon" on GCP.

 

Whoa, slow down - test button "coming soon"? WTF?!

 

Serverless IDE, "cool" GCP features: under construction

Under construction...

 

Yeah, sorry - we are still working on some of the "cool" features; the test framework, quick build and monitoring dashboard for GCP. We're still a tiny team, so bear with us 🙂

 

So there!

Once again, Sigma has taken the lead as the first serverless IDE to support Google Cloud Platform.

We sure have a long journey ahead, but we have definitely started moving; and we believe so far we are on the right track.

So, try it out and tell us what you think!