Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ease configuring layers with a Serverless plugin #351

Closed
mnapoli opened this issue Jun 18, 2019 · 1 comment · Fixed by #354
Closed

Ease configuring layers with a Serverless plugin #351

mnapoli opened this issue Jun 18, 2019 · 1 comment · Fixed by #354

Comments

@mnapoli
Copy link
Member

mnapoli commented Jun 18, 2019

I open this issue to share a bit my progress around a Serverless plugin.

At the moment we use AWS SAM to deploy, but we are considering switching to Serverless (see #320). If we do (which is very likely), we could improve some things via a Serverless plugin.

Why?

For example, one main improvement I am pursuing is to simplify dealing with layers and layer versions. For example:

# Before
functions:
    foo:
        handler: index.php
        layers:
            - 'arn:aws:lambda:us-east-1:209497400698:layer:php-73:7'

# After
plugins:
    - ./vendor/bref/bref
functions:
    foo:
        handler: index.php
        layers:
            - ${bref:layer.php-73}

In this example, the plugin is contained in the Bref repository and loaded from the vendor/ directory. The plugin provides a variable to reference easily Bref layers.

The big benefit is that we don't specify layer versions anymore. Meaning that upgrading layers will be as simple as upgrading Bref via Composer.

We will be able to easily break backward compatibility in layers since they will now be coupled to a specific Bref version. We will also be able to publish "beta" layers when testing something out (at the moment it isn't possible, which I don't really like).

Having a plugin could also provide additional features and helpers, or variables. I have a few ideas, but let's start with layers first :)

How?

Serverless plugins are written in Javascript. At the moment they are distributed and loaded via NPM (in the node_modules/ directory).

I am trying to add a new feature to the Serverless framework so that it is possible to load the plugin from the vendor/ directory: serverless/serverless#6017

Here is the current pull request: serverless/serverless#6261

If you can help with this please do :) I am trying my best with NodeJS but I am far from an expert.

@mnapoli
Copy link
Member Author

mnapoli commented Jun 20, 2019

Pull request merged! We just have to wait for the next serverless release, but I can start working on the plugin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant