Skip to content

Add environment support to Feature services

Emiliano Balbuena requested to merge goal/unleash-sync-namespaces into master

Summary

Add environment namespaces support to feature services

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 with kubectl 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.

Edited by Emiliano Balbuena

Merge request reports