Innovate
Your Software
Faster without Risk
Innovate Your Software Faster without Risk
Hosting a Free and Open-Source Feature Flag Tool in Azure Web App Services: A Comprehensive Guide
Introduction
This article demonstrates how to self-host a fast, scalable, and open-source feature flag tool on Azure Web APP Services at no cost, risk, or confusion by cloning the project.
In this guide, we will focus on implementing the goal using the Azure Portal UI. If you're interested in a tutorial on Infrastructure as Code (IaC) and automation processes, feel free to request it, and I'll be happy to write one! Additionally, an article on deploying with Azure Kubernetes Service (AKS) using Helm charts will be published at a later date.
Introduce FeatBit
FeatBit is a fast, scalable, and open-source feature flag tool. As an open-source solution, it boasts an extensive range of features compared to other open-source feature flag tools. These include User Segments, WebSocket Connection, Custom Roles & Permission Control, Feature Usage Insights, A/B Testing Analytics, Audit Logs, Technical Debt Reduction, and more.
You can easily host FeatBit using a Docker Container on your local computer or try it online. This makes it simple to deploy in any cloud environment.
FeatBit offers two versions: the normal version and the Pro version. The key difference between them is that the Pro version utilizes Kafka and Clickhouse for data injection and analytics. This ensures the product can support millions of concurrent users for feature usage insights, custom event collection, and big data A/B testing analytics. You can find a detailed comparison of the two versions in this documentation.
In this article, we will focus on hosting the normal version of FeatBit on Azure Web App Services.
Architecture
FeatBit (non-Pro version) is composed of several microservices and databases:
- Front-end UI: Provides users with a visual UI interface for managing and publishing feature flags, segments, experiments, etc.
- API Server: Offers data management capabilities for the UI and external integration services, such as flag triggers and code-references.
- Evaluation Server: Delivers a scalable and high-performance flag rule evaluation engine and a data distribution server.
- Data Analytics Server: Features a data analytics engine that ensures the following services:
- Calculates experiments and returns their results in near real-time.
- Provides insight services for all analytics in the UI, such as feature flag reporting.
- Redis : Serves two roles:
- A cache layer to enhance performance.
- A message queue that ensures high throughput asynchronous data communication among various services.
- MongoDB: The primary database. All feature flags, segments, experiments, end-users, and analytics data are stored in MongoDB.
We will deploy the Front-end UI
, API Server
, Data Analytics Server
, and Evaluation Server
to the Web App Services with Container in a single Linux Azure App Plan. You can host any Redis service of version 5.0.0 or higher and any MongoDB service of version 5.1.0 or higher.
Host Databases
For Redis, you can use Azure Cache for Redis, Redis SaaS, host a Redis service in an Azure Web App Container, or any other method. In our TryItOnline, we used the Redis Cloud service because it offers a free plan and supports the latest features like lpop 100
(although this feature is not a must-have for FeatBit, it's worth noting that Azure Cache for Redis does not support it).
Unfortunately, Azure CosmosDB cannot be used, as you need a MongoDB version above v5.0.0 that supports the Time Series Collection
feature. In our TryItOnline, we used the MongoDB cloud service because it provides a free plan with the latest features like Time Series Collection
.
Host FeatBit to Azure Web APP Services
Why do we host FeatBit's microservices in Azure App Service Plan? Because:
- It's a more mature and familiar PaaS solution for Azure users.
- They share a single Azure App Service Plan, which can save money.
- It's a scalable PaaS solution that can easily scale up and out when users' requests increase. FeatBit supports this well.
- It provides an easy way to build SSL and custom domains.
- It offers private-endpoint-like features, allowing for strict network access strategies and reduced latency between web services and databases.
- It can easily work together with other Azure services.
- It has an SLA that your own virtual machine may not have.
Create a Azure Web APP Service with Container for FeatBit Front-end Portal service
In the Azure Portal, create a new web app resource. You can name it featbit-ui
any other name you prefer.
Nothing special is required, but choose Docker Container
and Linux
as the Publish Type and Operating System, respectively.
Click the Next: Docker
button to go to the Docker
tab. In the Docker
tab, configure the settings as shown in the image below. You need to use the latest version of FeatBit's portal docker image, featbit/featbit-ui:latest
, published on Docker Hub.
Next, enable Enable public access
in the Networking
tab. Click Review + create
. Click Create
. Wait until the service is created.
Create a Azure Web APP Service with Container for FeatBit API service
In the Azure Portal, create a new web app resource. You can name it featbit-api
or any other name you prefer.
Nothing special is required, but choose Docker Container
and Linux
as the Publish Type and Operating System, respectively.
Click the Next: Docker
button to go to the Docker
tab. In the Docker
tab, configure the settings as shown in the image below. You need to use the latest version of FeatBit's portal docker image, featbit/featbit-api-server:latest
.
Next, enable Enable public access
in the Networkin
tab. Click Review + create
, followed by Create
. Wait until the service is created.
Next, enable Enable public access
in the Networking
tab. Click Review + create
. Click Create
. Wait until the service is created.
Create a Azure Web APP Service with Container for FeatBit Evaluation service
In the Azure Portal, create a new web app resource. You can name it featbit-eval
or any other name you prefer.
Nothing special is required, but choose Docker Container
and Linux
as the Publish Type and Operating System, respectively.
Click the Next: Docker
button to go to the Docker
tab. In the Docker
tab, configure the settings as shown in the image below. You need to use the latest version of FeatBit's portal docker image, featbit/featbit-evaluation-server:latest
.
Next, enable Enable public access
in the Networkin
tab. Click Review + create
, followed by Create
. Wait until the service is created.
Next, enable Enable public access
in the Networking
tab. Click Review + create
. Click Create
. Wait until the service is created.
Create a Azure Web APP Service with Container for FeatBit Data Analytics service
In the Azure Portal, create a new web app resource. You can name it featbit-da
or any other name you prefer.
Nothing special is required, but choose Docker Container
and Linux
as the Publish Type and Operating System, respectively.
Click the Next: Docker
button to go to the Docker
tab. In the Docker
tab, configure the settings as shown in the image below. You need to use the latest version of FeatBit's portal docker image, featbit/featbit-data-analytics-server:latest
.
Next, enable Enable public access
in the Networkin
tab. Click Review + create
, followed by Create
. Wait until the service is created.
Next, enable Enable public access
in the Networking
tab. Click Review + create
. Click Create
. Wait until the service is created.
Configure Envrionment Variables in each Web APP Service
After Web App Services are created, we need to copy their service domain names as parameters for each service's environment. Additionally, we need the Redis and MongoDB connection strings to serve as parameters for the Web App Services..
Before we start configuring each web app service, gather the following information:
- The domain name for
featbit-ui
(provided by Azure or your custom domain). - The domain name for
featbit-api
(provided by Azure or your custom domain). - The domain name for
featbit-eval
(provided by Azure or your custom domain). - The domain name for
featbit-da
(provided by Azure or your custom domain). - The Redis connection string, including the host URL, port number, and password.
- The MongoDB connection string, including the host URL, port number, and password.
Configure environment parameters for DA service
Go to the Configuration page of the featbit-da
web app service. Add new settings:
- CHECK_DB_LIVNESS: Enter
false
as the value. - MONGO_HOST: Provide the MongoDB host address string, without the secret key.
- MONGO_INITDB_DATABASE: Enter
featbit
as the value. - MONGO_URI: Include the MongoDB connection string (host URL, port number, and password).
- REDIS_HOST: Provide the Redis host URL.
- REDIS_PASSWORD: Enter the Redis connection password.
- REDIS_PORT: Specify the Redis connection port.
Restart the service after saving the configuration.
Configure environment parameters for the Evaluation service
Go to the Configuration page of the featbit-eval
web app service. Add new settings:
- MongoDb__ConnectionString: Include the MongoDB connection string (host URL, port number, and password).
- MongoDb__Database: Enter
featbit
as the value. - Redis__ConnectionString: Provide the Redis connection string (host URL, port number, and password).
Restart the service after saving the configuration.
Configure environment parameters for the API service
Go to the Configuration page of the featbit-api
web app service. Add new settings:
- MongoDb__ConnectionString: Include the MongoDB connection string (host URL, port number, and password).
- MongoDb__Database: Enter
featbit
as the value. - OLAP__ServiceHost: Provide the
featbit-da
domain name (provided by Azure or your custom domain). - Redis__ConnectionString: Provide the Redis connection string (host URL, port number, and password).
Restart the service after saving the configuration.
Configure environment parameters for the Portal
Go to the Configuration page of the featbit-ui
web app service. Add new settings:
- API_URL: The
featbit-api
domain name (provided by Azure or your custom domain). - DEMO_URL: Enter the DinoGame URL, as shown in the image below.
- EVALUATION_URL: The
featbit-eval
domain name (provided by Azure or you custom domain).
Restart the service after saving the configuration.
Try it out
After completing all the steps above, you can visit your Portal through the domain name in your Web App Service for the FeatBit portal.
Conclusion
In conclusion, this article has guided you through the process of self-hosting the FeatBit feature flag tool on Azure Web App Services. By following these steps, you have successfully deployed FeatBit's microservices, connected to Redis and MongoDB services, and leveraged the benefits of Azure Web App Services. Now you can enjoy FeatBit's extensive range of features to optimize your development workflow. Don't hesitate to explore other deployment methods and dive deeper into FeatBit's documentation to make the most of this open-source tool.
You can join our Slack Community for any question.