Hermann  Frami

Hermann Frami

1656065580

Serverless-oncall: Easily Manage oncall for Your Serverless Services

serverless-oncall 

βš‘πŸ“Ÿ easly manage oncall for serverless services

πŸ€” Motivation

Serverless services facilitate fast develop and deploy cycles. Once in production, these applcations should also have an answer for: "Okay, so how is this application supported when customers start using it"? The answer should not be to wait until customers tell you your service is down.

The Serverless framework leverages multiple providers that manage many operational aspects of the runtimes your application runs on but they do not manage the operational aspects of your application itself. That's up to you.

A number of great monitoring solutions exist and there are even serverless plugins to leverage them! Serverless oncall fills the gap of how you then act on these monitoring systems.

Serverless oncall leverages pagerduty*, a managed oncall scheduling, dispatch and notification hub, to map your application service to an oncall rotation that intended to support its operation. The intended target for this support ideally is the developers that own the service.

This plugin is intended to pair well with the AWS Alerts plugin but is not coupled to AWS serverless provider.

πŸ“¦ Install

Install the plugin with npm

$ npm i -D serverless-oncall

Update your serverless.yml file with the following

plugins:
 - serverless-oncall

custom:
  oncall:
    # the escalation_policy you want pager duty alerts associated with
    escalationPolicy: ${env:PD_ESC_POLICY,''}

    # credential used to authenticate with pagerduty api
    # visit https://{company}.pagerduty.com/api_keys to create one
    apiKey: ${env:PD_API_KEY,''}

    # a list of integrations to associate with your oncall service
    # this will determine where monitoring systems send information to.
    #
    # currently only the "cloudwatch" and "transform" integration are supported but more integrations are
    # planned for the future
    # you may omit this configuration if you wish and configure these manually
    # in the pagerduty web console
    integrations:
      - cloudwatch:
      - tranform:
          code: 'code here'

This plugin currently requires a pagerduty api key to interact with the pagerduty api.

πŸ’‘ You can learn how to get your own api key here

It is recommended to not inline your api key's value directly in your serverless.yaml in plain text to avoid accidently checking it into source control. You can leverage serverless variables as you would with other secret credentials to resolve this value without including it in your source code.

The example above is using env variables to resolve these values. You would then invoke a serverless command by providing them externally.

$ PD_ESC_POLICY=xxx PD_API_KEY=xxxxxxx npx serverless info

Serverless framework provides many options for storing these externally from your source code. Pick one.

Integrations

As mentioned above the way you intergrate a monitoring systems is with pagerduty. The delivery of this information to your oncall team is key so its worth considering your options

cloudwatch

This integration is easy to configure but limited in the way information is delivered.

transform

This integration requires some configuration but is more flexible with how information is delivered.

Below is an example appoach to keeping that configuration managable.

The transform integration lets you provde a snippet of javascript that pager duty will run when it recieves an incident event. This lets you desired how you want your information to be delievered and displayed to your oncall team. The example below leverages serverless frameworks ability externalize and dereference data in separate files.

custom:
  oncall:
    integrations:
      # event transform integration (pagerduty's serverless event transformer)
      - transform:
          code: "${file(transformConfig.js):code}"

The transform.code field is a string of javascript source. This assumes transformConfig.js is a file that will provide that by loading in an oncallHandler.js file.

$ cat transformConfig.js
module.exports.code = () => {
  // read in javascript source
  return require('fs').readFileSync('oncallHandler.js').toString();
}
$ cat oncallHandler.js
// https://v2.developer.pagerduty.com/docs/creating-an-integration-inline
var helloWorld = {
  event_type: PD.Trigger,
  incident_key: PD.inputRequest.body.incident_id,
  description: PD.inputRequest.body.description,
  details: PD.inputRequest.body,
  client: "Hello world",
  client_url: "https://github.com/softprops/serverless-oncall"
};
​
PD.emitGenericEvents([helloWorld]);

This approach also brings the potential of unit testing your transform code as it is now just a standalone javascript file. The pagerduty docs may help here.

πŸŽ™οΈ Commands

serverless-oncall adds new commands to your servleress vocabulary. You can discover these new commands though the built-in --help option

$ npx serverless --help | grep oncall

escalationPolicies

In order to create or update an oncall service you will need to first select an appropriate escalation policy to associate the service with. You can think of roughly as selecting the target group of individuals to be notified. This plugin provides the escalationPolicies command for conveniene of listing these but does not manage them directly. Use the pagerduty UI do that instead.

$ npx serverless oncall escalationPolicies

Your organization will likely have more than one time. The list above will include escalations for all teams. To limit this list to a single (your) team use the -t flag and provide that teams pagerduty team identifier.

