Skip to content

Possibility to specify template on service creation #1470

Closed

Description

@pmuens

The user should be able to create a service based upon a template like this:
serverless create --name my-service --template aws-java-maven or this: serverless create --name my-service --template aws-node43.

Note: This also implies that Services are runtime bound (one service only supports one runtime)

The templates should live in our core framework (might be moved to somewhere else such as an own npm package later on).

Here's an example of the directory structure:

templates
  |__aws-node43
  |__aws-node
  |__aws-python
  ...

The syntax for subfolder is PROVIDER-LANGUAGE-BUILDTOOL (where BUILDTOOL isn’t necessary for each language, but e.g. necessary for java).

Each template folder also includes serverless.yaml and serverless.env.yaml.

Aside: Templates might also be "installed" with the help of a gitUrl later on so that users can point the template option to their repository when they don't want to go with core ones.
The serverless command name might change to something different like serverless scaffold or serverless install.

Related to: #1452

Corresponding PR is: #1470

Activity

  1. added this to the milestone on Jul 1, 2016
  2. added a commit that references this issue on Jul 6, 2016
    0392cf4
  3. pmuens commented on Jul 8, 2016

    @pmuens
    ContributorAuthor

    I think that this issue needs to be resolved until we can jump in the implementation of different programming languages / providers.

    /cc @eahefnawy @flomotlik

  4. flomotlik commented on Jul 8, 2016

    @flomotlik
    Contributor

    Agreed, Imho goal for next week.

  5. pmuens commented on Jul 8, 2016

    @pmuens
    ContributorAuthor

    Sounds good. Added it to the weekly goals.

    @eahefnawy would you jump on this (as you already had an implementation in mind the other day) or should I take it?

  6. flomotlik commented on Jul 8, 2016

    @flomotlik
    Contributor

    @pmuens Sorry I might have been unclear, imho we should implement this in the next sprint, so starting on Tuesday

  7. pmuens commented on Jul 10, 2016

    @pmuens
    ContributorAuthor

    Yep. Updated the weekly goals accordingly.

    Notice that we should discuss #1517 before starting this one.

  8. pmuens commented on Jul 11, 2016

    @pmuens
    ContributorAuthor

    @eahefnawy the service now has a runtime property you should be aware of (see #1536).

  9. eahefnawy commented on Jul 11, 2016

    @eahefnawy
    Contributor

    Getting started with this. Here's what we settled with:

    • create command is serverless create --template aws-node where aws-node is the template name. It could be aws-python or any other template we might add later on based on runtime/provider or even boilerplates
    • drop the --name option. the service name by default will be the template name (ie. aws-node)
    • scaffolding will happen in the cwd. We won't need to create a new folder for the service and cd into it.
    • Document which templates are available
    • serverless create --help should print a list with all available templates

    In Progress in PR 1537...

  10. modified the milestones: v1.0.0-alpha.2, on Jul 12, 2016
  11. pmuens commented on Jul 12, 2016

    @pmuens
    ContributorAuthor

    Done with #1537

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions