You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One service equals one zip file which includes all the necessary code (all functions)
Magic handler support will be dropped (as it's not necessary anymore)
There will be no checksum to check if something has changed
The zipped up service will be redeployed every time (this ensure that the build "will always work" as no brittle steps as e.g. checksum support will be implemented)
Possibility to set a path to an own artefact (.zip file) via a definition in the serverless.yaml file (e.g. artefact_path). This way the deployment plugin will use the user specified artefact and won't zip up everything on it's own
Questions:
Do we need an own lifecycle in the deploy plugin? Or should we use before:deploy:deploy?
Current implementation:
The current implementation can be found in the awsDeploy plugin.
Open issues:
DRYrun support should be implemented (The user should be able to specify if he wants to save the Resource template (such as CloudFormation) and the .zip file to the file system without deploying it) (moved into own issue: Add DRYrun support #1496)
@pmuens imho we should have a package step. This makes sure other plugins can hook in there as well.
And the way to let following plugins know which artefact path they should use could simply be a configuration value in the serverless.yml, e.g.
artefact_path:
By default people don't set it, the packaging plugin zips and puts this somewhere to be picked up, but if users want to build their own artefact they can and if the artefact_path variable is present the packaging plugin will simply do nothing.
Should the package lifecycle be included in the deploy plugin (deploy:package) and an own package plugin which hooks into this lifecycle and implements the packaging process?
Or should we define a package plugin which has a package:package lifecycle and the packaging implementation?
Imho has to be in deploy, otherwise it won't run as people would have to run package:package directly. but we can implement a separate package command in the future imho.
@pmuens@flomotlik the only downside I see to this is the size of zip file... For example, one of the current functions we have written in Java with all the jars is 38MB, and the limit is 50MB...
Would we have to separate out into different services and then keep track which lambda function has which handler?
There doesn't seem a logical way to separate out the functions and services...
We have different department (companies), languages and aws services.
Also, it would seem like function type would have to be per services not per function, is that correct?
@license2e Is that only one function or are those 38MB combining code for multiple functions? We do want to provide a way in the future for you to build function specific packages, would be great to understand a little more how you're reusing code in services.
Unfortunately one function, although, its currently pulling in ALL AWS SDK jars, so I will have to tweak the gradle zip settings to only pull in the ones that are actually used...
While I like the simplicity this introduces (for us and for our users), this will make deployment exponentially slow, and will eat up lots of space both on S3 and Lambda, which is the main reason why we went with magic handlers in the first place.
If a service has 10 functions, we'll end up deploying the entire service 10 times. Magic handlers allows users to organize their functions and their dependencies in such a way to minimize including code that is not used by the lambda/function. If all functions will have the same code footprint (most of which is not used by that function), then a service is eventually a big fat function.
@eahefnawy I agree, with the setup we have and the number of functions we are writing ~1000, we will need those magic handlers. Otherwise, we will have to arbitrarily group certain functions together into a service, and manually keep track of which service has which function.
@ac360 we now only create one bucket per service/stage/region combination, but in there we could simply create folders for the different version and put all the files in
@flomotlik Right! But, if we add the ability to use a single bucket across multiple services (this feature might have already been added, not sure), keeping the stage in the name will protect us in that case.
@ac360 the most likely option for a single bucket across services is that people manage that bucket themselves imho. I see basically 2 options going forward for the buckets:
We create the bucket for you and name it together with your CF stack. We guarantee naming and that everything works
Users create their own bucket and point us to it (e.g. deployment_bucket setting in their serverless config) so we're going to push to that one
This might change if we get different feedback from users
Funny how things come full circle :) I'm with @flomotlik 's last comment. Thats exactly how I had it architected in JAWS (could pass S3 bucket to use as CLI opt when creating project).
Only thing I'd add is when your naming the bucket, please include the region name in it. Ex: uswest2-sls-projName-UUID. As you know when interacting with S3 u need to know what region it is in. Having region name in bucket makes things so much easier to manage when a human needs to get involved.
2 is a must have for us. We appreciated that we would give bucket ${BUCKET} and the artifacts would be placed in ${BUCKET}/Serverless/..., separated as appropriate by region/environment*/et cetera.
Having region name in bucket makes things so much easier
By convention, not mandate, yes/please?
prefer "environment" (standard industry language) over "stage" (ApiGateway naming artifact)
One question: Is the use of aliases and named versions for publishing lambda functions to environments (stages) still an option, instead of naming the lambda functions? For us the number of functions will explode if every environment gets its own function.
Supporting aliases and versions should be possible with CloudFormation using the AWS:Lambda:Version and AWS:Lambda:Alias CF types. With version even versions with custom names (maybe implied through the user's build system) may be used and the environment ( @erikerikson +1 for the naming ) can be easily attached as alias to that.
@HyperBrain its dropped for now. But I see your concern. Does your usecase require handling stages with aliases? or we could just add support for aliases/versions in general and that could work for you?
The issue with handling stages with aliases/versions that we've found over the months is that not all event sources and other AWS services are aware of this Qualifier or versions/aliases. Didn't sound super reliable.
Plus, when you deploy to a stage, you gotta navigate to that alias/version, and it confused some people who didnt see their deployment right away.
@eahefnawy Since the latest improvements in the AWS lambda web console, it is far more centric on aliases than on versions. e.g. you now have the prominently placed "Qualifier" selection button in there.
For us, we heavily depend on the stages/aliases as we use the Qualifier property for our lambda calls.
Regarding the event sources. In my experience this is the exception. For these few that do not support aliases, the previously used "customName" override was a perfect solution where you could change the semantics quite easily.
Activity
Add "magic handler" zipping support
flomotlik commentedon Jul 5, 2016
@pmuens imho we should have a package step. This makes sure other plugins can hook in there as well.
And the way to let following plugins know which artefact path they should use could simply be a configuration value in the serverless.yml, e.g.
By default people don't set it, the packaging plugin zips and puts this somewhere to be picked up, but if users want to build their own artefact they can and if the artefact_path variable is present the packaging plugin will simply do nothing.
pmuens commentedon Jul 5, 2016
@flomotlik Sound reasonable.
Should the
packagelifecycle be included in thedeployplugin (deploy:package) and an ownpackageplugin which hooks into this lifecycle and implements the packaging process?Or should we define a
packageplugin which has apackage:packagelifecycle and the packaging implementation?flomotlik commentedon Jul 5, 2016
Imho has to be in deploy, otherwise it won't run as people would have to run package:package directly. but we can implement a separate package command in the future imho.
pmuens commentedon Jul 5, 2016
Yep. Missed that
package:packageyields to the fact that we need an own command.Here's how this might look like:
Not sure if we should name it
createDeploymentPackageor justpackage(I like names that speak for themselves 😆 )flomotlik commentedon Jul 5, 2016
createDeploymentPackagesounds good to melicense2e commentedon Jul 5, 2016
@pmuens @flomotlik the only downside I see to this is the size of zip file... For example, one of the current functions we have written in Java with all the jars is 38MB, and the limit is 50MB...
Would we have to separate out into different services and then keep track which lambda function has which handler?
There doesn't seem a logical way to separate out the functions and services...
We have different department (companies), languages and aws services.
Also, it would seem like function type would have to be per services not per function, is that correct?
flomotlik commentedon Jul 5, 2016
@license2e Is that only one function or are those 38MB combining code for multiple functions? We do want to provide a way in the future for you to build function specific packages, would be great to understand a little more how you're reusing code in services.
license2e commentedon Jul 5, 2016
Unfortunately one function, although, its currently pulling in ALL AWS SDK jars, so I will have to tweak the gradle zip settings to only pull in the ones that are actually used...
eahefnawy commentedon Jul 6, 2016
While I like the simplicity this introduces (for us and for our users), this will make deployment exponentially slow, and will eat up lots of space both on S3 and Lambda, which is the main reason why we went with magic handlers in the first place.
If a service has 10 functions, we'll end up deploying the entire service 10 times. Magic handlers allows users to organize their functions and their dependencies in such a way to minimize including code that is not used by the lambda/function. If all functions will have the same code footprint (most of which is not used by that function), then a service is eventually a big fat function.
license2e commentedon Jul 6, 2016
@eahefnawy I agree, with the setup we have and the number of functions we are writing ~1000, we will need those magic handlers. Otherwise, we will have to arbitrarily group certain functions together into a service, and manually keep track of which service has which function.
29 remaining items
flomotlik commentedon Jul 15, 2016
@ac360 we now only create one bucket per service/stage/region combination, but in there we could simply create folders for the different version and put all the files in
austencollins commentedon Jul 15, 2016
@flomotlik Right! But, if we add the ability to use a single bucket across multiple services (this feature might have already been added, not sure), keeping the stage in the name will protect us in that case.
flomotlik commentedon Jul 17, 2016
@ac360 the most likely option for a single bucket across services is that people manage that bucket themselves imho. I see basically 2 options going forward for the buckets:
This might change if we get different feedback from users
doapp-ryanp commentedon Jul 19, 2016
Funny how things come full circle :) I'm with @flomotlik 's last comment. Thats exactly how I had it architected in JAWS (could pass S3 bucket to use as CLI opt when creating project).
Only thing I'd add is when your naming the bucket, please include the region name in it. Ex:
uswest2-sls-projName-UUID. As you know when interacting with S3 u need to know what region it is in. Having region name in bucket makes things so much easier to manage when a human needs to get involved.erikerikson commentedon Jul 20, 2016
Yar!
2 is a must have for us. We appreciated that we would give bucket
${BUCKET}and the artifacts would be placed in ${BUCKET}/Serverless/..., separated as appropriate by region/environment*/et cetera.By convention, not mandate, yes/please?
HyperBrain commentedon Jul 20, 2016
One question: Is the use of aliases and named versions for publishing lambda functions to environments (stages) still an option, instead of naming the lambda functions? For us the number of functions will explode if every environment gets its own function.
Supporting aliases and versions should be possible with CloudFormation using the AWS:Lambda:Version and AWS:Lambda:Alias CF types. With version even versions with custom names (maybe implied through the user's build system) may be used and the environment ( @erikerikson +1 for the naming ) can be easily attached as alias to that.
eahefnawy commentedon Jul 20, 2016
@HyperBrain its dropped for now. But I see your concern. Does your usecase require handling stages with aliases? or we could just add support for aliases/versions in general and that could work for you?
The issue with handling stages with aliases/versions that we've found over the months is that not all event sources and other AWS services are aware of this
Qualifieror versions/aliases. Didn't sound super reliable.Plus, when you deploy to a stage, you gotta navigate to that alias/version, and it confused some people who didnt see their deployment right away.
@flomotlik any thoughts on this?
HyperBrain commentedon Jul 20, 2016
@eahefnawy Since the latest improvements in the AWS lambda web console, it is far more centric on aliases than on versions. e.g. you now have the prominently placed "Qualifier" selection button in there.
For us, we heavily depend on the stages/aliases as we use the Qualifier property for our lambda calls.
Regarding the event sources. In my experience this is the exception. For these few that do not support aliases, the previously used "customName" override was a perfect solution where you could change the semantics quite easily.
eahefnawy commentedon Jul 20, 2016
@HyperBrain Perfectly said 😊 ... let's see what @flomotlik thinks of this.
flomotlik commentedon Jul 27, 2016
Yup Alias support is definitely an important one, we do have an issue open, I just can't seem to find it right now :D
pmuens commentedon Jul 28, 2016
@flomotlik we have an issue for Lambda versioning here: #1457
flomotlik commentedon Aug 9, 2016
Closing this issue as #1777 is targeting the per function packaging and @johncmckim is going to work on it.