Quantcast
Channel: GorillaStack
Viewing all articles
Browse latest Browse all 61

Serverless HipChat Connect Boilerplate by GorillaStack

$
0
0

Have you ever wanted to try out a full serverless architecture? Or write a HipChat plug-in? The new open source boilerplate from GorillaStack helps developers deploy the back ends for their plugins to Amazon Web Services’ serverless products in Lambda, API Gateway, DynamoDB and S3.

Atlassian, together with Amazon Web Services, engaged GorillaStack to develop an open source bolierplate repository to help their plugin developers deploy the back ends for their plugins to AWS’ serverless products in Lambda, API Gateway, DynamoDB and S3.

GorillaStack is a SaaS solution that automates optimisations in the AWS cloud and is a go-to tool for DevOps engineers who want to ease the burden of automating and managing their cloud environments.

We have shown our commitment to open source contributions in the past with a particular focus on serverless solutions so this was an obvious contribution for us to make.

If you’re an engineer and you’re building for HipChat or any of the other Atlassian platforms, you’ll have already given careful consideration to the stack that you use to run your integrations but did you consider AWS’ serverless Lambda function?

Why go serverless with Lambda?

There are four clear benefits to a serverless deployment:

  1. Pay for what you use
  2. Why pay big money for servers to sit mostly idle to have a HA REST API? With AWS Lambda, you pay per invocation and for the amount of time your code runs and amount of memory required. No more paying for idle time.

  3. Easy to start
  4. You don’t have to spend a bunch of hours building environments or building CI-CD pipelines for blue-green deployments. Just get your code going, then you can sit back and relax.

  5. Iterate faster
  6. Its super easy to deploy different stages and versions. dev, staging, beta, prod, v1, v2. Slashing deployment overhead gives your more time to focus on the development work that truly matters.

  7. Scale built in
  8. Once again to the architecture point. No need to worry about performance testing or worrying about whether your infrastructure will be able to handle high volumes. Let that be Amazon’s problem!

So, if you want to try out a fully serverless architecture or just write a HipChat plugin. Head to the GorillaStack HipChat Connect Bitbucket Repository and let us know what you think!

For reference, here is the full script of the video:

Hi, my name is Elliott Spira from GorillaStack and we are doing a screencast of
how to get started with our serverless hipchat connect boilerplate repository

First thing we are going to do is clone the repository and change directory to
the root directory of the project.

Now we install the serverless framework

And then the grunt-cli

Now we install the project dependencies (all the dependencies for the serverless project)

Then we change to the restApi directory and install these dependencies. This
keeps our lambda function zip file smaller and makes deploying quicker!

Now we are going to set up a development environment. We will use ngrok to give
our localhost https endpoints for our emulated api gateway and for our emulated
s3 bucket (using python SimpleHTTPServer). Copy both urls to our config.json file.

Now we run babel to transpile our es6 code to es5, to make it compatible with
AWS lambda’s version of nodejs. We have two grunt tasks available to you, one
for single run use, and one that runs in watch mode. Let’s leave it in watch mode.

Now we run our grunt task to start our emulated s3 bucket.

We start up DynamoDB local for our local persistence layer.

We now run a grunt task to create our DynamoDB local tables.

Run sls offline start to start emulating api gateway on localhost port 3000.

One of the static assets we serve is an install page. This has an
‘Add to Hipchat’ button and information about the plugin.

Clicking ‘Add to Hipchat’ brings us to our integrations page and brings up modals
to select a chat room and verify the granting of permissions.

In our boilerplate we have an example ‘echo’ webhook, a glance, a sidebar that
can update our glance, post a card and launch a dialog.

I’ll just demonstrate how a plugin can also be added using your plugin’s descriptor url.

But enough about development environments… Let’s go live!

First thing we do is use serverless to create a new stage called ‘beta’. This
creates a new cloudformation stack just for this stage.

Now we will deploy our lambda function and all API Gateway endpoints for this stage.

We will copy the endpoint URL back to our config.json file.

Then we update the name and region in our S3 bucket endpoint in the config.json file.

Now we substitute our config.json properties for the stage into our static asset templates
and deploy to a new S3 bucket for this stage.

As you can see, we now have our assets hosted on s3 and can add the hipchat connect
plugin as we did before.

And there you have it. A HipChat connect plugin running in Lambda, API Gateway, S3 and DynamoDB

The post Serverless HipChat Connect Boilerplate by GorillaStack appeared first on .


Viewing all articles
Browse latest Browse all 61

Trending Articles