$ npx serverless oncall escalationPolicies -t {team}

sync

This command will use the information described your serverless.yml oncall resource to create resources with a remote provider, currently pagerduty.

$ npx serverless oncall sync

info

serverless-oncall integrates itself with the serverless built-in command, info and prints out high level information about the state of its associated oncall service. If you just want a quick link to the oncall service, use this.

$ npx serverless info

* serverless-oncall may support other oncall providers in the future

🚧 Planned work

  • interface design. the current design relects an minimum viable design. this is subject to change.
  • support more integrations
  • support more oncall service providers

πŸ‘― Contributing

Contributions are welcome. Please read our contributing doc for more information.

Doug Tangren (softprops) 2018

Author: Softprops
Source Code: https://github.com/softprops/serverless-oncall 
License: MIT license

#serverless #plugin 

What is GEEK

Buddha Community

Serverless-oncall: Easily Manage oncall for Your Serverless Services

Ajay Kapoor

1624015231

Best Managed IT Outsourcing Services in India

PixelCrayons works with its clients as an β€œoutsourced IT department” by managing applications, mobile devices, networks, servers, databases, patching, upgrades, IT security, and end-user support.

Our development outsourcing services will provide 1st, 2nd and 3rd line support to your end-users and take care of your infrastructure, to your fixed hours plus standard SLAs, whilst making sure the results are fully aligned to your business goals.

Signs Strict NDA
Flexible Engagement Models
50% Cheaper & 2X faster
100% Money-Back Guarantee
Contact Us Now

managed outsourcing services

#managed outsourcing services #managed it outsourcing services #development outsourcing services #it outsourcing services #managed it outsourcing

Hermann  Frami

Hermann Frami

1655426640

Serverless Plugin for Microservice Code Management and Deployment

Serverless M

Serverless M (or Serverless Modular) is a plugin for the serverless framework. This plugins helps you in managing multiple serverless projects with a single serverless.yml file. This plugin gives you a super charged CLI options that you can use to create new features, build them in a single file and deploy them all in parallel

splash.gif

Currently this plugin is tested for the below stack only

  • AWS
  • NodeJS Ξ»
  • Rest API (You can use other events as well)

Prerequisites

Make sure you have the serverless CLI installed

# Install serverless globally
$ npm install serverless -g

Getting Started

To start the serverless modular project locally you can either start with es5 or es6 templates or add it as a plugin

ES6 Template install

# Step 1. Download the template
$ sls create --template-url https://github.com/aa2kb/serverless-modular/tree/master/template/modular-es6 --path myModularService

# Step 2. Change directory
$ cd myModularService

# Step 3. Create a package.json file
$ npm init

# Step 3. Install dependencies
$ npm i serverless-modular serverless-webpack webpack --save-dev

ES5 Template install

# Step 1. Download the template
$ sls create --template-url https://github.com/aa2kb/serverless-modular/tree/master/template/modular-es5 --path myModularService

# Step 2. Change directory
$ cd myModularService

# Step 3. Create a package.json file
$ npm init

# Step 3. Install dependencies
$ npm i serverless-modular --save-dev

If you dont want to use the templates above you can just add in your existing project

Adding it as plugin

plugins:
  - serverless-modular

Now you are all done to start building your serverless modular functions

API Reference

The serverless CLI can be accessed by

# Serverless Modular CLI
$ serverless modular

# shorthand
$ sls m

Serverless Modular CLI is based on 4 main commands

  • sls m init
  • sls m feature
  • sls m function
  • sls m build
  • sls m deploy

init command

sls m init

The serverless init command helps in creating a basic .gitignore that is useful for serverless modular.

The basic .gitignore for serverless modular looks like this

#node_modules
node_modules

#sm main functions
sm.functions.yml

#serverless file generated by build
src/**/serverless.yml

#main serverless directories generated for sls deploy
.serverless

#feature serverless directories generated sls deploy
src/**/.serverless

#serverless logs file generated for main sls deploy
.sm.log

#serverless logs file generated for feature sls deploy
src/**/.sm.log

#Webpack config copied in each feature
src/**/webpack.config.js

feature command

The feature command helps in building new features for your project

options (feature Command)

This command comes with three options

--name: Specify the name you want for your feature

--remove: set value to true if you want to remove the feature

--basePath: Specify the basepath you want for your feature, this base path should be unique for all features. helps in running offline with offline plugin and for API Gateway

optionsshortcutrequiredvaluesdefault value
--name-nβœ…stringN/A
--remove-r❎true, falsefalse
--basePath-p❎stringsame as name

Examples (feature Command)

