Setting up Flipper takes only a few minutes. Follow the guide below or let us know if you would prefer to have us do it for you.
For the moment, Flipper Cloud only supports ruby applications. If there is another language you would like to see support for, we would love to know.
In addition to the steps outlined below, we have a fully functional example Rails application for you to peruse.
It's recommended to persist your Flipper configuration locally with an adapter of your choice (e.g. ActiveRecord, Redis, Sequel, Mongo, or several other adapters). You can decide this later if you don't know which one you want now.
gem "flipper-cloud" gem "flipper-active_record"
bundle to install.
If you're using the ActiveRecord adapter, you'll also need to generate the migrations and run them.
$ bin/rails g flipper:active_record $ bin/rails db:migrate
You'll need to set the following
Flipper#enabled? in your app for anything you want to gate access to, such as rolling out new features, taking parts of your system offline for maintenance without disrupting everyone else, or many other reasons.
For example, here we check if the search feature of our app is enabled:
before_action :ensure_search_enabled def ensure_search_enabled render :unavailable unless Flipper.enabled?(:search) end
Now flip this feature on for different segments of your users:
# Enable a feature for everyone Flipper.enable :search # Enable a feature for a specific actor Flipper.enable_actor :search, current_user # Enable a feature for a group of actors Flipper.enable_group :search, :admin # Enable a feature for a percentage of actors Flipper.enable_percentage_of_actors :search, 2
Read more about enabling features.
We recommend syncing using webhooks for production. Using webhooks means that your app will only communicate with Cloud for writes (e.g.
disable), and is entirely disconnected from Cloud for reads (e.g.
enabled?). This ensures that you are in control of your own availability, which is always a good practice for external services.
Add a new production webhook in Cloud (e.g.
https://yourapp.com/_flipper). Once you create the webhook, you'll be taken to a page where you can get the webhook's secret. Update your
ENV to set
FLIPPER_CLOUD_SYNC_SECRET to this value.
If you're using Rails, we'll automatically mount the middleware to receive and act on these hooks at
https://yourapp.com/_flipper when the
FLIPPER_CLOUD_SYNC_SECRET environment variable is set.
That's it. For a couple lines of code and a couple of clicks you get the full power of feature toggles with little to no performance impact.
We would be delighted to answer any questions or even setup a pairing session to help you get your application setup correctly. Shoot an email to email@example.com.