Skip to content

Commit 5e726d7

Browse files
committed
feat: add back dashboard
1 parent bf9a7e4 commit 5e726d7

26 files changed

Lines changed: 2462 additions & 642 deletions

File tree

Makefile

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ up: clean-volumes
3737
@echo "✅ Services started!"
3838
@echo ""
3939
@echo "Available services:"
40-
@echo " - Frontend: http://localhost:3000"
41-
@echo " - API: http://localhost:8000"
40+
@echo " - Dashboard: http://localhost:8000"
4241
@echo " - API Docs: http://localhost:8000/docs"
4342
@echo " - Postgres: localhost:5432"
4443
@echo " - Kafka: localhost:9092"
@@ -66,8 +65,7 @@ up-debug: clean-volumes
6665
@echo " Kafka publishing is DISABLED for sim-worker"
6766
@echo ""
6867
@echo "Available services:"
69-
@echo " - Frontend: http://localhost:3000"
70-
@echo " - API: http://localhost:8000"
68+
@echo " - Dashboard: http://localhost:8000"
7169
@echo " - Postgres: localhost:5432"
7270
@echo " - Kafka: localhost:9092"
7371
@echo ""
@@ -216,13 +214,9 @@ clean-env:
216214
logs:
217215
CONFIG_PATH=$(config) docker compose logs -f
218216

219-
## logs-api: Tail logs for API service only
220-
logs-api:
221-
CONFIG_PATH=$(config) docker compose logs -f opendt-api
222-
223-
## logs-frontend: Tail logs for frontend service only
224-
logs-frontend:
225-
CONFIG_PATH=$(config) docker compose logs -f frontend
217+
## logs-dashboard: Tail logs for dashboard service only
218+
logs-dashboard:
219+
CONFIG_PATH=$(config) docker compose logs -f dashboard
226220

227221
## logs-kafka: Tail logs for Kafka service only
228222
logs-kafka:
@@ -240,13 +234,9 @@ logs-sim-worker:
240234
ps:
241235
CONFIG_PATH=$(config) docker compose ps
242236

243-
## shell-api: Open a shell in the API container
244-
shell-api:
245-
CONFIG_PATH=$(config) docker compose exec opendt-api /bin/bash
246-
247-
## shell-frontend: Open a shell in the frontend container
248-
shell-frontend:
249-
CONFIG_PATH=$(config) docker compose exec frontend /bin/sh
237+
## shell-dashboard: Open a shell in the dashboard container
238+
shell-dashboard:
239+
CONFIG_PATH=$(config) docker compose exec dashboard /bin/bash
250240

251241
## shell-postgres: Open psql in the Postgres container
252242
shell-postgres:

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ make setup
2828
make up
2929

