Socket
Socket
Sign inDemoInstall

serverless-leo

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-leo

Serverless plugin for leo microservices


Version published
Weekly downloads
261
decreased by-44.11%
Maintainers
1
Weekly downloads
 
Created
Source

serverless-leo

Serverless plugin. Deploy your leo bots and microservices using serverless.

Install serverless-leo

npm install --save-dev serverless-leo

Configure serverless.yml

plugins:
  - serverless-leo

custom:
  stage: ${opt:stage, 'dev'}
  dev:
    # The name of your leo platform stack
    leoStack: TestBus
  test:
    # The arn for the LeoInstallFunction lambda in your leo platform stack.
    # This is an alternative to using the leoStack variable. EG: the bus and lambda are in different accounts.
    leoRegister: arn:aws:lambda:us-east-1:123456:function:TestBus-LeoInstallFunction-2IMP25UOQ64G

functions:
  hello:
    handler: index.handler
    events:
      - leo: helloWorldTestQueue
  
  world:
    handler: index.handler
    leoCron: 0 0 1 * * * 

Deploy your microservice

Use the standard serverless deploy cli command to deploy your microservice. Optional -s or -stage parameter (standard serverless).

Examples

Requires the leo platform (bus). Step 2 in this guide: https://github.com/LeoPlatform/Leo#install-the-leo-platform-stack

Nodejs - https://github.com/LeoPlatform/serverless-leo/tree/master/examples/nodejs
Java - https://github.com/LeoPlatform/serverless-leo/tree/master/examples/java-quickstart
Python (incomplete) - https://github.com/LeoPlatform/serverless-leo/tree/master/examples/python

Documentation

Trigger lambdas from a Leo queue

Create a "bot" that will run when events are added to a queue. The events will be handled in order and only one lambda will handle events at a time.

hello:
  handler: index.handler
  events:
    - leo: helloWorldTestQueue
You can specify multiple queues for a single lambda. Each will become a separate bot, visible in the bus ui (Botmon).
You can also define the queue as an object and give the bot a name:
hello:
  handler: index.handler
  events:
    - leo: 
        queue: helloWorldTestQueue
        name: helloBot

Trigger lambdas on a schedule

Create a "bot" that will run on a cron schedule. Only one lambda will run at any given time for a single bot.

world:
  handler: index.handler
  leoCron: 0 0 1 * * * 

Variations

Handle different versions of bot by adding "botCount". This will create the number of bots specified and pass in "botNumber" into the event when the bot is ran.

world:
  handler: index.handler
  leoCron: 0 0 1 * * * 
  botCount: 4

This allows you to partition the queue, or change the configuration of the bot based on the value of the variable at run time.

Keywords

FAQs

Package last updated on 17 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc