Upgrade Unleash client and implement sync step
Summary
Prevent feature flags to trigger GitLab rate limits by introducing separation of concerns and caching via Cassandra.
- Closes #1333 (closed)
Setup
New schema:
CREATE TABLE minds.feature_toggles_cache (
id text PRIMARY KEY,
created_at timestamp,
data text,
stale_at timestamp
);
New CLI command:
php cli.php features sync
Forever runner:
php cli.php features sync --forever
Steps to test
- Get pods using
kubectl get pods | grep 'goal-unleash-sync'
- SSH into
php-fpm
one withkubectl exec -ti goal-unleash-sync-minds-app-<RANDOM ID> sh
- Execute
cd /var/www/Minds/engine && php cli.php features sync
- 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;
- Ensure there are feature flag objects listed and that the dates are in the range of sync operation (watch out the timezone!)
- Using Postman (or Firefox) go to https://goal-unleash-sync.minds.io/api/v1/minds/config
- Ensure the JSON looks OK, and that
features
key is set and values match https://gitlab.com/minds/infrastructure/feature-flags/-/feature_flags/ forsandbox
environment. - Go to https://goal-unleash-sync.minds.io/, log in an ensure the site functionality is OK.
Note: The first part of this one might be tricky for @xander-miller to test as it's a backend-only implementation change. The main concern is that critical features are turned on (media modals, etc).
Estimated Regression Scope
Everything related to feature flags.
Edited by Emiliano Balbuena