EvvaAgent is a modern, modular infrastructure management system built with .NET 9 and ASP.NET Core. It provides automated deployment, service management, and infrastructure monitoring through a flexible module-based architecture.
- Modular Architecture: Extensible plugin system for different services
- Real-time Communication: SignalR integration with EvvaCore
- Automated Deployments: Git-based deployment workflows
- Service Management: Windows/Linux service control
- Nginx Management: Complete Nginx configuration automation
- System Monitoring: CPU, Memory, Disk metrics collection
- Cross-Platform: Windows and Linux support
- Database Integration: SQLite with Entity Framework Core
- Architecture.md - System architecture overview
- ModuleSystem.md - Module development guide
- Infrastructure.md - Infrastructure services
- Classes.md - Complete API reference
- NginxModule.md - Nginx automation module
- EvvaCommands.md - Command system reference
evva-agent/
├── Core/ # Core abstractions and command system
│ ├── Abstractions/ # IEvvaModule, IEvvaResource interfaces
│ ├── Commands/ # ModularCommandService
│ └── Extensions/ # DI registration extensions
├── Modules/ # Feature modules
│ └── Nginx/ # Nginx management module
│ ├── Domain/ # Models and configurations
│ ├── Services/ # Business logic (NginxService)
│ └── Resources/ # Command implementations
├── Infrastructure/ # Cross-cutting services
│ ├── Communication/ # CoreHubService (SignalR)
│ ├── Execution/ # CommandExecutorService
│ ├── Deployment/ # DeploymentService
│ ├── Metrics/ # MetricsService
│ └── Data/ # Repository implementations
├── Domain/ # Domain entities and repositories
├── Workers/ # Background services
├── Services/ # Legacy services (ServiceManager)
└── docs/ # Documentation
- .NET 9.0 SDK
- Git (for deployments)
- Nginx (optional, for web server management)
- Clone the repository:
git clone <repository-url>
cd evva-agent- Build the project:
dotnet build- Run the application:
dotnet runCreate appsettings.json:
{
"ConnectionStrings": {
"DefaultConnection": "Data Source=evva-agent.db"
},
"Nginx": {
"ConfigPath": "C:\\nginx\\conf\\nginx.conf",
"ExecutablePath": "C:\\nginx\\nginx.exe",
"SitesAvailablePath": "C:\\nginx\\conf\\sites-available",
"SitesEnabledPath": "C:\\nginx\\conf\\sites-enabled"
},
"EvvaCore": {
"HubUrl": "https://your-evva-core/hubs/agent",
"AgentId": "unique-agent-identifier"
}
}{
"command": "evva.nginx.add.proxy",
"parameters": {
"Domain": "api.example.com",
"Port": 80,
"TargetUrl": "http://localhost:3000"
}
}# Service Management
curl -X POST http://localhost:5000/api/service/create \
-H "Content-Type: application/json" \
-d '{"name": "myapp", "executablePath": "/path/to/app"}'
# Start Service
curl -X POST http://localhost:5000/api/service/myapp/start
# Stop Service
curl -X POST http://localhost:5000/api/service/myapp/stopevva.nginx.add.server- Add server configurationevva.nginx.add.proxy- Add reverse proxyevva.nginx.add.static- Add static siteevva.nginx.remove.server- Remove serverevva.nginx.enable.site- Enable siteevva.nginx.disable.site- Disable siteevva.nginx.test.config- Test configurationevva.nginx.reload- Reload Nginxevva.nginx.restart- Restart Nginxevva.nginx.status- Get Nginx status
- Deployment workflows
- Service management
- System metrics collection
- File operations
- Create folder structure:
Modules/MyModule/
├── Domain/ # Models and DTOs
├── Services/ # Business logic
├── Resources/ # Command implementations
└── MyModule.cs # Module registration
- Implement IEvvaModule:
public class MyModule : IEvvaModule
{
public string Name => "mymodule";
public IEnumerable<string> GetAvailableCommands()
{
return new[] { "mymodule.action1", "mymodule.action2" };
}
public async Task<object> ExecuteCommandAsync(string command, string? parameters, IServiceProvider serviceProvider)
{
// Route to appropriate resource
var parts = command.Split('.');
var resource = parts[1]; // mymodule
var method = string.Join('.', parts.Skip(2)); // action1
// Get resource and execute
var resourceInstance = serviceProvider.GetRequiredService<MyResource>();
return await resourceInstance.ExecuteAsync(method, parameters, serviceProvider);
}
}- Register in DI:
// In Core/Extensions/ServiceCollectionExtensions.cs
services.AddSingleton<IEvvaModule, MyModule>();
services.AddScoped<MyResource>();
services.AddScoped<MyService>();- Commands:
evva.{module}.{action}.{subaction} - Namespaces:
EvvaAgent.Modules.{Module}.{Layer} - Dependency Injection: Interface-based design
- Logging: Structured logging with
ILogger<T> - Async/Await: Async-first approach
- Error Handling: Comprehensive exception handling
- Configuration:
IConfigurationfor settings
// Domain entity
public class MyEntity
{
public int Id { get; set; }
public string Name { get; set; }
public DateTime CreatedAt { get; set; }
}
// Repository interface
public interface IMyEntityRepository
{
Task<MyEntity> GetByIdAsync(int id);
Task<IEnumerable<MyEntity>> GetAllAsync();
Task<MyEntity> CreateAsync(MyEntity entity);
Task UpdateAsync(MyEntity entity);
Task DeleteAsync(int id);
}
// Repository implementation
public class MyEntityRepository : IMyEntityRepository
{
private readonly AgentDbContext _context;
public MyEntityRepository(AgentDbContext context)
{
_context = context;
}
// Implementation...
}{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"EvvaAgent": "Debug"
}
},
"ConnectionStrings": {
"DefaultConnection": "Data Source=evva-agent.db"
},
"EvvaCore": {
"HubUrl": "https://evva-core.example.com/hubs/agent",
"AgentId": "agent-001",
"ReconnectInterval": 5000,
"MaxReconnectAttempts": 10
},
"Nginx": {
"ConfigPath": "C:\\nginx\\conf\\nginx.conf",
"ExecutablePath": "C:\\nginx\\nginx.exe",
"SitesAvailablePath": "C:\\nginx\\conf\\sites-available",
"SitesEnabledPath": "C:\\nginx\\conf\\sites-enabled"
},
"Metrics": {
"CollectionInterval": 30000,
"EnableSystemMetrics": true,
"EnableServiceMetrics": true
},
"Deployment": {
"WorkspaceRoot": "C:\\deployments",
"MaxConcurrentDeployments": 3,
"TimeoutMinutes": 30
}
}ASPNETCORE_ENVIRONMENT- Environment (Development/Production)EVVA_CORE_URL- EvvaCore SignalR Hub URLEVVA_AGENT_ID- Unique agent identifierNGINX_PATH- Override Nginx executable pathWORKSPACE_ROOT- Deployment workspace directory
<!-- web.config for IIS -->
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\EvvaAgent.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>- CPU usage percentage
- Memory usage (used/total)
- Disk usage (used/total)
- Network statistics
- Service status
- Command execution times
- Deployment success rates
- Module health status
- SignalR connection status
-
Module Registration Issues
# Check if module is registered # Look for "Registered module: {ModuleName}" in logs
-
Command Execution Failures
# Verify command format evva.{module}.{action}.{subaction} # Check module availability GET /api/modules/available
-
SignalR Connection Issues
# Check EvvaCore URL configuration # Verify network connectivity # Check authentication if required
-
Nginx Configuration Issues
# Test Nginx configuration nginx -t # Check Nginx service status systemctl status nginx # Linux # or check processes on Windows
-
Database Issues
# Check SQLite database file permissions # Verify connection string # Run migrations: dotnet ef database update
# View application logs
tail -f logs/evva-agent-{date}.log
# Filter by component
grep "NginxService" logs/evva-agent-*.log
grep "DeploymentService" logs/evva-agent-*.log
grep "CoreHubService" logs/evva-agent-*.log
# Check for errors
grep "ERROR" logs/evva-agent-*.log# Application health
GET /health
# Module status
GET /api/modules/status
# System metrics
GET /api/metrics/systemdotnet testdotnet test --filter Category=Integration# Test Nginx module
curl -X POST http://localhost:5000/api/test/nginx/status
# Test deployment
curl -X POST http://localhost:5000/api/test/deployment \
-H "Content-Type: application/json" \
-d '{"projectId": 1, "repositoryUrl": "https://github.com/user/repo.git"}'POST /api/service/create- Create new servicePOST /api/service/{name}/start- Start servicePOST /api/service/{name}/stop- Stop serviceDELETE /api/service/{name}- Delete service
GET /api/system/info- System informationGET /api/system/metrics- Current metricsGET /api/modules- Available modules
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Follow coding standards:
- Use async/await patterns
- Implement proper error handling
- Add comprehensive logging
- Write unit tests
- Update documentation
- Submit pull request
- Follow Microsoft C# coding conventions
- Use meaningful variable and method names
- Add XML documentation for public APIs
- Implement proper exception handling
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: Check the
/docsfolder - Issues: Create GitHub issues for bugs
- Discussions: Use GitHub Discussions for questions
Built with ❤️ using .NET 9 and ASP.NET Core