3030
# 4. Access services
31-
open http://localhost:8000/docs # API documentation
31+
open http://localhost:8000 # Dashboard
3232
```
3333

3434
That's it! The system is now running with the SURF workload dataset.
@@ -57,7 +57,7 @@ ls output/baseline/run_1/
5757

5858
- **[dc-mock](services/dc-mock/README.md)** - Data producer (workload replay)
5959
- **[sim-worker](services/sim-worker/README.md)** - Simulation engine (OpenDC integration)
60-
- **[opendt-api](services/opendt-api/README.md)** - REST API gateway
60+
- **[dashboard](services/dashboard/README.md)** - Web dashboard and REST API
6161
- **[kafka-init](services/kafka-init/README.md)** - Kafka infrastructure setup
6262

6363
## Architecture
@@ -78,11 +78,11 @@ ls output/baseline/run_1/
7878
┌─────────┴─────────────┐
7979
│ │
8080
┌────────▼──────┐ ┌──────────▼───────┐
81-
│ sim-worker │ │ opendt-api
81+
│ sim-worker │ │ dashboard
8282
│ (Consumer) │ │ (FastAPI) │
8383
│ │ │ │
84-
│ • Windows │ │ • REST API
85-
│ • OpenDC │ │ • WebSockets
84+
│ • Windows │ │ • Web UI
85+
│ • OpenDC │ │ • REST API
8686
│ • Caching │◀────│ • Topology Mgmt │
8787
│ • Experiments │ │ │
8888
└───────┬───────┘ └─────────┬────────┘
@@ -129,7 +129,7 @@ See [Architecture Overview](docs/ARCHITECTURE.md) for detailed explanation.
129129
|---------|-------------|
130130
| `make setup` | Setup virtual environment |
131131
| `make test` | Run all tests |
132-
| `make shell-api` | Open shell in API container |
132+
| `make shell-dashboard` | Open shell in dashboard container |
133133
| `make kafka-topics` | List Kafka topics |
134134

135135
### Monitoring Commands
@@ -138,7 +138,7 @@ See [Architecture Overview](docs/ARCHITECTURE.md) for detailed explanation.
138138
|---------|-------------|
139139
| `make logs-dc-mock` | View dc-mock logs |
140140
| `make logs-sim-worker` | View sim-worker logs |
141-
| `make logs-api` | View API logs |
141+
| `make logs-dashboard` | View dashboard logs |
142142

143143
Run `make help` to see all available commands.
144144

@@ -182,8 +182,7 @@ See [Configuration Guide](docs/CONFIGURATION.md) for advanced options.
182182

183183
- **dc-mock**: Replays historical workload/power data to Kafka
184184
- **sim-worker**: Consumes streams, invokes OpenDC simulator
185-
- **opendt-api**: REST API for system control and topology updates
186-
- **frontend**: Dashboard for visualization (planned)
185+
- **dashboard**: Web dashboard with REST API for system control and visualization
187186

188187
### Infrastructure
189188

docker-compose.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ services:
153153
- opendt-network
154154
command: python -m sim_worker.main
155155

156-
opendt-api:
156+
dashboard:
157157
build:
158158
context: .
159-
dockerfile: services/opendt-api/Dockerfile
160-
container_name: opendt-api
159+
dockerfile: services/dashboard/Dockerfile
160+
container_name: opendt-dashboard
161161
environment:
162162
DATABASE_URL: postgresql://opendt:opendt_dev_password@postgres:5432/opendt
163163
KAFKA_BOOTSTRAP_SERVERS: kafka:29092
@@ -167,7 +167,7 @@ services:
167167
- "8000:8000"
168168
volumes:
169169
# Mount source code for hot reload
170-
- ./services/opendt-api:/app/services/opendt-api
170+
- ./services/dashboard:/app/services/dashboard
171171
- ./libs/common:/app/libs/common
172172
# Mount configuration file
173173
- ${CONFIG_PATH:-./config/default.yaml}:/app/config/simulation.yaml:ro
@@ -178,7 +178,7 @@ services:
178178
condition: service_healthy
179179
networks:
180180
- opendt-network
181-
command: uvicorn opendt_api.main:app --host 0.0.0.0 --port 8000 --reload
181+
command: uvicorn dashboard.main:app --host 0.0.0.0 --port 8000 --reload
182182

183183
# ============================================================================
184184
# FRONTEND
@@ -201,7 +201,7 @@ services:
201201
# - /app/node_modules
202202
# - /app/.next
203203
# depends_on:
204-
# - opendt-api
204+
# - dashboard
205205
# networks:
206206
# - opendt-network
207207
# command: npm run dev

docs/ARCHITECTURE.md

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ Welcome to the OpenDT documentation! This document provides a comprehensive over
5454
┌─────────┴─────────────┐
5555
│ │
5656
┌────────▼──────┐ ┌─────────▼────────┐
57-
│ sim-worker │ │ opendt-api
57+
│ sim-worker │ │ dashboard
5858
│ (Consumer) │ │ (FastAPI) │
5959
│ │ │ │
60-
│ • Windows │ │ • REST API
61-
│ • OpenDC │ │ • WebSockets
60+
│ • Windows │ │ • Web UI
61+
│ • OpenDC │ │ • REST API
6262
│ • Caching │◀────│ • Topology Mgmt │
6363
│ • Experiments │ │ │
6464
└───────┬───────┘ └─────────┬────────┘
@@ -125,20 +125,22 @@ OpenDT consists of 5 microservices orchestrated via Docker Compose:
125125

126126
---
127127

128-
### 3. opendt-api (API Gateway)
128+
### 3. dashboard (Web Dashboard)
129129

130-
**Purpose**: REST API and WebSocket gateway for frontend and external integrations
130+
**Purpose**: Web dashboard and REST API for system control and visualization
131131

132-
**Location**: [`../services/opendt-api/`](../services/opendt-api/README.md)
132+
**Location**: [`../services/dashboard/`](../services/dashboard/README.md)
133133

134134
**Key Features**:
135+
- Web UI for real-time visualization
135136
- FastAPI with automatic OpenAPI documentation
136137
- Topology management endpoint (`PUT /api/topology`)
137138
- Health check and status endpoints
138139
- Kafka producer for configuration updates
140+
- Static file serving for dashboard assets
139141

140-
**Endpoints**:
141-
- `GET /` - Service information
142+
**Routes**:
143+
- `GET /` - Web dashboard UI
142144
- `GET /health` - Health check (Kafka + config status)
143145
- `GET /docs` - Interactive Swagger UI
144146
- `PUT /api/topology` - Update simulated datacenter topology
@@ -159,20 +161,6 @@ OpenDT consists of 5 microservices orchestrated via Docker Compose:
159161

160162
---
161163

162-
### 5. frontend (Dashboard - Planned)
163-
164-
**Purpose**: Next.js dashboard for visualization and control
165-
166-
**Status**: Planned/In Development
167-
168-
**Planned Features**:
169-
- Real-time power consumption graphs (actual vs. predicted)
170-
- Topology editor for What-If scenarios
171-
- Experiment management interface
172-
- Simulation control (pause/resume/speed)
173-
174-
---
175-
176164
## Data Flow
177165

178166
### 1. Data Ingestion
@@ -207,7 +195,7 @@ sim.topology ─┘
207195
### 4. Topology Management
208196

209197
```
210-
User/API ──> PUT /api/topology ──> sim.topology (Kafka) ──> sim-worker
198+
User/Dashboard ──> PUT /api/topology ──> sim.topology (Kafka) ──> sim-worker
211199
212200
├──> Update simulated topology
213201
├──> Clear result cache
@@ -244,7 +232,7 @@ User/API ──> PUT /api/topology ──> sim.topology (Kafka) ──> sim-work
244232
### Service Documentation
245233
- [dc-mock README](../services/dc-mock/README.md) - Datacenter mock producer
246234
- [sim-worker README](../services/sim-worker/README.md) - Simulation engine
247-
- [opendt-api README](../services/opendt-api/README.md) - API gateway
235+
- [dashboard README](../services/dashboard/README.md) - Web dashboard and API
248236
- [kafka-init README](../services/kafka-init/README.md) - Kafka initialization
249237

250238
### Concept Documentation

docs/DATA_MODELS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ send_message(
493493
## Related Documentation
494494

495495
- [Architecture Overview](./ARCHITECTURE.md) - System design and data flow
496-
- [API Documentation](../services/opendt-api/README.md) - REST API using these models
496+
- [Dashboard Documentation](../services/dashboard/README.md) - Web UI and REST API using these models
497497
- [Simulation Worker](../services/sim-worker/README.md) - How models are used in simulation
498498

499499
---

frontend/Dockerfile

Lines changed: 0 additions & 91 deletions
This file was deleted.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ dependencies = [
1717
"pydantic>=2.0.0",
1818
"pydantic-settings>=2.0.0",
1919

20-
# Web framework (for API service)
20+
# Web framework (for dashboard service)
2121
"fastapi>=0.104.0",
2222
"uvicorn[standard]>=0.24.0",
23+
"jinja2>=3.1.0",
2324

2425
# Database (for services that need it)
2526
"psycopg2-binary>=2.9.0",
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ COPY libs/common /app/libs/common
1717
RUN pip install --no-cache-dir -e /app/libs/common
1818

1919
# Copy service code
20-
COPY services/opendt-api /app/services/opendt-api
20+
COPY services/dashboard /app/services/dashboard
2121

2222
# Create non-root user for security
2323
RUN useradd -m -u 1000 opendt && \
@@ -26,9 +26,9 @@ RUN useradd -m -u 1000 opendt && \
2626
USER opendt
2727

2828
# Set working directory to service for proper module resolution
29-
WORKDIR /app/services/opendt-api
29+
WORKDIR /app/services/dashboard
3030

3131
# Expose the API port
3232
EXPOSE 8000
3333

34-
CMD ["uvicorn", "opendt_api.main:app", "--host", "0.0.0.0", "--port", "8000"]
34+
CMD ["uvicorn", "dashboard.main:app", "--host", "0.0.0.0", "--port", "8000"]

0 commit comments

Comments
 (0)