feat: initial architecture setup with Docker, SQLite persistence and PDF tracking
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
Markdown
|
||||
# Software Requirements Specification (SRS) - v2.0
|
||||
## Project Name: NetBackup Log Insights & Action Tracker (Docker & Gitea Edition)
|
||||
## Target Environment: Docker Container for VPS Deployment
|
||||
## IDE Target: Antigravity IDE
|
||||
|
||||
---
|
||||
|
||||
## 1. Executive Summary & New Objectives
|
||||
The objective is to build a modern, containerized backup management dashboard using Python, Streamlit, and SQLite. The system processes NetBackup "Job Summary" CSV exports, segregates infrastructure cloud zones, cross-references transient errors with automatic successes, tracks manual operational actions, and exports standardized PDF mitigation reports.
|
||||
|
||||
---
|
||||
|
||||
## 2. Infrastructure & Portability Guardrails (Docker Shift)
|
||||
|
||||
### 2.1 Containerization Deployment
|
||||
* **Base Image:** `python:3.11-slim` (to keep the cloud footprint minimal).
|
||||
* **Port Configuration:** Expose port `8501` internally, mapped via Docker Compose.
|
||||
* **Volume Mapping:** Data persistence must be maintained by mapping a host directory to the container’s internal storage path (`/app/data`).
|
||||
|
||||
### 2.2 Advanced Database Architecture & Persistence
|
||||
* **Database File:** `/app/data/nbu_insights.db` (Mapped volume).
|
||||
* **Historical Traceability:** Data uploaded via CSV must be completely persisted. If a new CSV is processed, the system must perform an `UPSERT` operation based on the unique key `(Job Id, Client, Policy)` to preserve historical runs and ensure that previously typed mitigation actions are never overwritten.
|
||||
|
||||
```sql
|
||||
CREATE TABLE IF NOT EXISTS processed_files (
|
||||
file_hash TEXT PRIMARY KEY,
|
||||
file_name TEXT,
|
||||
upload_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS backup_jobs (
|
||||
job_id INTEGER PRIMARY KEY,
|
||||
client TEXT,
|
||||
policy TEXT,
|
||||
type TEXT,
|
||||
exit_code INTEGER,
|
||||
start_time TIMESTAMP,
|
||||
finish_time TIMESTAMP,
|
||||
duration_secs INTEGER,
|
||||
mbytes REAL,
|
||||
files_count INTEGER,
|
||||
primary_server TEXT,
|
||||
media_server TEXT,
|
||||
is_rerun_success INTEGER DEFAULT 0
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS job_actions (
|
||||
job_id INTEGER PRIMARY KEY,
|
||||
action_taken TEXT,
|
||||
status TEXT DEFAULT 'Pendente', -- Enum: 'Pendente', 'Em Progresso', 'Resolvido'
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY(job_id) REFERENCES backup_jobs(job_id)
|
||||
);
|
||||
3. UI/UX Design & Branding Strategy (CXP-Inspired Dark Tech)
|
||||
Primary Background: #0B0F19 (Deep Midnight Blue)
|
||||
|
||||
Card / Container Background: #1E2640 (Slate Corporate Blue)
|
||||
|
||||
Primary Accent: #00D2FF (Vibrant Cyan)
|
||||
|
||||
Typography Hierarchy: Clean, highly visible tech elements with colored status badges (#00C853 for active success, #FF4B4B for unmitigated failure).
|
||||
|
||||
4. Full Functional Requirements & Data Insights Engine
|
||||
4.1 Ingestion & Cleansing Pipeline
|
||||
CSV Offset: Dynamically strip metadata row 0 (###################### TABLE...).
|
||||
|
||||
Metric Extraction: Auto-calculate MSDP Deduplication Ratio and Savings. Show globally and separate per Primary Server.
|
||||
|
||||
4.2 Multi-Cloud Tenant Views (Sidebar Selector)
|
||||
Consolidated View: Combined global metrics.
|
||||
|
||||
Azure Infrastructure Zone: Filters data where Primary Server == 'srvpalcvnbu01.elo.corp'.
|
||||
|
||||
OCI Infrastructure Zone: Filters data where Primary Server == 'srvpalcocinbupri01.elo.corp'.
|
||||
|
||||
4.3 Advanced Rerun & Target Resolution Analytics
|
||||
Automated Clearing: If a job fails (Exit Code > 1) but the same Client and Policy have a subsequent successful job (Exit Code 0 or 1) inside the logs, flag it automatically as [✓ Reexecutado com Sucesso].
|
||||
|
||||
State Filtering: Create a dedicated filter to view:
|
||||
|
||||
Todos os Erros
|
||||
|
||||
Erros Sem Tratativa / Pendentes
|
||||
|
||||
Erros Corrigidos Automatizados (Reexecutados)
|
||||
|
||||
4.4 Action Register & PDF Mitigation Report Engine
|
||||
Form Action: Input text fields for engineers to log infrastructure actions (e.g., "Adjusted firewall rules on port 1556", "Expanded snapshot window").
|
||||
|
||||
PDF Generation Engine: Integrating the fpdf2 or reportlab library. Clicking "Exportar Plano de Mitigação PDF" triggers a compiled file containing a professional summary header, performance graphs metrics, and a clean table of all logged actions and resolutions.
|
||||
|
||||
5. Repository File Layout
|
||||
Plaintext
|
||||
netbackup-insights/
|
||||
│
|
||||
├── app.py # Main UI Orchestrator
|
||||
├── database.py # SQLite Connection & Upsert Engine
|
||||
├── parser.py # Pandas Data Cleansing and Ratio Math
|
||||
├── report_gen.py # PDF Layout Compilation Engine
|
||||
├── requirements.txt # Python Dependencies
|
||||
├── Dockerfile # App Container Specification
|
||||
└── docker-compose.yml # Multi-environment VPS deployment spec
|
||||
Reference in New Issue
Block a user