diff --git a/README.md b/README.md index b5056f3..7c7c6c3 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![serverless](http://public.serverless.com/badges/v3.svg)](http://www.serverless.com) [![npm](https://img.shields.io/npm/v/serverless-ruby-layer.svg)](https://www.npmjs.com/package/serverless-ruby-layer) [![Build Status](https://img.shields.io/circleci/build/github/navarasu/serverless-ruby-layer)](https://circleci.com/gh/navarasu/serverless-ruby-layer) [![Coverage Status](https://coveralls.io/repos/github/navarasu/serverless-ruby-layer/badge.svg?branch=master)](https://coveralls.io/github/navarasu/serverless-ruby-layer?branch=master) [![MIT License](https://img.shields.io/npm/l/serverless-ruby-layer)](https://github.com/navarasu/serverless-ruby-layer/blob/master/LICENSE) -A Serverless Plugin to bundle ruby gems from Gemfile and deploy it to the lambda layer automatically while running `serverless deploy`. +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. @@ -71,18 +71,18 @@ custom: use_docker: true ``` -For more details, refer the docs [here](https://navarasu.github.io/serverless-ruby-layer/#/configuration) +For more detailse refer the docs [here](https://navarasu.github.io/serverless-ruby-layer/#/configuration) ## Usage Using the custom configuration, the plugin can be utilized for below cases, -* Using locallly installed bundler for gems which native extensions - [Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/basic) - [Docs](https://navarasu.github.io/serverless-ruby-layer/#/use_local_bundler) -* Using Docker for gems with OS native C extensions or system libraries like `http`, `Nokogiri` - [Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/use_docker) - [Docs](https://navarasu.github.io/serverless-ruby-layer/#/use_docker) -* Preinstall OS packages (yum packages) for gems which requires OS native system libraries like `pg`, `mysql`, `RMagick` - [Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/use_docker_with_yums) - [Docs](https://navarasu.github.io/serverless-ruby-layer/#/use_docker_with_yums) -* Using Dockerfile for gems which with other OS Linux image or system libraries and utilities - [Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/use_docker_file) - [Docs](https://navarasu.github.io/serverless-ruby-layer/#/use_docker_file) -* Include / Exclude specific functions from layer configuration - [Include Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/include_functions) , [Exclude Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/exclude_functions) - [Docs](https://navarasu.github.io/serverless-ruby-layer/#/include_exclude) - +* Using locally installed bundler for gems without any native extensions - [Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/basic) - [Docs](https://navarasu.github.io/serverless-ruby-layer/#/use_local_bundler) +* Using Docker for gems with OS native C extensions or system libraries like `http`, `Nokogiri` - [Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/use_docker) - [Docs](https://navarasu.github.io/serverless-ruby-layer/#/use-docker) +* Preinstall OS packages (yum packages) for gems which requires OS native system libraries like `pg`, `mysql`, `RMagick` - [Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/use_docker_with_yums) - [Docs](https://navarasu.github.io/serverless-ruby-layer/#/use-docker-with-yums) +* Using Dockerfile for gems which with other OS Linux image or system libraries and utilities - [Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/use-docker-file) - [Docs](https://navarasu.github.io/serverless-ruby-layer/#/use_docker_file) +* Include / Exclude specific functions from layer configuration - [Include Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/include-functions) , [Exclude Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/exclude-functions) - [Docs](https://navarasu.github.io/serverless-ruby-layer/#/include_exclude) +* Exclude test and development related gems from layer - [Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/exclude-dev-test-gems) - [Docs](https://navarasu.github.io/serverless-ruby-layer/#/exclude_dev_test_gems) ## Contributing @@ -94,4 +94,4 @@ Refer [Guidelines](https://github.com/navarasu/serverless-ruby-layer/blob/master ## License -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file +[MIT](https://choosealicense.com/licenses/mit/) diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 0619fa1..ec75ca9 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -8,5 +8,6 @@ * [Docker with Yums installed](use_docker_with_yums) * [Using Custom Dockerfile](use_docker_file) * [Include / Exclude functions](include_exclude) + * [Exclude test gems / development gems](exclude_dev_test_gems) * [Configuration](/configuration.md) -* [Release Notes](/release_notes.md) \ No newline at end of file +* [Release Notes](/release_notes.md) diff --git a/docs/index.html b/docs/index.html index a24445f..fc02ee2 100644 --- a/docs/index.html +++ b/docs/index.html @@ -33,7 +33,8 @@ '/use_docker': '/usage_examples/use_docker', '/use_docker_with_yums': '/usage_examples/use_docker_with_yums', '/use_docker_file': '/usage_examples/use_docker_file', - '/include_exclude': '/usage_examples/include_exclude' + '/include_exclude': '/usage_examples/include_exclude', + '/exclude_dev_test_gems': '/usage_examples/exclude_dev_test_gems' }, search: { noData: { diff --git a/docs/release_notes.md b/docs/release_notes.md index 26492fb..9e6edee 100644 --- a/docs/release_notes.md +++ b/docs/release_notes.md @@ -1,5 +1,33 @@ # Release notes +### [1.4.0](https://www.npmjs.com/package/serverless-ruby-layer/v/1.4.0) +### Docker Inside Docker Release +* Replaced docker volume mount with docker cp to support CI (Docker inside Docker) environment. +* Handled the bundle flag deprecated for bundler version greater than 2.1 +* Added docker related test case to run in circle-ci +* Improved test coverage to 88 % +* Documented exclude test and development gem example + +### [1.3.0](https://www.npmjs.com/package/serverless-ruby-layer/v/1.3.0) +#### Specify Functions Release +* Option to include / exlude functions from attaching layers +* To reduce layer zip size, the gem cache files are excluded in zipping than removing it from the bundle folder + (To avoid unnecessary error while removing and also for upcoming reuse gem options) + +### [1.2.1](https://www.npmjs.com/package/serverless-ruby-layer/v/1.2.0) +#### Validated Release +* Fixed issue in removing Cache dir #17 +* Handled all edge-case errors and thrown user informative message +* Added logs message for future issue debugging +* Added issue template with necessary details + +### [1.2.0](https://www.npmjs.com/package/serverless-ruby-layer/v/1.2.0) +#### Native Libs Release +* Specify yums to be preinstalled before doing a bundle install for gems with os native extension like pg, mysql. +* Pack and Deploy native library files to the lambda layer along with gems. for e.g to pack /usr/lib64/libpq.so.5 file for pg. +* Use docker file to specify custom installation and configuration +* Added docs and examples + ### [1.1.0](https://www.npmjs.com/package/serverless-ruby-layer/v/1.1.0) #### Use-Docker Release * Added option to use docker to bundle gem with os specific C extensions @@ -12,4 +40,4 @@ #### First Release * Auto deploy the gems to AWS layer while doing serverless deploy * Also configure the layer to make the gem available to all functions declared in the serverless.yml -* Uses local bundler to install the gem \ No newline at end of file +* Uses local bundler to install the gem diff --git a/docs/usage_examples/exclude_dev_test_gems.md b/docs/usage_examples/exclude_dev_test_gems.md new file mode 100644 index 0000000..6946294 --- /dev/null +++ b/docs/usage_examples/exclude_dev_test_gems.md @@ -0,0 +1,54 @@ + +## Exclude test and development related gems + + + +#### ** Gemfile ** + +```ruby +source 'https://rubygems.org' +gem 'httparty' + +group :development do + gem 'rubocop' +end + +group :test do + gem 'rspec' +end + +``` + +#### ** serverless.yml ** + +```yml +service: basic + +plugins: + - serverless-ruby-layer + +provider: + name: aws + runtime: ruby2.5 + +functions: + hello: + handler: handler.hello + ``` + +#### ** handler.rb ** + +```ruby +require 'httparty' + +def hello(event:, context:) + body = HTTParty.get("https://github.com").body + + { statusCode: 200, body: body } +end + +``` + + +Running `sls deploy` automatically deploys the required gems as in Gemfile by excluding the test and development related gems by default to AWS lambda layer + diff --git a/docs/usage_examples/main.md b/docs/usage_examples/main.md index bc87830..53d10de 100644 --- a/docs/usage_examples/main.md +++ b/docs/usage_examples/main.md @@ -6,4 +6,4 @@ Using the custom configuration, the plugin can be utilized for below cases, * Using Docker for gems with C extensions or system libraries like `http`, `Nokogiri` - [Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/use_docker) - [Docs](use_docker) * Preinstall OS packages (yum packages) for gems which requires OS native system libraries like `pg`, `mysql`, `RMagick` - [Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/use_docker_with_yums) - [Docs](use_docker_with_yums) * Using Dockerfile for gems which requires other system libraries and configuration - [Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/use_docker_file) - [Docs](use_docker_file) - +* Exclude test and development related gems from layer - [Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/exclude-dev-test-gems) - [Docs](https://navarasu.github.io/serverless-ruby-layer/#/exclude_dev_test_gems) diff --git a/examples/exclude-dev-test-gems/Gemfile b/examples/exclude-dev-test-gems/Gemfile new file mode 100644 index 0000000..027d3b3 --- /dev/null +++ b/examples/exclude-dev-test-gems/Gemfile @@ -0,0 +1,10 @@ +source 'https://rubygems.org' +gem 'httparty' + +group :development do + gem 'rubocop' +end + +group :test do + gem 'rspec' +end diff --git a/examples/exclude-dev-test-gems/handler.rb b/examples/exclude-dev-test-gems/handler.rb new file mode 100644 index 0000000..b29169f --- /dev/null +++ b/examples/exclude-dev-test-gems/handler.rb @@ -0,0 +1,7 @@ +require 'httparty' + +def hello(event:, context:) + body = HTTParty.get("https://github.com").body + + { statusCode: 200, body: body } +end diff --git a/examples/exclude-dev-test-gems/serverless.yml b/examples/exclude-dev-test-gems/serverless.yml new file mode 100644 index 0000000..7f7c991 --- /dev/null +++ b/examples/exclude-dev-test-gems/serverless.yml @@ -0,0 +1,12 @@ +service: basic + +plugins: + - serverless-ruby-layer + +provider: + name: aws + runtime: ruby2.5 + +functions: + hello: + handler: handler.hello