diff --git a/README.md b/README.md new file mode 100644 index 0000000..b6920b5 --- /dev/null +++ b/README.md @@ -0,0 +1,171 @@ +# Unified Dashboard Suite (Go Edition) + +A high-performance, unified developer & QA dashboard suite engineered in Go. Orchestrates micro-services, visual AI processing pipelines, automated testing tools, and project management into a single cohesive interface powered by `nexus-gateway`. + +--- + +## ⚡ Architectural Overview + +The suite runs on a lightweight Go reverse-proxy and process manager (`nexus-gateway`) on port `10000`. The gateway dynamically monitors, manages, and routes traffic to all individual tool micro-services: + +| Service | Port | Description | +| :--- | :--- | :--- | +| **Nexus Gateway** | `10000` | Main entry point & unified tool dashboard | +| **Image Manipulator Pro** | `5001` | High-throughput image resizing, cropping, rotation, batch filters | +| **JSON Suite** | `5002` | Interactive JSON schema manipulation, validation, and testing | +| **PNG Frame Detector** | `5003` | Computer vision boundary detection for multi-frame PNG sprite sheets | +| **JSON Image Downloader** | `5004` | Asynchronous multi-threaded image asset downloader from JSON datasets | +| **Image Merger** | `5005` | Canvas stitching and multi-layer asset merging | +| **Bulk API Tester** | `5006` | Advanced bulk API testing with Black Obsidian Liquid Glass UI, batch runs, and real-time doc import | +| **Facial Rotation Detector** | `5007` | MediaPipe + ONNX AI angle and pose orientation detector | +| **Host It Now** | `5008` | Instant local image hosting with public tunnel and clip management | +| **AI Caricature JSONMaker** | `5009` | AI coordinate mapping and caricature dataset generation | +| **PSD Reader** | `5010` | Layer extraction and asset parsing from Adobe Photoshop PSDs | +| **Khira Dev Ticketing** | *Integrated* | Cross-team issue tracking, hold/resume workflows, and PostgreSQL dual-DB sync | + +--- + +## 📋 Prerequisites + +Ensure the following tools are installed on your Linux environment: + +1. **Go**: Version `1.21` or higher (`go version`) +2. **Fish Shell**: For running the automatic process recovery script (`fish`) +3. **Make & GCC**: Standard compilation build essentials +4. **PostgreSQL**: Required for Khira Dev Ticketing storage +5. **Python 3.10+ & Virtual Environment**: For AI and Computer Vision worker scripts (e.g. OpenCV, MediaPipe, ONNXRuntime) + +--- + +## 🚀 Setup & Installation + +### 1. Clone & Navigate to Repository + +```bash +git clone https://github.com/vaishnosingh/Unified_Dashboard_Suite_Go.git +cd Unified_Dashboard_Suite_Go +``` + +### 2. Go Dependencies + +Download all required Go modules: + +```bash +go mod download +``` + +### 3. PostgreSQL Database Setup (for Khira Ticketing) + +Khira uses a resilient dual-database architecture (`khira_primary` and `khira_backup`). Create the databases in your local PostgreSQL instance: + +```bash +# Switch to postgres user and create databases +sudo -u postgres psql -c "CREATE DATABASE khira_primary;" +sudo -u postgres psql -c "CREATE DATABASE khira_backup;" +``` + +Default connection strings (configured via environment variables or defaults in `internal/khira/store.go`): +- `KHIRA_PRIMARY_DB_URL`: `postgres://postgres@127.0.0.1:5432/khira_primary?sslmode=disable` +- `KHIRA_BACKUP_DB_URL`: `postgres://postgres@127.0.0.1:5432/khira_backup?sslmode=disable` + +### 4. Python Virtual Environment Setup + +For Python-based tools (Facial Rotation Detector, PNG Frame Detector): + +```bash +# Activate your local Python venv (in Fish shell) +source /home/creserver/extras/local_venv/bin/activate.fish + +# Ensure required libraries are installed +pip install opencv-python numpy mediapipe onnxruntime pillow flask +``` + +### 5. Build All Go Binaries + +Compile all micro-services and the gateway into the `./bin/` directory: + +```bash +make build-go +``` + +This compiles: +- `bin/nexus-gateway` +- `bin/bulk-api-tester` +- `bin/image-manipulator` +- `bin/image-hoster` +- `bin/image-merger` +- `bin/json-suite` +- `bin/json-image-downloader` +- `bin/png-frame-detector` +- `bin/facial-rotation-detector` + +--- + +## 🔄 Running the Suite (Restart Script) + +The recommended way to launch or restart the suite is using the included [`launch_dashboard_go.fish`](file:///home/creserver/Desktop/Vaishno_workspace/Unified_Dashboard_Suite_Go/launch_dashboard_go.fish) script. + +### What the Script Does: +1. **Zero Port Conflicts**: Automatically checks and kills any lingering or orphaned processes on ports `10000`, `5001`, `5002`, `5003`, `5004`, `5005`, `5006`, `5007`, `5008`, `5009`, `5010` using `lsof`/`fuser`. +2. **Directory Resolution**: Dynamically locates the repository root. +3. **Gateway Orchestration**: Starts `nexus-gateway` on port `10000`, which automatically reads `configs/tools.yaml` and launches all child services. + +### How to Run: + +```fish +# Using Fish shell: +./launch_dashboard_go.fish +``` + +Or from outside the repository: + +```fish +fish /home/creserver/launch_dashboard_go.fish +``` + +Once running, access the unified dashboard in your browser: +👉 **[http://localhost:10000](http://localhost:10000)** + +--- + +## 🛠 Manual Execution Options + +### Launch via Makefile: + +```bash +make run +``` + +### Run an Individual Micro-Service Directly: + +If you only need to work on a specific tool (e.g. Bulk API Tester): + +```bash +# Start Bulk API Tester standalone on port 5006: +./bin/bulk-api-tester +``` +Then visit **[http://localhost:5006](http://localhost:5006)**. + +--- + +## ⚙️ Configuration Files + +- [`configs/tools.yaml`](file:///home/creserver/Desktop/Vaishno_workspace/Unified_Dashboard_Suite_Go/configs/tools.yaml): Defines all tool definitions, port numbers, launch commands, working directories, and log destinations. +- [`launch_dashboard_go.fish`](file:///home/creserver/Desktop/Vaishno_workspace/Unified_Dashboard_Suite_Go/launch_dashboard_go.fish): Process killer and gateway launcher script. +- [`data/bulk-api-tester/spaces.json`](file:///home/creserver/Desktop/Vaishno_workspace/Unified_Dashboard_Suite_Go/data/bulk-api-tester/spaces.json): Workspace collections, tabs, and bulk tester requests. +- [`data/bulk-api-tester/docs_apis.json`](file:///home/creserver/Desktop/Vaishno_workspace/Unified_Dashboard_Suite_Go/data/bulk-api-tester/docs_apis.json): Interactive API catalog for instant import. + +--- + +## 🔍 Troubleshooting & Logs + +- **Service Logs**: All output from individual tools is logged in the `logs/` directory: + ```bash + tail -f logs/nexus-gateway.log + tail -f logs/bulk-api-tester.log + ``` +- **Stuck Ports**: If a port remains occupied, run: + ```fish + ./launch_dashboard_go.fish + ``` + The script automatically cleans up any zombie PIDs bound to the suite's port range. diff --git a/launch_dashboard_go.fish b/launch_dashboard_go.fish new file mode 100755 index 0000000..07f9004 --- /dev/null +++ b/launch_dashboard_go.fish @@ -0,0 +1,36 @@ +#!/usr/bin/env fish + +# --- Configuration --- +# Automatically resolve repository directory if executed from within the repo +set -l SCRIPT_DIR (cd (dirname (status filename)); and pwd) +if test -f "$SCRIPT_DIR/configs/tools.yaml" + set -q GO_SUITE_PATH; or set GO_SUITE_PATH "$SCRIPT_DIR" +else + set -q GO_SUITE_PATH; or set GO_SUITE_PATH "/home/creserver/Desktop/Vaishno_workspace/Unified_Dashboard_Suite_Go" +end + +set GATEWAY_BIN "$GO_SUITE_PATH/bin/nexus-gateway" +set GATEWAY_PORT 10000 +set PORTS_TO_CHECK $GATEWAY_PORT 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 + +function kill_ports + for PORT in $argv + if type -q lsof + set PID (lsof -t -i:$PORT) + if test -n "$PID" + kill -9 $PID + end + else if type -q fuser + fuser -k -n tcp $PORT > /dev/null 2>&1 + end + end +end + +# Kill old processes +kill_ports $PORTS_TO_CHECK + +cd $GO_SUITE_PATH + +# Launch Go Gateway +set -x PORT $GATEWAY_PORT +exec $GATEWAY_BIN