TL;DR
In this article, you’ll learn the fundamentals of feature flagging, its benefits, and how to get started with an amazing OSS feature flag platform, Flipt. Apart from that, here are a few other things we will cover in this article:
- The basic concepts and features of Feature flagging.
- How do you set up Flipt in your development environment?
- A practical example of how to set up feature flags with Flipt.
- Areas where Flipt could be helpful.
Introduction to Feature Flagging
Imagine a world where you can toggle a feature on and off in your production environment without modifying the code. Sounds super cool, right? That’s the world we live in right now. As developers, we always strive to make development more efficient. That’s why we have techniques like feature flagging.
Feature Flags, also known as Feature Toggles or Feature Switches, are development tools that allow you to enable and disable features without code modification or deployment. Essentially, a flag has two states: enabled and disabled.
In this context, a flag itself represents a piece of code that controls a feature.
Feature flagging is one of the best DevOps practices and offers a bunch of benefits. In this article, we will have a glance at a few benefits feature flags offer:
- Enable features in production: Feature flags let you toggle features on and off in production, simplifying development and deployment. It removes the need for frequent commits or pull requests. By adding feature flagging to your Continuous Delivery (CD) pipeline, you can deploy features safely, enabling them when ready. This also allows private testing in production before exposure to other users, ensuring a smooth deployment.
- Risk reduction: Feature flagging helps reduce the risk of deploying buggy code to your users. With feature flagging, you can disable a feature if buggy, minimizing the impact on users.
- Canary releases: Canary releases allow you to launch a feature to a small group of users before it reaches the entire user base. This enables you to test a feature or code change in stages, starting with a small subset of users and then expanding the release as you grow more confident.
In the next section, we will delve into the world of feature flags with Flipt. 🚀
Flipt: OSS platform for Feature Flags 🏳️
Flipt is an open-source, cloud native, feature flag solution that’s fully self-hosted It can be used by technical and non-technical folks to manage features effectively.
Please, support Flipt 😅 🙏
Before moving on, I’d love it if you could support our work at Flipt by giving us a star on GitHub. ⭐️
Key Features of Flipt
- Self-Hosted: Flipt is open-source and self-hosted, giving you access to manage the flags in your infrastructure. This is beneficial for both small and large-scale teams, as it means evaluation is as fast as can be since your code doesn’t need to make requests out to a third-party over the internet. Also, this means that no Personal Identifiable Information (PII) from your users is sent outside of your infrastructure.
- Integration: You can integrate Flipt into any environment, regardless of programming language and hosting. Flipt provides a rich set of SDKs for feature flag evaluation, and also exposes a first-class REST API and supports GRPC. Flipt also integrates with modern metrics, tracing, and logging tools, allowing you to keep using the tools you are comfortable with.
As far as storage, Flipt runs against a variety of storage backends, including MySQL, Postgres, CockroachDB, SQLite, and more. It can also run with non-relational DB backends like Git or Object Stores, such as S3. See Flipt’s storage documentation for more information.
- Powerful: Flipt empowers developers to enable or disable code at runtime based on various contexts, such as user attributes or geographic location. This dynamic control allows for precise, context-aware feature management, delivering personalized experiences and ensuring features are activated only when needed.
Setting up Flipt
Flipt runs on the following architectures/OS’:
- x86-64 / Linux
- ARM64 / Linux
- x86-64 / Darwin/MacOS
- ARM64 / Darwin/MacOS
Now, let’s look into the available methods of how to install Flipt on your local machine:
- Docker: If you have Docker installed correctly on your local machine, you can run this docker image for installation:
docker run -d \
-p 8080:8080 \
-p 9000:9000 \
-v $HOME/flipt:/var/opt/flipt \
docker.flipt.io/flipt/flipt:latest
- Homebrew: If you have Homebrew installed on your local machine, you can run this command on your terminal to install Flipt:
brew install flipt-io/brew/flipt
After a successful installation, you can run the flipt
command on your terminal to get Flipt running.
- GitHub: The binary releases of Flipt are available on GitHub, you can install Flipt’s latest release automatically by running this command on your terminal:
curl -fsSL https://get.flipt.io/install | sh
- Kubernetes/Helm: Ensure you have Helm installed on your local machine, then add Flipt’s Helm repository to Helm.
helm repo add flipt https://helm.flipt.io
Then install the Flipt container and get it running in your Kubernetes cluster.
helm install flipt flipt/flipt
After successfully installing through any of these methods, you can now navigate to http://localhost:8080/ in your browser to see the Flipt dashboard.
Congratulations, now you have Flipt’s self-hosted instance running on your local machine! 🎉
💡 Indicator: In this blog post, we won’t be integrating Flipt into any application as this is a walkthrough guide for using Flipt. However, if you are looking to integrate Flipt into your existing application, we provide a number of SDKs for different languages as well as both GRPC and REST APIs:
In our next set of posts, we’ll be describing how to integrate Flipt into existing applications.
Creating Feature Flags with Flipt
To create your first flag, navigate to the Flag section from the sidebar on your Dashboard and create a new flag.
- Set name and attributes: This is basic but crucial to your flag’s creation. Apart from giving flags a name, setting configuration for the flags are very important. In this context, basic configuration means to define a type of flag as well as rules/rollouts
You must identify the type of flag you want to create. There are two major types:
-
Variant: In Flipt, this is the default flag type and is useful for cases where you need more than a simple on/off switch, such as serving different variations of a feature.
When you’re working with a variant flag, you’ll need to provide a r*ule*. Rules in Flipt enable you to create more targeted feature flagging strategies, ensuring that specific user segments receive the variant of a feature based on predefined rules. This documentation will guide you through everything on Rules in Flipt.
Boolean: A Boolean flag is the simplest type and can be either true or false. It allows you return a value for a boolean flag. If you working with a Boolean flag, you need to configure rollouts.
Rollouts allow for more control over feature deployment, enabling specific conditions to determine whether a feature flag is enabled or not.
Evaluating Feature Flags with Flipt
Once you have created your feature flags, the next step is to evaluate them. Evaluation is the process of sending requests to the Flipt server to process and determine if that request matches any of your segments and, if so, which variant or boolean value to return depending on the flag type.
- Navigate to the Console tab: From the Flipt dashboard, go to the 'Console' section in the sidebar.
- Choose a Flag: Select the feature flag you want to evaluate from the Flag key’s dropdown menu.
- Evaluate: Click the 'Evaluate' button to see the result. The console will show whether the feature flag is enabled or disabled based on the context attributes you provided.
For example, let’s evaluate a flag with a Boolean value.
There we have the result we’re looking for! 🎉
Using the evaluation console is a great way to test and understand how your feature flags will perform, ensuring that your rules and rollouts are working as expected before deploying to production.
Conclusion
You now have a basic knowledge about feature flags and a bit about how Flipt works. We've covered the basics of what feature flagging is, the benefits it offers, and provided a step-by-step guide on setting up and using Flipt. Additionally, we explored key features of Flipt, such as its ability to be self-hosted, its integration capabilities, and powerful rules engine.
This wasn’t really a technical piece, rather it’s a blog post to get you prepared for the world of feature flags with Flipt.
Thank you for taking the time to learn about feature flagging and Flipt. If you found this article helpful, please consider supporting Flipt by giving us a star on GitHub. Your support helps us continue improving and providing valuable tools for the community.
Also, if you have any questions, you can join our community on Discord.
Top comments (1)
Great overview of feature flagging! One question: how does Flipt handle potential performance impacts when toggling features frequently in a high-traffic application?