Deploy FeatBit - an open-source feature flag management platform - to Azure using .NET Aspire.
Services:
- FeatBit Web API - Main API server for feature flag management
- FeatBit Evaluation Server - High-performance evaluation engine
- FeatBit UI - Angular-based web interface
- FeatBit Data Analytics - Analytics and reporting service
Infrastructure:
- Database - PostgreSQL or MongoDB (configurable)
- Cache - Redis
- Monitoring - Azure Application Insights (when deployed to Azure)
- Azure subscription
- Azure Developer CLI (azd) - Install guide
- PostgreSQL or MongoDB database - Create a database instance and run FeatBit database initialization scripts:
- For PostgreSQL: Run the PostgreSQL init script
- For MongoDB: Run the MongoDB init script
- Redis instance - Set up a Redis cache instance (local or cloud)
git clone https://github.com/featbit/featbit-aspire.git
cd featbit-aspireEdit FeatBit.AppHost/appsettings.json with your database and Redis connection strings:
For PostgreSQL:
{
"DbProvider": "Postgres",
"ConnectionStrings": {
"Postgres": "Host=yourhost;Database=featbit;Username=user;Password=pass;Port=5432",
"Redis": "yourhost:6379,password=yourpassword,ssl=True"
}
}For MongoDB:
{
"DbProvider": "MongoDb",
"ConnectionStrings": {
"MongoDb": "mongodb://yourhost:27017/featbit",
"Redis": "yourhost:6379,password=yourpassword,ssl=True"
},
"MongoDb": {
"Database": "featbit",
"Host": "mongodb"
}
}appsettings.json contain sensitive credentials. For production deployments, consider these options:
Option A: Deploy with appsettings.json (Quick Start)
- Use the credentials in
appsettings.jsonas-is ⚠️ Ensure the file is in.gitignoreto avoid committing secrets- Suitable for testing and development
Option B: Use Environment Variables (Recommended)
- Remove credentials from
appsettings.json - Set them as environment variables before deployment
- More secure, credentials not stored in code
# Windows PowerShell
$env:ConnectionStrings__MongoDb="mongodb://your-connection-string"
$env:ConnectionStrings__Redis="your-redis-connection-string"
# Linux/Mac
export ConnectionStrings__MongoDb="mongodb://your-connection-string"
export ConnectionStrings__Redis="your-redis-connection-string"Option C: Use Azure Key Vault (Production)
- Store secrets in Azure Key Vault
- Configure Container Apps to reference Key Vault
- Best security, managed secret rotation
- Learn more about Key Vault references
azd auth loginA browser window will open for Azure authentication. Sign in with your Azure account.
azd upThis command will initialize and deploy in one step. During the process, you'll be prompted for several inputs:
Prompt 1: Environment Name
? Enter a new environment name: [? for help]
- Enter a unique name (e.g.,
featbit-prod,featbit-dev) - This will be used in resource naming (e.g.,
rg-featbit-prod) - Use lowercase letters, numbers, and hyphens only
Prompt 2: Azure Subscription (if you have multiple subscriptions)
? Select an Azure Subscription to use:
1. Subscription 1 (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
> 2. Subscription 2 (yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy)
3. Subscription 3 (zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz)
- Use arrow keys to select your subscription
- Press Enter to confirm
Prompt 3: Azure Region
? Select an Azure location to use:
1. (US) East US (eastus)
> 2. (US) West US 2 (westus2)
3. (Europe) West Europe (westeurope)
4. (Asia Pacific) Southeast Asia (southeastasia)
...
- Select the region closest to your users
- Common choices:
eastus,westus2,westeurope,southeastasia - Press Enter to confirm
Deployment Progress:
After providing these inputs, the deployment begins:
Initializing project...
Provisioning Azure resources (azd provision)
Provisioning Azure resources can take some time
(✓) Done: Resource group: rg-featbit-prod
(✓) Done: Container Apps Environment: featbit-env
(✓) Done: Log Analytics workspace
(✓) Done: Application Insights
Deploying services (azd deploy)
(✓) Done: Deploying service featbit-ui
- Endpoint: https://featbit-ui.xxx.eastus.azurecontainerapps.io
(✓) Done: Deploying service featbit-api
- Endpoint: https://featbit-api.xxx.eastus.azurecontainerapps.io
(✓) Done: Deploying service featbit-evaluation-server
- Endpoint: https://featbit-evaluation-server.xxx.eastus.azurecontainerapps.io
SUCCESS: Your application was deployed to Azure in 12 minutes.⏱️ Expected Time: 10-15 minutes total
After deployment completes, note the endpoints displayed:
- FeatBit UI:
https://featbit-ui.<random>.azurecontainerapps.io - FeatBit Web API:
https://featbit-api.<random>.azurecontainerapps.io - FeatBit Evaluation Server:
https://featbit-evaluation-server.<random>.azurecontainerapps.io
Default Login:
- Email:
[email protected] - Password:
123456
The FeatBit Evaluation Server requires WebSocket support. Enable sticky sessions (session affinity) using Azure CLI:
az containerapp ingress sticky-sessions set \
--name featbit-evaluation-server \
--resource-group rg-featbit-trial \
--affinity stickyNote: Replace rg-featbit-trial with your resource group name if different. This configuration persists across azd deploy runs but may need to be reapplied after azd up.
When you need to update your deployed application (e.g., upgrading to a new FeatBit version), use:
azd deployThis command is sufficient for most updates, including:
- Upgrading Docker image versions in AppHost.cs (e.g.,
featbit/featbit-api-server:5.1.4→5.2.0) - Changing environment variables in appsettings.json
- Updating configuration settings
When you run azd deploy, it will detect changes and prompt for confirmation:
$ azd deploy
? The following services will be updated. Continue? (Y/n)
- featbit-api
- featbit-uiPress Y to confirm and proceed with deployment.
Deployment output:
Deploying services (azd deploy)
(✓) Done: Deploying service featbit-api
- Endpoint: https://featbit-api.xxx.eastus.azurecontainerapps.io
(✓) Done: Deploying service featbit-ui
- Endpoint: https://featbit-ui.xxx.eastus.azurecontainerapps.io
SUCCESS: Your application was deployed to Azure in 3 minutes 45 seconds.What gets updated:
- Modified container images are pulled and deployed
- Updated services are redeployed with zero downtime
- New environment variables (if changed in appsettings.json)
- Health checks verify services are running correctly
If no changes are detected:
$ azd deploy
(✓) Done: Service featbit-api is up to date
(✓) Done: Service featbit-ui is up to date
SUCCESS: All services are up to date.Use azd up only when you've made infrastructure-level changes:
azd upExamples requiring azd up:
- Adding or removing services in AppHost.cs
- Changing scaling rules (min/max replicas, CPU/memory limits)
- Modifying network configuration (ports, ingress settings)
- Updating Container Apps Environment settings
Note: For most day-to-day updates (like upgrading FeatBit versions), azd deploy is faster and sufficient.
Quick Reference:
- Upgrading FeatBit versions (changing image tags) → Use
azd deploy(⏱️ ~3-5 min) - Adding/removing services or changing infrastructure → Use
azd up(⏱️ ~10-15 min)
# View all resources and endpoints
azd show
# View logs
azd logs
# Open Application Insights
azd monitorRemove all Azure resources:
azd downYou'll be prompted to confirm:
? Total resources to delete: 6, are you sure you want to continue? (y/N)
Type y and press Enter to delete all resources.
The deployment creates:
-
Azure Container Apps Environment - Managed hosting environment
-
Application Insights - Monitoring and telemetry
-
Log Analytics Workspace - Centralized logging
-
4 Container Apps (each with 3-10 replicas):
featbit-api- Web API Server (external HTTPS)featbit-evaluation-server- Evaluation Server (external HTTPS)featbit-ui- Angular UI (external HTTPS)featbit-da-server- Data Analytics (internal only)
- Replica range: Container Apps are configured with a minimum of 3 and maximum of 10 replicas (see host files in FeatBit.AppHost).
- Resource allocation: API, Evaluation Server, and Data Analytics services are configured with 0.75 CPU and 1.5Gi memory.
- Default image tag: Container images in the host are set to
latestby default — change the image tags inFeatBit.AppHostto pin versions before production deploys. - Service ports: API
5000, Evaluation Server5100, UI (development8081, publish/container80), Data Analytics (development8200→ container80). - DbProvider default: When
DbProvideris not set the host defaults toPostgres. - Application Insights: Application Insights is only added when running in publish/Azure mode (publish-time monitoring).
- Health checks: API and Evaluation Server use
/health/livenessendpoint for health monitoring. - External endpoints:
⚠️ Important:WithExternalHttpEndpoints()must be called beforePublishAsAzureContainerApp()for proper Azure Container Apps ingress configuration. This ordering is critical for external access to work correctly.
Deployment fails:
# Run with debug output
azd deploy --debug
# Check authentication
azd auth login
az account showUpdate connection strings after deployment:
az containerapp update \
--name featbit-api \
--resource-group rg-<your-env-name> \
--set-env-vars \
"Postgres__ConnectionString=<your-connection>" \
"Redis__ConnectionString=<your-redis-connection>"View logs:
# All services
azd logs
# Specific service
azd logs --service featbit-apiUsing MicrosoftDocs MCP Server for Deployment Troubleshooting and Assistance
The MicrosoftDocs MCP Server can significantly enhance your deployment experience by providing real-time access to official Azure documentation and best practices. This MCP Server was heavily relied upon during the creation and testing of this project, offering:
- Accurate Azure guidance - Access to up-to-date Azure documentation and examples
- Deployment assistance - Step-by-step help with Azure Container Apps, azd commands, and configurations
- Troubleshooting support - Quick answers to common Azure deployment issues
If you're using an AI assistant that supports MCP (Model Context Protocol), consider configuring the MicrosoftDocs MCP Server for a smoother deployment experience.
This project follows the same license as FeatBit. See the LICENSE file for details.