Infrastructure rockets: the way to extend Booster infrastructure in AWS. (Also transformed the static site deployment feature into the first rocket)#414
Conversation
packages/framework-provider-aws-infrastructure/src/infraestructure-plugin.ts
Outdated
Show resolved
Hide resolved
packages/framework-provider-aws-infrastructure/src/infrastructure/index.ts
Outdated
Show resolved
Hide resolved
packages/framework-provider-aws-infrastructure/test/infrastructure/deploy.test.ts
Outdated
Show resolved
Hide resolved
...s/framework-provider-aws-infrastructure/test/infrastructure/stacks/application-stack.test.ts
Show resolved
Hide resolved
|
It is a great start Javi! I like the approach. I see that plugins in this PR can only change/add/modify infrastructure. I envision that plugins would also need to add functionality to the provider runtime and the framework core. I would try to put together a way of allowing plugins in the three Booster areas (core, provider runtime, provider infrastructure) based on the approach you have followed here (although not in such detail to begin with) |
|
I think it would be nice to avoid implementing core or runtime plugins until we actually have a scenario where that's needed. Maybe a good one would be moving the current auth implementation to a plugin, but I think that we would need to agree on how we want to manage the auth tokens in a more general way in Booster first. |
3b32cb7 to
ba4ffca
Compare
ba4ffca to
2042a9d
Compare
|
Hello, how's this going? I'm super excited about this feature 😄 |
|
Going fine, just completing the tests and docs :-D |
juanjoman
left a comment
There was a problem hiding this comment.
LGTM!! Just left some nit-picky comments 👏
packages/framework-provider-aws-infrastructure/test/infrastructure/nuke.test.ts
Show resolved
Hide resolved
packages/framework-provider-aws-infrastructure/test/infrastructure/nuke.test.ts
Show resolved
Hide resolved
packages/framework-provider-aws-infrastructure/test/infrastructure/nuke.test.ts
Show resolved
Hide resolved
NickSeagull
left a comment
There was a problem hiding this comment.
Looks awesome, I'm hyped to start using this!
Wanted to create a Discord bot using Booster, but then realized that I would need a webhook rocket 👀
packages/framework-provider-aws-infrastructure/src/infrastructure/stacks/application-stack.ts
Show resolved
Hide resolved
| unmountStack: (utils: RocketUtils) => void | ||
| } | ||
|
|
||
| // Separate function to make it easier to mock in tests |
There was a problem hiding this comment.
I'd add something like "not type safe, take care" 😜
| }) | ||
|
|
||
| describe('nuke', () => { | ||
| xit('initializes nuke with no rockets') |
There was a problem hiding this comment.
Never seen this xit. Also, I see the test is not implemented. Maybe it has something to do with that...
There was a problem hiding this comment.
It means "pending test" and mocha shows it as pending in the test list with a different color when they're run 😎
| // Monkey patching this private function to be able to spy it | ||
| const fakeGetStackServiceConfiguration = fake(Infrastructure.__get__('getStackServiceConfiguration')) | ||
| Infrastructure.__set__('getStackServiceConfiguration', fakeGetStackServiceConfiguration) | ||
| spy(StackServiceConfiguration, 'getStackServiceConfiguration') |
There was a problem hiding this comment.
You could save this into a const and then use it on line 56
packages/framework-provider-aws-infrastructure/test/infrastructure/nuke.test.ts
Show resolved
Hide resolved
…proach for infrastructure extensibility via plugins
Co-authored-by: Nick Tchayka <nick@booster.cloud>
…o the stack builder in the AWS infrastructure package
- Renamed plugins as "rockets", the official name for Booster plugins - Added support for rockets unmounting in the nuke process - Created tests for rockets passing through the nuke functions - Added missing tests for the whole nuke process - Moved the nuke operation to its own file - Created a rocket utils object that include the same tools available in Booster
32b5d49 to
f42e702
Compare
|
As there are some known issues in the way integration tests run with breaking changes, and given the size of this PR, I think that it makes sense to release this functionality now and implement an integration test in a future PR, so I'm setting this one ready for review! |
alvaroloes
left a comment
There was a problem hiding this comment.
Finishe review!! I just left two more questions
packages/rocket-static-sites-aws-infrastructure/src/static-website-stack.ts
Outdated
Show resolved
Hide resolved
| const staticSiteBucket = new Bucket(stack, 'staticWebsiteBucket', { | ||
| websiteIndexDocument: indexFile, | ||
| websiteErrorDocument: errorFile, | ||
| bucketName: params.bucketName, |
There was a problem hiding this comment.
I see the bucketName does not have a default name, but I think we could provide one and the user would not need to specify it.
What do you think about using config.applicationName + static-site-bucket?
There was a problem hiding this comment.
This would require many changes because in the current implementation we don't have access to config. I've created issue #482 to tackle this.
…ebsite-feature-into-a-plugin
Co-authored-by: Álvaro López Espinosa <alvaro@booster.cloud> Co-authored-by: Nick Tchayka <nick@booster.cloud>
Co-authored-by: Nick Tchayka <nick@booster.cloud>
…n the static website rocket
…hub.com:boostercloud/booster into feat/moved-static-website-feature-into-a-plugin
|
Integration tests failed, I think it's because this branch doesn't have the changes in #476, so I'd wait for that PR to be merged before trying this again. |
…ebsite-feature-into-a-plugin # Conflicts: # packages/framework-integration-tests/integration/fixtures/cart-demo/src/config/config.ts
There was a problem hiding this comment.
This is crazy slow. For some reason, I was forced to rebuild all modules to make the project compile, but with this change, we're using the code under development instead of the libraries installed from npm. I don't know if there are other places in the code that would need to use this trick. It's very likely that we could optimize this in the future, but for this PR, this is more than enough...
| Booster.configure('production', (config: BoosterConfig): void => { | ||
| config.appName = '{{{ projectName }}}' | ||
| config.provider = Provider | ||
| config.provider = Provider() |
There was a problem hiding this comment.
I was forced to make all providers export a function to avoid breaking the project generator. Having a heterogeneous interface like the one I proposed makes code generation way harder.
71e04f5 to
4fa3f89
Compare
In this PR we introduce the concept of "rockets" as the way to extend Booster. It's likely that we start to use this pattern more and more to make the framework more configurable and easier to extend.
Some notes and ideas to take into account before reviewing this PR:
TODOs
- [ ] Implement an integration test with a simpler "reference rocket" that demonstrates that the stack extensions are deployed.