Creating a basic feature

# Creating a jedi feature
$ sls m feature -n jedi

Creating a feature with different base path

# A feature with different base path
$ sls m feature -n jedi -p tatooine

Deleting a feature

# Anakin is going to delete the jedi feature
$ sls m feature -n jedi -r true

function command

The function command helps in adding new function to a feature

options (function Command)

This command comes with four options

--name: Specify the name you want for your function

--feature: Specify the name of the existing feature

--path: Specify the path for HTTP endpoint helps in running offline with offline plugin and for API Gateway

--method: Specify the path for HTTP method helps in running offline with offline plugin and for API Gateway

optionsshortcutrequiredvaluesdefault value
--name-nβœ…stringN/A
--feature-fβœ…stringN/A
--path-p❎stringsame as name
--method-m❎string'GET'

Examples (function Command)

Creating a basic function

# Creating a cloak function for jedi feature
$ sls m function -n cloak -f jedi

Creating a basic function with different path and method

# Creating a cloak function for jedi feature with custom path and HTTP method
$ sls m function -n cloak -f jedi -p powers -m POST

build command

The build command helps in building the project for local or global scope

options (build Command)

This command comes with four options

--scope: Specify the scope of the build, use this with "--feature" tag

--feature: Specify the name of the existing feature you want to build

optionsshortcutrequiredvaluesdefault value
--scope-s❎stringlocal
--feature-f❎stringN/A

Saving build Config in serverless.yml

You can also save config in serverless.yml file

custom:
  smConfig:
    build:
      scope: local

Examples (build Command)

all feature build (local scope)

# Building all local features
$ sls m build

Single feature build (local scope)

# Building a single feature
$ sls m build -f jedi -s local

All features build global scope

# Building all features with global scope
$ sls m build -s global

deploy command

The deploy command helps in deploying serverless projects to AWS (it uses sls deploy command)

options (deploy Command)

This command comes with four options

--sm-parallel: Specify if you want to deploy parallel (will only run in parallel when doing multiple deployments)

--sm-scope: Specify if you want to deploy local features or global

--sm-features: Specify the local features you want to deploy (comma separated if multiple)

optionsshortcutrequiredvaluesdefault value
--sm-parallel❎❎true, falsetrue
--sm-scope❎❎local, globallocal
--sm-features❎❎stringN/A
--sm-ignore-build❎❎stringfalse

Saving deploy Config in serverless.yml

You can also save config in serverless.yml file

custom:
  smConfig:
    deploy:
      scope: local
      parallel: true
      ignoreBuild: true

Examples (deploy Command)

Deploy all features locally

# deploy all local features
$ sls m deploy

Deploy all features globally

# deploy all global features
$ sls m deploy --sm-scope global

Deploy single feature

# deploy all global features
$ sls m deploy --sm-features jedi

Deploy Multiple features

# deploy all global features
$ sls m deploy --sm-features jedi,sith,dark_side

Deploy Multiple features in sequence

# deploy all global features
$ sls m deploy  --sm-features jedi,sith,dark_side --sm-parallel false

Author: aa2kb
Source Code: https://github.com/aa2kb/serverless-modular 
License: MIT license

#serverless #aws #node #lambda 

Revenue Cycle Management Software Services and Custom Integration - SISGAIN

Revenues come day in day out and it becomes strenuous to keep a track of them. With the help of Revenue cycle management software, one is able to perform the hospital revenue cycle management in Oklahoma, USA in a much simplified and easy manner. Our skilful developers and engineers created the healthcare revenue cycle management software that is convenient to use by its users and meets the customers requirement. We happen to be one of the notable revenue cycle management companies, facilitating the needs of our customers and being efficient and useful in performance. For more information call us at +18444455767 or email us at hello@sisgain.com

#revenue cycle management #revenue cycle management software #revenue cycle management companies #hospital revenue cycle management #revenue cycle management services #revenue cycle management solutions

Google Ads Management Services India | PPC Management Services India

Attracting organic traffic is important and equally important is getting hold of relevant traffic quickly and this is only possible when you avail PPC management services India. This agency delivers performance as far as PPC services are concerned and help save money and at the same time, give you a better base to establish your website and capitalize from there.

#ppc management services india #google ads management services india #best ppc company in india #outsource ppc management

Google Ads Management Services India | PPC Management Services India

Advertising your business with the help of Google Ads Management Services India can help you reach out to billions of people at a very cost effective price. With our Ads Management Services, we can help you attract a target audience by creating, optimizing and efficiently managing ad campaigns. Click the link below to learn about Types of Google Ads.

#google ads management services india #outsource ppc management #best ppc company in india #ppc management services india