Skip to main content

Overview

This guide walks you through the complete installation process for Masar Eagle. Choose between local development or production deployment based on your needs.
Before proceeding, ensure you have completed the Prerequisites setup.

Quick Start

Get Masar Eagle running in under 5 minutes:
1

Clone the Repository

git clone https://github.com/your-org/masar-eagle.git
cd masar-eagle
2

Run with .NET Aspire

cd src/aspire/AppHost
dotnet run
This will:
  • Start the Aspire orchestration dashboard
  • Launch all microservices
  • Provision PostgreSQL, RabbitMQ, and monitoring tools
  • Open the dashboard at http://localhost:8080
3

Access Services

Installation Methods

Local Development

Run with .NET Aspire for development

Docker Deployment

Deploy using Docker Compose

Aspire Deployment

Deploy with .NET Aspire publish

Kubernetes

Deploy to Kubernetes cluster

Local Development

Step 1: Clone and Navigate

git clone https://github.com/your-org/masar-eagle.git
cd masar-eagle

Step 2: Restore Dependencies

# Restore all NuGet packages
dotnet restore

# Verify restoration
dotnet build --no-restore

Step 3: Configure AppHost

The AppHost is pre-configured but can be customized:
{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning",
      "Aspire.Hosting.Dcp": "Warning"
    }
  },
  "Parameters": {
    "username": "guest",
    "password": "guest"
  }
}

Step 4: Run the Application

cd src/aspire/AppHost
dotnet run

Step 5: Verify Installation

1

Check Aspire Dashboard

Open http://localhost:8080 to see the Aspire orchestration dashboard.You should see:
  • All services in “Running” state
  • PostgreSQL and RabbitMQ healthy
  • No error logs
2

Test API Gateway

# Health check
curl http://localhost:8080/health

# Expected response
{"status":"Healthy"}
3

Check Database Connectivity

# Access pgAdmin at http://localhost:5050
# Default credentials are set by Aspire

# You should see 4 databases:
# - user
# - trip
# - notifications
# - auth
4

Verify Message Queue

# Access RabbitMQ Management UI
# http://localhost:15672
# Username: guest
# Password: guest

# Check that exchanges and queues are created

Service Configuration

Architecture Overview

Masar Eagle consists of the following services:

Gateway

YARP-based API Gateway
  • Routes requests to services
  • Service discovery
  • Load balancing

Identity

Authentication Service
  • OpenIddict integration
  • JWT token generation
  • User authentication

Users

User Management
  • Driver profiles
  • Passenger profiles
  • Company management

Trips

Trip Management
  • Booking system
  • Wallet management
  • Trip scheduling

Notifications

Notification Service
  • Firebase Cloud Messaging
  • Push notifications
  • Device token management

Service Dependencies

The AppHost configures service dependencies and startup order:
AppHost.cs (excerpt)
// PostgreSQL with 4 databases
var postgres = builder.AddPostgres("postgres")
    .WithDataVolume("masar-postgres-data")
    .WithPgAdmin();

var usersDb = postgres.AddDatabase("user");
var tripsDb = postgres.AddDatabase("trip");
var notificationsDb = postgres.AddDatabase("notifications");
var authDb = postgres.AddDatabase("auth");

// RabbitMQ with management plugin
var rabbitmq = builder.AddRabbitMQ("rabbitmq")
    .WithDataVolume("rabbitmq-data")
    .WithManagementPlugin();

// Services with dependencies
builder.AddProject<User>("user")
    .WithReference(usersDb)
    .WithReference(rabbitmq)
    .WaitFor(usersDb)
    .WaitFor(rabbitmq);
All services automatically wait for their dependencies to be healthy before starting.

Database Migrations

Automatic Migrations

Masar Eagle uses FluentMigrator for database migrations. Migrations run automatically on service startup:
# Migrations are applied when each service starts
# Check logs for migration status:

[Information] Running migrations for database: user
[Information] Migration 20240101000000_InitialSchema completed
[Information] Database is up to date

Manual Migration Control

# Run migrations for a specific service
cd src/services/Users/Users.Api
dotnet run -- --migrate

Monitoring Setup

OpenTelemetry Configuration

All services are configured with OpenTelemetry for observability:
// Each service sends telemetry to the collector
services.WithEnvironment("OTEL_EXPORTER_OTLP_ENDPOINT", "http://otelcollector:4317")
    .WithEnvironment("OTEL_EXPORTER_OTLP_PROTOCOL", "grpc")
    .WithEnvironment("OTEL_SERVICE_NAME", serviceName);

Access Monitoring Tools

URL: http://localhost:9090
# Example queries
rate(http_requests_total[5m])
up{job="user"}
URL: http://localhost:3000Pre-configured dashboards for:
  • Service metrics
  • Database performance
  • RabbitMQ statistics
  • Business metrics
URL: http://localhost:16686View request traces across all services:
  • Request flow visualization
  • Performance bottlenecks
  • Error tracking
URL: http://localhost:3100Access via Grafana Explore:
  • Centralized logs from all services
  • Log filtering and searching
  • Log correlation with traces

Troubleshooting

If you encounter port conflicts:
# Check which process is using a port
lsof -i :8080  # Linux/macOS
netstat -ano | findstr :8080  # Windows

# Modify AppHost.cs to use different ports
builder.AddProject<Gateway>("gateway")
    .WithHttpEndpoint(port: 8081);  // Change port
If services can’t connect to PostgreSQL:
# Check PostgreSQL container status
docker ps | grep postgres

# View PostgreSQL logs
docker logs <container-id>

# Restart PostgreSQL
docker restart <container-id>
Check the Aspire dashboard logs:
# Services log startup issues to console
# Common issues:
# - Missing environment variables
# - Database migration failures
# - Port conflicts
# Verify RabbitMQ is running
docker ps | grep rabbitmq

# Check RabbitMQ logs
docker logs <rabbitmq-container-id>

# Verify credentials in appsettings.json
If you encounter persistent issues, try cleaning and rebuilding:
# Clean solution
dotnet clean

# Remove containers and volumes
docker compose down -v

# Rebuild and run
dotnet build
cd src/aspire/AppHost
dotnet run

Environment-Specific Setup

Development Environment

# Use mock services for external dependencies
export ASPNETCORE_ENVIRONMENT=Development

# SMS Provider: Mock (no real SMS sent)
# Email Provider: Resend (test mode)
# Payment Provider: Moyasar (test keys)

Staging Environment

export ASPNETCORE_ENVIRONMENT=Staging

# Use staging databases
# Enable full telemetry
# Use test payment gateways

Production Environment

See Aspire Deployment or Docker Deployment for production setup.

Next Steps

Configuration

Configure environment variables and settings

Docker Deployment

Deploy using Docker Compose

Aspire Deployment

Production deployment with Aspire

Additional Resources

.NET Aspire Docs

Official .NET Aspire documentation

Architecture Overview

Learn about Masar Eagle architecture

Build docs developers (and LLMs) love