Skip to content

Eggscape3DAR/build-server

Repository files navigation

πŸš€ Eggscape Build Server

Centralized build orchestration server with web UI

Version 1.0.0


πŸ“‹ What Is This?

A web-based build orchestration system for Unity projects. Agents register themselves, and you configure everything from the web UI.

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         WEB BROWSER                             β”‚
β”‚      http://buildserver:5000                    β”‚
β”‚                                                 β”‚
β”‚  Pages:                                        β”‚
β”‚  - Dashboard (view all agents + jobs)          β”‚
β”‚  - Agents (configure agents)                   β”‚
β”‚  - Jobs (create/monitor jobs)                  β”‚
β”‚  - Settings (Git, Unity paths, etc.)           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚ HTTP/SignalR
                  ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      BUILD SERVER (ASP.NET + Blazor)           β”‚
β”‚                                                β”‚
β”‚  - REST API                                    β”‚
β”‚  - SignalR Hub (real-time)                     β”‚
β”‚  - SQLite Database                              β”‚
β”‚  - Web UI (Blazor Server)                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚ HTTP (polling)
                  ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      LOCAL AGENT (Windows Service)             β”‚
β”‚                                                β”‚
β”‚  - Registers with server on startup            β”‚
β”‚  - Polls for jobs every 2 seconds             β”‚
β”‚  - Downloads config from server                β”‚
β”‚  - Launches Unity                              β”‚
β”‚  - Reports progress                            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚ Process
                  ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      UNITY EDITOR + BUILD AGENT                β”‚
β”‚                                                β”‚
β”‚  - Executes builds via Build Wizard            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🎯 Key Features

For Users (Web UI)

βœ… Dashboard - See all agents and jobs at a glance βœ… Agent Management - Register, configure, enable/disable agents βœ… Job Creation - Create builds with web forms βœ… Real-time Progress - Watch builds in real-time (SignalR) βœ… Build History - View past builds and download artifacts βœ… Configuration - All settings via web (no more manual config files!)

For Agents

βœ… Auto-registration - Agent registers itself on startup βœ… Auto-configuration - Downloads config from server βœ… Heartbeat - Reports status every 5 seconds βœ… Job polling - Checks for new jobs every 2 seconds βœ… Progress reporting - Sends updates in real-time


πŸ“¦ Project Structure

build-server/
β”œβ”€β”€ BuildServer/                     # Main ASP.NET + Blazor project
β”‚   β”‚
β”‚   β”œβ”€β”€ Models/                      # Data models
β”‚   β”‚   β”œβ”€β”€ Agent.cs                 # Agent model
β”‚   β”‚   β”œβ”€β”€ Job.cs                   # Job model
β”‚   β”‚   β”œβ”€β”€ Build.cs                 # Build result model
β”‚   β”‚   └── AgentConfiguration.cs    # Agent config model
β”‚   β”‚
β”‚   β”œβ”€β”€ Data/                        # Database
β”‚   β”‚   β”œβ”€β”€ BuildServerContext.cs    # EF Core context
β”‚   β”‚   └── Migrations/              # EF migrations
β”‚   β”‚
β”‚   β”œβ”€β”€ Controllers/                 # REST API
β”‚   β”‚   β”œβ”€β”€ AgentsController.cs      # Agent endpoints
β”‚   β”‚   β”œβ”€β”€ JobsController.cs        # Job endpoints
β”‚   β”‚   └── ConfigController.cs      # Configuration endpoints
β”‚   β”‚
β”‚   β”œβ”€β”€ Hubs/                        # SignalR
β”‚   β”‚   └── BuildHub.cs              # Real-time updates
β”‚   β”‚
β”‚   β”œβ”€β”€ Services/                    # Business logic
β”‚   β”‚   β”œβ”€β”€ AgentService.cs          # Agent management
β”‚   β”‚   β”œβ”€β”€ JobQueueService.cs       # Job scheduling
β”‚   β”‚   └── ConfigService.cs         # Configuration management
β”‚   β”‚
β”‚   β”œβ”€β”€ Pages/                       # Blazor pages (WEB UI)
β”‚   β”‚   β”œβ”€β”€ Index.razor              # Dashboard
β”‚   β”‚   β”œβ”€β”€ Agents.razor             # Agent list + config
β”‚   β”‚   β”œβ”€β”€ Jobs.razor               # Job creation + monitoring
β”‚   β”‚   β”œβ”€β”€ Builds.razor             # Build history
β”‚   β”‚   └── Settings.razor           # Global settings
β”‚   β”‚
β”‚   β”œβ”€β”€ Shared/                      # Shared components
β”‚   β”‚   β”œβ”€β”€ MainLayout.razor         # Layout
β”‚   β”‚   └── NavMenu.razor            # Navigation
β”‚   β”‚
β”‚   β”œβ”€β”€ wwwroot/                     # Static files
β”‚   β”‚   β”œβ”€β”€ css/                     # Styles
β”‚   β”‚   └── js/                      # JavaScript
β”‚   β”‚
β”‚   β”œβ”€β”€ appsettings.json             # Configuration
β”‚   β”œβ”€β”€ Program.cs                   # Entry point
β”‚   └── BuildServer.csproj           # Project file
β”‚
β”œβ”€β”€ .gitignore                       # Git ignore
β”œβ”€β”€ README.md                        # This file
└── LICENSE                          # License

πŸš€ Quick Start

Prerequisites

  • .NET 6 SDK
  • Windows/Linux/Mac (server can run anywhere)

1. Clone & Build

git clone https://github.com/Eggscape3DAR/build-server.git
cd build-server/BuildServer
dotnet restore
dotnet build

2. Run Server

dotnet run

Server starts at: http://localhost:5000

3. Open Web UI

Open browser: http://localhost:5000

You'll see:

  • Dashboard (no agents yet)
  • Agents page (empty)
  • Jobs page (no jobs yet)

4. Install Agent

On build machines:

  1. Download installer from: http://localhost:5000/download/installer
  2. Run installer
  3. Enter server URL: http://localhost:5000
  4. Agent auto-registers and appears in web UI!

5. Configure Agent (from Web UI!)

  1. Go to Agents page
  2. Click on your agent
  3. Configure:
    • Unity project path
    • Git credentials
    • Repository URL
    • Workspace path
    • Artifacts path
  4. Click Save

Agent downloads config automatically!

6. Create Job (from Web UI!)

  1. Go to Jobs page
  2. Click New Job
  3. Fill form:
    • Profile (Android Dev APK, etc.)
    • Platform
    • Channel
    • Branch
  4. Click Create

Job assigned to available agent automatically!

7. Watch Progress (Real-time!)

  • Dashboard shows live progress
  • SignalR updates every second
  • See build status, progress bar, current step

πŸ› οΈ API Endpoints

Agent Endpoints

POST /api/agents/register
POST /api/agents/heartbeat
GET  /api/agents
GET  /api/agents/{id}
PUT  /api/agents/{id}
DELETE /api/agents/{id}

Job Endpoints

POST /api/jobs
GET  /api/jobs
GET  /api/jobs/{id}
GET  /api/jobs/queue          # Get next job for agent
POST /api/jobs/{id}/progress  # Update progress
POST /api/jobs/{id}/complete  # Mark complete
POST /api/jobs/{id}/fail      # Mark failed

Config Endpoints

GET  /api/config/{agentId}     # Get agent config
POST /api/config/{agentId}     # Update agent config

Build Endpoints

GET  /api/builds
GET  /api/builds/{id}
GET  /api/builds/{id}/download # Download artifacts

πŸ“Š Database Schema

Agents Table

CREATE TABLE Agents (
    Id INTEGER PRIMARY KEY,
    AgentId TEXT UNIQUE NOT NULL,
    Name TEXT NOT NULL,
    MachineName TEXT,
    IpAddress TEXT,
    IsOnline BOOLEAN DEFAULT 0,
    IsAvailable BOOLEAN DEFAULT 1,
    LastHeartbeat DATETIME,
    CurrentJobId TEXT,
    CreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP
);

Jobs Table

CREATE TABLE Jobs (
    Id INTEGER PRIMARY KEY,
    JobId TEXT UNIQUE NOT NULL,
    Name TEXT NOT NULL,
    ProfileName TEXT NOT NULL,
    Platform TEXT NOT NULL,
    Channel TEXT NOT NULL,
    Status TEXT NOT NULL,  -- Queued, Running, Completed, Failed
    Progress REAL DEFAULT 0,
    AssignedAgentId TEXT,
    CreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
    StartedAt DATETIME,
    CompletedAt DATETIME,
    ErrorMessage TEXT
);

AgentConfigurations Table

CREATE TABLE AgentConfigurations (
    Id INTEGER PRIMARY KEY,
    AgentId TEXT UNIQUE NOT NULL,
    UnityProjectPath TEXT,
    GitUsername TEXT,
    GitToken TEXT,  -- Encrypted!
    RepositoryUrl TEXT,
    WorkspacePath TEXT,
    ArtifactsPath TEXT,
    UpdatedAt DATETIME DEFAULT CURRENT_TIMESTAMP
);

Builds Table

CREATE TABLE Builds (
    Id INTEGER PRIMARY KEY,
    JobId INTEGER NOT NULL,
    BuildPath TEXT NOT NULL,
    SizeBytes INTEGER,
    Duration INTEGER,  -- seconds
    CreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (JobId) REFERENCES Jobs(Id)
);

πŸ”§ Configuration

appsettings.json

{
  "ConnectionStrings": {
    "DefaultConnection": "Data Source=buildserver.db"
  },
  "BuildServer": {
    "MaxJobQueueSize": 100,
    "AgentTimeoutSeconds": 30,
    "JobTimeoutMinutes": 120,
    "ArtifactsRetentionDays": 30
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*"
}

🌐 Web Pages (Blazor)

Dashboard (Index.razor)

Shows:

  • Total agents (online/offline)
  • Total jobs (queued/running/completed)
  • Recent builds
  • Live activity feed (SignalR)

Agents (Agents.razor)

  • List of all agents
  • Status indicators (online/offline/busy)
  • Configure button β†’ opens config form
  • Enable/Disable toggle
  • Delete button

Jobs (Jobs.razor)

  • Create new job button β†’ opens form
  • Job queue (pending jobs)
  • Running jobs with live progress
  • Recent jobs

Builds (Builds.razor)

  • Build history with filters
  • Download artifacts button
  • View logs button
  • Build details

Settings (Settings.razor)

  • Global settings:
    • Default Unity version
    • Default workspace path
    • Git credentials (global)
    • Build retention policy
    • Notification settings

πŸ” Security

Agent Authentication

  • Each agent gets unique AgentId on first registration
  • Stored in agent's local config
  • Required for all API calls

Git Credentials

  • Stored encrypted in database
  • Never sent to client (web UI)
  • Only sent to agent when needed

Future: JWT Authentication

  • Add user accounts
  • Login system
  • Role-based access (Admin/Builder/Viewer)

πŸ“ˆ Real-time Updates (SignalR)

Events

From Server to Clients:

// Agent status changed
"AgentUpdated" -> { agentId, isOnline, isAvailable }

// Job progress
"JobProgressUpdated" -> { jobId, progress, currentStep }

// Job completed
"JobCompleted" -> { jobId, success, buildPath }

// New job created
"JobCreated" -> { jobId, name }

From Clients to Server:

// Join specific job updates
"JoinJobGroup" -> { jobId }

// Leave job updates
"LeaveJobGroup" -> { jobId }

Client Usage (JavaScript)

const connection = new signalR.HubConnectionBuilder()
    .withUrl("/hubs/build")
    .build();

connection.on("JobProgressUpdated", (data) => {
    console.log(`Job ${data.jobId}: ${data.progress * 100}%`);
    updateProgressBar(data.jobId, data.progress);
});

await connection.start();

πŸš€ Deployment

Development

dotnet run

Production (Linux)

# 1. Publish
dotnet publish -c Release -o /var/www/buildserver

# 2. Create systemd service
sudo nano /etc/systemd/system/buildserver.service
[Unit]
Description=Eggscape Build Server
After=network.target

[Service]
Type=notify
WorkingDirectory=/var/www/buildserver
ExecStart=/usr/bin/dotnet /var/www/buildserver/BuildServer.dll
Restart=always
RestartSec=10
SyslogIdentifier=buildserver
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false

[Install]
WantedBy=multi-user.target
# 3. Enable and start
sudo systemctl enable buildserver
sudo systemctl start buildserver

Production (Windows)

# 1. Publish
dotnet publish -c Release -o C:\BuildServer

# 2. Install as Windows Service
sc create BuildServer binPath="C:\BuildServer\BuildServer.exe"
sc start BuildServer

πŸ“ TODO / Roadmap

MVP (Current)

  • Project structure
  • Models and database
  • REST API controllers
  • Blazor web pages
  • SignalR hub
  • Agent registration
  • Job queueing
  • Real-time updates

V1.1

  • User authentication (JWT)
  • File upload (for keystores, etc.)
  • Artifact storage and download
  • Email notifications
  • Slack/Discord webhooks

V1.2

  • Build statistics and analytics
  • Agent scheduling (cron jobs)
  • Build templates
  • Multi-branch builds
  • Pull request builds

V2.0

  • Docker support
  • Kubernetes deployment
  • Cloud storage (S3/Azure/GCS)
  • Advanced metrics
  • Custom plugins

🀝 Contributing

  1. Fork the repo
  2. Create feature branch
  3. Commit changes
  4. Push and create PR

πŸ“ž Support

  • Documentation: This README
  • Issues: GitHub Issues
  • Discussions: GitHub Discussions

πŸ“„ License

MIT License - See LICENSE file


Created: October 2025 Version: 1.0.0 Project: Eggscape Build Server Team: Eggscape + Claude


Next: Complete implementation following IMPLEMENTATION_GUIDE.md

About

Centralized build orchestration server for Eggscape Unity builds

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors