Add environment support to Feature services
Summary
Add environment namespaces support to feature services
- Closes #1335 (closed)
Setup
New schema:
CREATE TABLE minds.feature_toggles_cache_ns (
environment text,
feature_name text,
data text,
created_at timestamp,
stale_at timestamp,
PRIMARY KEY (environment, feature_name)
);
Updated CLI command:
php cli.php features sync --environment=production,canary,staging
Updated Forever runner:
php cli.php features sync --forever --environment=production,canary,staging
Steps to test
- Get pods using
kubectl get pods | grep 'goal-unleash-sync-namespaces'
- SSH into
php-fpm
one withkubectl exec -ti goal-unleash-sync-namespaces-app-<RANDOM ID> sh
- Execute
cd /var/www/Minds/engine && php cli.php features sync --environment=development,sandbox
- The above command will sync two environments. Ensure there are no Exceptions outputted
- On another terminal, get into Cassandra shell with
kubectl exec -ti cassandra-0 cqlsh
- Execute
expand on; SELECT * from minds.feature_toggles_cache_ns;
- Ensure there are feature flag objects listed twice (one for development, other for sandbox) and that the dates are in the range of sync operation (watch out the timezone!)
- Go to https://goal-unleash-sync-namespaces.minds.io/, log in with an administrator
- Open menu > Admin > Features
- Ensure
Environment
is correct and compare the GitLab columns with what's on the Enabled tab on https://gitlab.com/minds/infrastructure/feature-flags/-/feature_flags/ for the corresponding environment spec. - You can also use https://goal-unleash-sync-namespaces.minds.io/admin/features;for=0xemi to check feature for
%pro
and%admin
groups, per example.
Note: As the previous MR, the database check part of might be tricky for @xander-miller to test. The main concern is that critical features are turned on (media modals, etc).
Estimated Regression Scope
Everything related to feature flags.
added scoped labels
assigned to @markeharding, @brianhatchet, and @benhayward.ben
changed the description
- DeveloperResolved by Emiliano Balbuena
May not be an issue at all, but just wanted to let you know
blockchain_creditcard
&psr7-router
are missing from https://gitlab.com/minds/infrastructure/feature-flags/-/feature_flags/?scope=enabled&page=1 but are enabled when looking at the config JSON.Going to do a test of the sites functionality now and will approve assuming it all passes.
- Last reply by Emiliano Balbuena
- DeveloperResolved by Emiliano Balbuena
These may be totally irrelevant also, but just to make sure I bring them up:
modal-pager is true according to
https://goal-unleash-sync-namespaces.minds.io/api/v1/minds/config
but i see no modal pager.Edited by Ben Hayward - Last reply by Emiliano Balbuena
- DeveloperResolved by Emiliano Balbuena
This all looks good, @edgebal
It would be good to add an admin endpoint to get the current feature flags and force a sync on them
- Last reply by Emiliano Balbuena
resolved all threads
added 1 commit
- a6cdf876 - (feat): Admin endpoint for features breakdown
changed the description
resolved all threads
- Developer
I tried by all means to introduce a
Sync Now
button, but I couldn't easily re-trigger manually the operation in the runner without doing a nasty polling every 1 second. Switching to a queue event based system might introduce issues with the "every X minutes" interval. unmarked as a Work In Progress
- Developer
Review sites are defaulting to
development
environment. I tried to setMINDS_ENV
at Helm chart's values.yaml container definitions (env
key), but no luck.I'm going to still move this to BuddyReview so everybody can start taking a look.
- Developer
Fixed
MINDS_ENV
issue at helm-charts!30 (merged). resolved all threads
changed target branch from
production
tomaster
approved this merge request
merged
mentioned in commit 5e9b7bb9