Skip to content

deploying from a pre packaged templates #3525

Closed

Description

@srikanna

deploying from pre packaged templates using the command below is not working..

Step 1:
serverless package --stage prod --path templates/prod

Result: Templates in .serverless folder
Expected result: Templates in templates/prod folder.

So I moved all the artifacts from .serverless/* to templates/prod/

Step 2: Tried to deploy using this command..

serverless deploy --path templates/prod

Result: created another set of templates in .serverless/ directory. And deployed these templates.

Expected result: Deploy using the templates in the pre-packaged folder templates/prod

Am I missing something?

Using v1.12.0

Activity

  1. HyperBrain commented on Apr 26, 2017

    @HyperBrain
    Contributor

    The parameter is --package not --path to reference an artifact directory. Could you try with that?

  2. srikanna commented on Apr 26, 2017

    @srikanna
    Author

    Nope that didnt work either

     No serverless-state.json file found in the package path
     you provided.
    
  3. HyperBrain commented on Apr 26, 2017

    @HyperBrain
    Contributor

    The serverless package command with the --package option creates a serverless-state.json file in the artifact directory. This file is part of the artifacts as well as the cf template json files and must be available in the folder.

  4. srikanna commented on Apr 26, 2017

    @srikanna
    Author

    Great. all works well. Thanks for the input!
    serverless package --stage staging -p ./templates/beta
    serverless deploy --stage staging --package ./templates/beta

  5. pmuens commented on Apr 27, 2017

    @pmuens
    Contributor

    Glad to hear that it's working @srikanna 👍

    @HyperBrain thanks for helping here!

  6. jml6m commented on Jan 22, 2018

    @jml6m

    For some reason, I'm still getting the No serverless-state.json file found in the package path you provided. error even though I see the file exists in the directory I'm passing to --package

  7. Munter commented on Oct 26, 2018

    @Munter

    I'm getting the same thing as @jml6m

    What is the fix?

  8. ostov commented on Nov 26, 2018

    @ostov

    The serverless package command with the --package option creates a serverless-state.json with absolute path for functions artifacts. And when you use custom path it is anyway pointed to .serverless folder. This is useless fo CI when you have to create artifacts and archive in build job and then restore in deploy job to workspace with different absolute path. Of course you can use "sed" before run sls. But why absolute path?

  9. Idanatcox commented on Jan 10, 2019

    @Idanatcox

    Thanks @ostov based on your feedback I've managed to solve this issue #4188 #5297
    I don't understand why an absolute path is necessary (or being used at all) it's not a good practice.
    simply removing the line with the abolute path reference in the state json fixed the problem
    Here is what i ended up doing I hope it will help others. this method ensures the package can be deployed anywhere.

    Build

    yarn version --new-version $MAJOR_VERSION.$MINOR_VERSION.$BUILD_NUMBER
    yarn install
    sls package --package dist
    sed -i '/Part_of_Path_To_Remove/d' ./dist/serverless-state.json
    tar -czf $ARTIFACT_ID-$MAJOR_VERSION.$MINOR_VERSION.$BUILD_NUMBER.tar.gz dist
    

    Deployment

    wget tar.gz
    tar zxvf ...
    sls deploy -s dev -p dist
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions