Building a DevOps pipeline for Serverless by using Mocha, GitHub and Travis

12
Building a DevOps pipeline for Serverless by using Mocha, GitHub and Travis Sami Pippuri CTO James Nguyen Software Developer Maas Global

Transcript of Building a DevOps pipeline for Serverless by using Mocha, GitHub and Travis

Page 1: Building a DevOps pipeline for Serverless by using Mocha, GitHub and Travis

Building a DevOps pipeline for Serverless by using

Mocha, GitHub and TravisSami Pippuri

CTOJames Nguyen

Software Developer

Maas Global

Page 2: Building a DevOps pipeline for Serverless by using Mocha, GitHub and Travis

MaaS Global is building the future of mobility

Page 3: Building a DevOps pipeline for Serverless by using Mocha, GitHub and Travis

System Goals

Goals

• Scalable, cloud-based• Mobile-first customer experience • Utilizing readymade cloud APIs• Infrastructure-as-code• Establish industry standard APIs where they

don’t exist yet• Open for ecosystem partners• Create enthusiasm in the wider ecosystem –

enable e.g. Universities and smaller developer houses around the world

Non-Goals

• Closed architecture or lock-ins (except AWS)

• Exclusive deals• Server infrastructure• Intermediate, all-

encompassing frameworks

• Something for everybody

Page 4: Building a DevOps pipeline for Serverless by using Mocha, GitHub and Travis

Loosely coupled Microservice API integrations – flexible inclusion into MaaS framework

Routing

Traffic OperatorTraffic Operator

Traffic OperatorTransport Operator

Weather

Subscription Payment

Identity

Business Rules

Customer Support

Whim backend

APIGW

Whim Apps

Page 5: Building a DevOps pipeline for Serverless by using Mocha, GitHub and Travis

Tech Stacks

MaaS Core

Lambda (Node.js 4.x, ES6)

Serverless

AWS Components*

REST

API

s

Apps Backend Integrations

MaaS Schemas MaaS-API SBUS

* APIGW, S3, DynamoDB, RDS (psql), Route53, IoT, Cognito, CloudFront, CloudWatch, SNS, Kinesis, ML, SWF, IAM, ACM…

SWF background processing

SNS

REST

Page 6: Building a DevOps pipeline for Serverless by using Mocha, GitHub and Travis

Infrastructure – Serverless, cloud-native

Whim Apps

API Gatewayapi.maas.globalMaaS Core

MaaS TSP

Trip Machine

Identity

Kinesis events

Data Storage

RDS Postgres

Page 7: Building a DevOps pipeline for Serverless by using Mocha, GitHub and Travis

What is Serverless?- Is:

- Open source.

- Not really server-less.

- A framework centralized in managing AWS Lambda, API Gateway and CloudFormation.

- Robust, auto-scaling, fast and reliable.

- Extensible in itself with a nice plugin system as well as having big supports from the community

- Is not:

- A server.

- Helping you writing the code.

- Yet possible to be run on-premise

Check out at https://serverless.com/

Page 8: Building a DevOps pipeline for Serverless by using Mocha, GitHub and Travis

Project Deployment

Serverless

autoinstall meta

mocha

Webpack

Base toolstack

Travis CI

PROD (Alpha)

Unit & integration

testing

Deploy to stages

(4 of them)

PROD

DEVTEST

ContinuousDeployment (!)

Test harness

Dep sripts

Local test harness

Page 9: Building a DevOps pipeline for Serverless by using Mocha, GitHub and Travis

Detailed workflow

Feature development *

Code review **

Open pull request **

Merge onto master **

Release alpha **

Release production **

Feature testing *

Field test ***

Smoke tests ***

DevDeveloper’s fork

TestMaster branch

AlphaAlpha branch

ProdProd branch

Tagging candidates

Documenting releases

Change log

Bug fixes *

*Manual testing ** Automated test with Travis *** Application test

Page 10: Building a DevOps pipeline for Serverless by using Mocha, GitHub and Travis

Auto deployment in action!

Page 11: Building a DevOps pipeline for Serverless by using Mocha, GitHub and Travis

Some Resources• MaaS Transport Service Provider API: http://www.maas-api.org • Serverless Mocha test plugin: https://github.com/SC5/serverless-mocha-plugin• Meta Sync plugin: https://github.com/serverless/serverless-meta-sync (superceded in sls 1.3)• Webpack plugin (fork) for faster cold starts: https://github.com/laurisvan/serverless-webpack-plugin• Request-promise-lite, smaller version of request-promise to keep Lambda size down:

https://github.com/laurisvan/request-promise-lite

• Serverless v1.x boilerplate https://github.com/SC5/sc5-serverless-v1-boilerplate• Knex / Objection.js for an easy ORM on Nodejs: http://vincit.github.io/objection.js/

Page 12: Building a DevOps pipeline for Serverless by using Mocha, GitHub and Travis

SeeWhim Live

whimapp.comSAMI PIPPURI

CTO, MaaS Global [email protected]

+358 50 487 6829

JAMES NGUYENDeveloper, MaaS Global [email protected]