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

Feature Flags for different environments like Dev, UAT, Prod #1136

Open
shivalkarrahul opened this issue Apr 2, 2024 · 3 comments
Open

Feature Flags for different environments like Dev, UAT, Prod #1136

shivalkarrahul opened this issue Apr 2, 2024 · 3 comments

Comments

@shivalkarrahul
Copy link

Hello,

We have a requirement as follows.

  1. We have 3 different Environments, viz Dev, Staging and Prod.

  2. We should be able to have Dev, Staging & Prod Environment on different versions of Data.all (Dev on 2.3.0, Staging on 2.2.0, Prod on 2.1.0)

  3. There should be a way to Enable or Disable features based on Environments.
    e.g. Dev can have modules.dashboards.active enabled, and Staging/Prod can have it disabled. (We believe different config.json would come into picture here)
    e.g Dev environment would be having few functionalities which are under development and not present in staging or Prod, Staging Environment would be having few functionalities getting tested but will not be moved to Prod until UAT is done

  4. Do we need to have config-dev.json, config-staging.json, config-prod.json files to enable to disable features?

  5. How do we enable or disable UI for the features?

Any guidance would be appreciated.

Thanx in advance.

@dlpzx
Copy link
Contributor

dlpzx commented Apr 12, 2024

Hi @shivalkarrahul thanks for the issue! Definitely an interesting one.

For the issue on having multiple code versions in different deployment environments we can either:

  1. go for a trunk-based approach and define a ManualApproval stage between the development stages. In data.all there is a parameter called "with_approval": "boolean_ADD_CODEPIPELINE_APPROVAL_STEP|DEFAULT=false", that creates a manual approval stage between the deployment environments.
  2. or go for a gitflow approach and deploy multiple CICD pipelines, each one would be like an standalone data.all deployment reading from a branch in the repository. You would control promotion between stages by branch merging rules.

The second issue is related to the config.json files. For gitflow approach, every deployment would have its own config.json, so it is already solved. For the trunk-based approach which is the standard in data.all we would need to introduce multiple config.json files as you pointed out in point4.

Last thing, I am not sure I understand your point number 5, could you give us some more details?

Bests

@dlpzx dlpzx added type: enhancement Feature enhacement type: question Further information is requested priority: medium effort: medium labels Apr 12, 2024
petrkalos added a commit that referenced this issue Jun 21, 2024
)

### Feature or Bugfix
Feature

### Detail
Currently data.all reads the config that is commited to the root
directory of the repo.
In this PR we allow customers to customize the params as defined in the
config.json (or completely overwrite it) using an SSM parameter
(`/datall/{ENV}/configjson`).
The new workflow will be as follows
1. Read the `config.json` (as always)
2. Read the configjson SSM param and merge it with the contents of
config.json (essentially overwriting the specified params)

This is useful for the following cases...
* Running a CI/CD pipeline directly from GitHub repo and want to
customize the behaviour
* Running multiple stages/envs (dev, uat, prod etc) and want to
customize them separately

### Relates
- #1230 
- #1136 

### Security
Please answer the questions below briefly where applicable, or write
`N/A`. Based on
[OWASP 10](https://owasp.org/Top10/en/).

- Does this PR introduce or modify any input fields or queries - this
includes
fetching data from storage outside the application (e.g. a database, an
S3 bucket)?
  - Is the input sanitized?
- What precautions are you taking before deserializing the data you
consume?
  - Is injection prevented by parametrizing queries?
  - Have you ensured no `eval` or similar functions are used?
- Does this PR introduce any functionality or component that requires
authorization?
- How have you ensured it respects the existing AuthN/AuthZ mechanisms?
  - Are you logging failed auth attempts?
- Are you using or adding any cryptographic features?
  - Do you use a standard proven implementations?
  - Are the used keys controlled by the customer? Where are they stored?
- Are you introducing any new policies/roles/users?
  - Have you used the least-privilege principle? How?


By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
@petrkalos
Copy link
Contributor

@shivalkarrahul currently our config system is a bit convoluted.

We have 2 config files cdkjson and configjson the first is responsible for configuring only the cdk code.
The second though is configuring the backend (lambda/ecs tasks, migration scripts etc), the frontend but also the cdk.
As suggested one solution could be introducing multiple files but that will add even more mental overhead.
So we want to take some time and design a better solution.

In the meantime in #1318 I introduced a way to override config flags using an SSM parameter (i.e /dataall/dev/configjson).
The caveat for using it is that you have to keep in mind that if the flag you are changing also requires changes in the cdk or frontend you should manually release a change in the pipeline.

@anmolsgandhi
Copy link
Contributor

Thanks @petrkalos. Based on the above, we will be moving this to v2.7 scope.

@github-project-automation github-project-automation bot moved this to Nominated in v2.7.0 Jun 21, 2024
@anmolsgandhi anmolsgandhi removed type: question Further information is requested priority: medium labels Jun 21, 2024
@anmolsgandhi anmolsgandhi moved this from Nominated to Prioritized To do in v2.7.0 Jul 12, 2024
@anmolsgandhi anmolsgandhi moved this from Prioritized To do to Nominated in v2.7.0 Jul 15, 2024
@dlpzx dlpzx added this to v2.8.0 Sep 9, 2024
@github-project-automation github-project-automation bot moved this to Nominated in v2.8.0 Sep 9, 2024
@NickCorbett NickCorbett removed this from v2.7.0 Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Nominated
Development

No branches or pull requests

4 participants