Serverless Ruby Layer

homepage icon https://github.com/navarasu/serverless-ruby-layer
Follow @navarasu

Tracked

NPM Downloads Last Month
568
Issues
0
Stars
0
Forks
0
Watchers
0
Watch Star Fork Issue Download License NPM Build Status Coverage Status Contributors

Repo README Contents:

Serverless Ruby Layer

serverless npm Build Status Coverage Status MIT License

A Serverless Plugin which bundles ruby gems from Gemfile and deploys them to the lambda layer automatically while running serverless deploy.

It auto-configures the AWS lambda layer and RUBY_PATH to all the functions.

Install

Install ⚡️ serverless. Refer here for serverless installation instructions.

Navigate to your serverless project and install the plugin

sls plugin install -n serverless-ruby-layer

This will add the plugin to package.json and the plugins section of serverless.yml.

Documentation

Check out the documentation here for,

Getting Started

Simple Usage

serverless.yml

service: basic

plugins:
  - serverless-ruby-layer

provider:
  name: aws
  runtime: ruby2.5

functions:
  hello:
    handler: handler.hello

Gemfile

  source 'https://rubygems.org'
  gem 'httparty'

Running sls deploy automatically deploys the required gems as in Gemfile to AWS lambda layer and make the gems available to the RUBY_PATH of the functions hello.handler

Refer example amd docs for more details

Customization

The plugin operation can be customized by specifying the custom configuration under rubyLayer.

For example, to use docker environment for packing gem, the below configuration is added to serverless.yml

custom:
  rubyLayer:
    use_docker: true

For more detailse refer the docs here

Usage

Using the custom configuration, the plugin can be utilized for below cases,

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update the tests as appropriate.

Refer Guidelines for more information.

License

MIT