Generator-jhipster: Feature Request : Feature Toggle with ff4j

Created on 20 May 2017  路  10Comments  路  Source: jhipster/generator-jhipster

Overview of the issue

As tech lead of FF4J (http://ff4j.org) I would like to work integrating the FF4J Feature Togggle library in JHipster.

It could become one of the question asked "Do you want to handle feature toggle ?" and the several elements could be part of the application generated :

  • Import libraries (!) based on DB chosen by the user (I may be wrong but all DB proposed are supported by ff4J).
  • Declaration of the servlet to have administration console
  • Declaration of the servlet to have REST API (and provide feature toggle for the UI as well)

feature_07_webconsole

Motivation for or Use Case
  • This Feature Toggle capability is not yet provided. I would think it make sense sometimes to generate more things that usually used and toggle OFF until really implemented it may be easier than incremental generations.

  • FF4j is open source and has a strong focus on quality (look by yourself https://github.com/clun/ff4j)

  • FF4j is written 100% in Java an JS
  • It's french (cocorico)
  • FF4J do not only store features states but is also Property management capabilities (dynamic configuration externalization)
  • FF4J do not only store features states but tracking everything done by users and provide monitoring screens
And so questions :
  • Would it make sens ?
  • What would be the most efficient way to implement integration the good way immediately
area module

Most helpful comment

Hola,

[Follow-up] - The generator is improving bit by bit : https://github.com/clun/generator-jhipster-ff4j

So far :

  • [x] Add an item in the Admin Menu
  • [x] Copy templates/configuration in the target App
  • [x] Update webPack (urls) configuration
  • [x] Update Spring Securityto secure the servlet
  • [x] Change CSRF security to allow POST requests coming from ff4j console (did not find other way)
  • [x] Setting up FF4j to use the same DatabaseType and Datasources as Jhispter.
  • [x] Put FF4J Audit into Jhipster Audit Tables
  • [x] Put FF4J settings into application.yml
  • [x] Initialize ff4j with flags of Jhipster (ultimate goal is to see if I can integrate with *ngIf=featureName seemlessly.
  • [x] Publish
    Declare FF4J objects as Jhipster entities and update ff4j class to work with them (added value??)

Capture:
menu

All 10 comments

@clun I had never heard of FF4J, and this is totally awesome! I took some time to review it, this is really well done, and it would be very useful for a lot of projects.

So, first of all, congratulations for this project, and I'm pretty sure we can do something together (be it with JHipster or not).

Now for the JHipster integration: how complex do you think this integration would be? We have usually 3 levels of integration:

  • Modules on our marketplace: https://jhipster.github.io/modules/marketplace - you can do this the way you want, you don't need us, and that's usually the best way to get started.
  • A sub-generator in the project - this one probably wouldn't fit well with FF4J
  • As you asked, as an option in the project

Usually, the best way to get started is to do a module, and then, once it's popular, "upgrade" it as a generator option.

Now, as we are having more and more great modules (and here I'm specifically thinking of generator-jhipster-db-helper by @bastienmichaux and @AdrienHorgnies ), we should have a page where we focus on some "official", "high importance" modules. So that would be in-between a normal module, and a generator option.

Would that be OK for you?

@clun and if that's easy to do, and you have a module ready before the end of June, you could present it at our next Paris JHipster meetup (I'm currently looking for speakers)

Yes, this looks to be an awesome library ! I had similar needs, so I totally get that this could be a nice addition to JHipster. For a full integration we could pick one, or more demo feature (as with WebSocket and the tracker stuff), for example, to implement a feature switch to disable the new user registration. That would mean, to implement the storage layer with the selected backend, and a REST interface, and some Angular code, to fetch the actual flags, and hide the buttons/links according to it.

Very cool. @clun ff4j looks awesome (I looked at it when it was in early state once). I have used https://www.togglz.org/ some time ago and always wanted to write a module for it, but ff4j looks better now. @gzsombor I like your idea of having a simple, but very useful feature flag as an example. Some of my friends started to use jhipster always asked how to disable register function, it would be awesome I could tell them, well, just disable it via the administration interface!

Personnaly, I think this would be really cool to have as a feature in the generator itself.
Feature toggle is one of my areas of interest and I'm especially interested in how we could make it work for microservices, maybe by integrating the ff4j UI in the jhipster registry.

@clun I have seen from your docs that ff4j supports Archaius. Archaius was initially considered when developing our registry but we finally went for spring cloud config. This was a very good idea because it integrates with spring boot so well. Do you think ff4j can be made to work with spring cloud config ?

Thank you for all your nice comments, as you probably know it is always good to have a feedback loop.

I specially appreciated the comment on Togglz :) it's settled :

  • As proposed by @jdubois I will start with a module and progress step-by-step

  • FF4J indeed support Archaius (https://github.com/clun/ff4j/wiki/Store-Technologies#archaius) in 2 ways: it could be the source of properties for archaius or on the contrary retrieve values from Archaius. There is no reason I couldn't do the same with Spring Cloud Config but i need to go under the hood this @EnableAutoConfiguration annotation may hides some complexity after all.

  • If everything goes as expected I will be honored to be speaker in JHipster meetup. I am also available for a BBL on FF4j at Ippon one of this day.

Perfect @clun !!
I'm closing this as it's going to be a module, but don't hesitate to comment or ping us.
For the Paris JHipster User Group, I'll contact you - I still need to find the date & place, but that should be easy.

@jdubois : before summer holidays plz ;-)

Hola,

[Follow-up] - The generator is improving bit by bit : https://github.com/clun/generator-jhipster-ff4j

So far :

  • [x] Add an item in the Admin Menu
  • [x] Copy templates/configuration in the target App
  • [x] Update webPack (urls) configuration
  • [x] Update Spring Securityto secure the servlet
  • [x] Change CSRF security to allow POST requests coming from ff4j console (did not find other way)
  • [x] Setting up FF4j to use the same DatabaseType and Datasources as Jhispter.
  • [x] Put FF4J Audit into Jhipster Audit Tables
  • [x] Put FF4J settings into application.yml
  • [x] Initialize ff4j with flags of Jhipster (ultimate goal is to see if I can integrate with *ngIf=featureName seemlessly.
  • [x] Publish
    Declare FF4J objects as Jhipster entities and update ff4j class to work with them (added value??)

Capture:
menu

It is just awesome. I can't express in words. Thanks @clun
I would love to see the document for easy to use.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

trajakovic picture trajakovic  路  4Comments

shivroy121 picture shivroy121  路  3Comments

RizziCR picture RizziCR  路  3Comments

pascalgrimaud picture pascalgrimaud  路  4Comments

DanielFran picture DanielFran  路  3Comments