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

Support for nested applications #8

Open
buggy opened this issue Oct 12, 2019 · 13 comments
Open

Support for nested applications #8

buggy opened this issue Oct 12, 2019 · 13 comments
Assignees
Labels
enhancement New feature or request

Comments

@buggy
Copy link
Collaborator

buggy commented Oct 12, 2019

Standard sam build seems to have pretty bad support for nested applications. It would be really good if this plugin could build all of the stacks at once.

@buggy buggy added the enhancement New feature or request label Oct 12, 2019
@buggy buggy added this to the v0.4.0 milestone Oct 12, 2019
@buggy buggy self-assigned this Oct 12, 2019
@buggy buggy modified the milestones: v0.4.0, v0.5.0 Nov 20, 2019
@buggy buggy modified the milestones: v0.5.0, v0.6.0 Dec 26, 2019
@aksel
Copy link

aksel commented Jan 22, 2020

I have almost gotten this to work, using the experimental project option.

It currently outputs each stack into its respective build folder, which I then have to manually combine. But I think that could be solved by output.path.

@aksel
Copy link

aksel commented Jan 23, 2020

I ended up writing my own plugin, heavily inspired by yours.
Here's a gist

But I got it working, specifically for our use case, which is Node-only functions, only one depth of nested stacks (this breaks after second recursion), all of which are local, and organized in a specific folder structure.

It's also incredibly hacky when it comes to file paths and such. But it works™

@buggy
Copy link
Collaborator Author

buggy commented Jan 23, 2020

@aksel Thanks for posting the link to the gist. Nested stacks will be coming shortly. I have a reasonable urgent need for them myself. I just need to find a chunk of time that I can dedicate to fixing all of the related issues.

@buggy buggy modified the milestones: v0.6.0, v0.7.0 Mar 4, 2020
@buggy buggy modified the milestones: v0.7.0, v0.8.0 Aug 24, 2020
@danieljarrett74
Copy link

@aksel Thanks for posting the link to the gist. Nested stacks will be coming shortly. I have a reasonable urgent need for them myself. I just need to find a chunk of time that I can dedicate to fixing all of the related issues.

Hi @buggy how did you go with the nested stacks? I've been using your plugin and it works great, but recently split my cloud formation file into nested stacks as it was becoming too big to wrap my head around. I noticed that its sitting in the next milestone.

@buggy buggy removed this from the v0.8.0 milestone Aug 6, 2021
@buggy
Copy link
Collaborator Author

buggy commented Aug 6, 2021

@danieljarrett74 It's a feature that I still want to implement but I haven't had the time to dedicate to it.

@artiomnist
Copy link

Hey! 👋 I've been using this plugin on a project and it's been fantastic.

We're planning to move to nested stacks as our cloudformation file is getting too big.

This support for nested applications would be great!

@danieljarrett74
Copy link

@buggy Thanks for the update.

@artiomnist and @buggy I hacked away at a forked version of this the other morning and came up with this https://github.com/danieljarrett74/aws-sam-webpack-plugin . I've stripped out the vscode stuff and other bits to make it faster for me to modify it. But I am using it now and it works for me. However I'm finding my local machine chokes when webpack runs, comes close to running out of memory. I don't know if thats more a webpack thing or something with the way I've done the plugin.

Have a go with it @artiomnist if you want and let me know if it works ok for you. If it seems to work and anyone is interested I can break it off as its own thing and publish it to npm.

@artiomnist
Copy link

@danieljarrett74 - Hey this is Interesting I tried it out - but it doesn't seem to work with our nested stacks. Maybe because we're using Type: AWS::Serverless::Application in our template. I tried adapting your plugin to work with Type: AWS::Serverless::Application but had no luck!

I'm finding it slow on my local machine too - takes some time - but eventually manages to build- just missing the nested stack functions!

@artiomnist
Copy link

@danieljarrett74 - Hey this is Interesting I tried it out - but it doesn't seem to work with our nested stacks. Maybe because we're using Type: AWS::Serverless::Application in our template. I tried adapting your plugin to work with Type: AWS::Serverless::Application but had no luck!

I'm finding it slow on my local machine too - takes some time - but eventually manages to build- just missing the nested stack functions!

Scratch that - I've managed to get a version of your hack to work with Type === AWS::Serverless::Application - I've not written any unit tests for this - but from inital runs it seems to work. Maybe I can raise a PR to your project adding this in?

or maybe we can combine our efforts and get a PR for @buggy to review for nested stacks / nested applications.

@danieljarrett74
Copy link

@artiomnist yes I'm happy for you to add to this. And yes if @buggy wants to pull it back in go for it. But I have concerns that it's a big change and I've rearranged a lot of the existing code and it's not really tested well. The performance issue concerns me a bit, but It runs fine on github actions which works ok for me but maybe not others. @buggy what are your thoughts? did you want to use any of this fork and bring it back in to this project?

@artiomnist do you want to go ahead with your pull request?

@buggy
Copy link
Collaborator Author

buggy commented Aug 13, 2021

I'll try to find some time this week to look at it. The first thing I want to understand is how SAM handles nested apps so I can maintain as much compatibility as possible.

@baxneo
Copy link
Contributor

baxneo commented Aug 21, 2021

@buggy Your plugin support many projects in sametime. I have not this situation in my project.
Can you attach filetree with templates that will simultaneously be few projects and nested stacks for testing
I will make changes to support nested stack and multi project.

@sam-holder-zava
Copy link

I have put together an experimental version implementing this feature.
Reviews/comments would be greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants