serverless / compose

Orchestrate Serverless Framework in monorepos
https://serverless.com/framework/docs/guides/compose
MIT License
111 stars 15 forks source link

feat: Recognize `region` on service level #127

Closed pgrzesik closed 2 years ago

pgrzesik commented 2 years ago

Related to: https://github.com/serverless/compose/discussions/119

mnapoli commented 2 years ago

Looks good, should region be added here as well?

https://github.com/serverless/compose/blob/fd377f829eab72bbff8f5be4c5a7658a49d2c974/components/framework/serverless.js#L33

or actually 🤔 maybe not, if users pass --region they want to override the region… But I just want to make sure.

pgrzesik commented 2 years ago

Looks good, should region be added here as well?

https://github.com/serverless/compose/blob/fd377f829eab72bbff8f5be4c5a7658a49d2c974/components/framework/serverless.js#L33

or actually 🤔 maybe not, if users pass --region they want to override the region… But I just want to make sure.

That's a good point, I considered it and I think we shouldn't filter out but I realised there might be a slight bug when someone sets region on component and then once again via cli flag - it will end up twice as an arg and it will fail on Framework level - I'll see if I can address it.

Update: In fact, we're disallowing the --region flag so the problem does not exist. Should we keep it this way or allow the override via flag? Should it then override for all components? @mnapoli

mnapoli commented 2 years ago

There are:

Does that make sense and is that possible?

mnapoli commented 2 years ago

Notes from internal discussion:

  1. Globally, --region doesn't make sense because the region is defined on each service (services can be deployed to different regions).
  2. At the service level, the region should be defined statically (i.e. in config), not dynamically via a CLI parameter: the reason is that deploying the same service (same stage) to a different region would create 2 instances of the same component, thus breaking the state.

Conclusion: no --region flag globally nor on service commands.

sadashiv-sumasoft commented 11 months ago

What do we do if we want to deploy all the services into particular region based on the branch?

like our dev hosted on us-east-2 staging hosted on us-west-1 test hosted on ap-south-1

keeping region static on each branch serverless.yml file is not a good idea