Implement a scalable system for automatic documentation generation from infrastructure systems, preventing LLM context overload through template-driven sectioning. **New Features:** 1. **YAML Template System** (`templates/documentation/proxmox.yaml`) - Define documentation sections independently - Specify data requirements per section - Configure prompts, generation settings, and scheduling - Prevents LLM context overflow by sectioning data 2. **Template-Based Generator** (`src/datacenter_docs/generators/template_generator.py`) - Load and parse YAML templates - Generate documentation sections independently - Extract only required data for each section - Save sections individually to files and database - Combine sections with table of contents 3. **Celery Tasks** (`src/datacenter_docs/workers/documentation_tasks.py`) - `collect_and_generate_docs`: Collect data and generate docs - `generate_proxmox_docs`: Scheduled Proxmox documentation (daily at 2 AM) - `generate_all_docs`: Generate docs for all systems in parallel - `index_generated_docs`: Index generated docs into vector store for RAG - `full_docs_pipeline`: Complete workflow (collect → generate → index) 4. **Scheduled Jobs** (updated `celery_app.py`) - Daily Proxmox documentation generation - Every 6 hours: all systems documentation - Weekly: full pipeline with indexing - Proper task routing and rate limiting 5. **Test Script** (`scripts/test_proxmox_docs.py`) - End-to-end testing of documentation generation - Mock data collection from Proxmox - Template-based generation - File and database storage 6. **Configuration Updates** (`src/datacenter_docs/utils/config.py`) - Add port configuration fields for Docker services - Add MongoDB and Redis credentials - Support all required environment variables **Proxmox Documentation Sections:** - Infrastructure Overview (cluster, nodes, stats) - Virtual Machines Inventory - LXC Containers Inventory - Storage Configuration - Network Configuration - Maintenance Procedures **Benefits:** - Scalable to multiple infrastructure systems - Prevents LLM context window overflow - Independent section generation - Scheduled automatic updates - Vector store integration for RAG chat - Template-driven approach for consistency 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Scripts Directory
This directory contains utility scripts for the Datacenter Documentation project.
🔍 test-ci-pipeline.sh
Local CI/CD Pipeline Validation Script
Description
Simulates the complete GitLab CI/CD pipeline locally before pushing code to the repository. This script runs all the same checks that would run in GitHub Actions, GitLab CI, or Gitea Actions.
Usage
# Run from project root
bash scripts/test-ci-pipeline.sh
# Or make it executable and run directly
chmod +x scripts/test-ci-pipeline.sh
./scripts/test-ci-pipeline.sh
Pipeline Stages
The script executes the following stages in order:
1. LINT Stage
- Black: Code formatting check
- Ruff: Linting and code quality
- MyPy: Type checking (strict mode)
2. TEST Stage
- Unit Tests: Runs pytest with coverage
- Security Scan: Bandit (if installed)
3. BUILD Stage
- Poetry Check: Validates
pyproject.tomlconfiguration - Dependency Resolution: Tests if all dependencies can be installed
- Docker Validation: Checks Dockerfile syntax
4. INTEGRATION Stage (Optional)
- API Health Check: Tests if local API is running
Output
The script provides:
- ✅ Color-coded output for easy readability
- 📊 Real-time progress for each job
- 📄 Summary report at the end
- 📝 Written report saved to
ci-pipeline-report-TIMESTAMP.txt
Example Output
╔═══════════════════════════════════════════════════════╗
║ LOCAL CI/CD PIPELINE SIMULATION ║
║ GitLab CI Pipeline ║
╚═══════════════════════════════════════════════════════╝
=====================================
STAGE: LINT
=====================================
>>> JOB: lint:black
Running: poetry run black --check src/ tests/
✅ PASSED: Black code formatting
>>> JOB: lint:ruff
Running: poetry run ruff check src/ tests/
✅ PASSED: Ruff linting
>>> JOB: lint:mypy
Running: poetry run mypy src/
✅ PASSED: MyPy type checking
...
╔═══════════════════════════════════════════════════════╗
║ ✅ PIPELINE PASSED SUCCESSFULLY ✅ ║
╚═══════════════════════════════════════════════════════╝
Total Tests: 8
Passed: 8
Failed: 0
Duration: 6s
Exit Codes
- 0: All checks passed ✅
- 1: One or more checks failed ❌
Requirements
- Poetry: For dependency management
- Python 3.12+: As specified in
pyproject.toml - Docker/Podman (optional): For Docker validation stage
- MongoDB (optional): For integration tests
When to Run
Run this script:
- ✅ Before every commit to ensure code quality
- ✅ Before creating a pull request
- ✅ After making significant changes
- ✅ To verify CI/CD pipeline compatibility
Integration with Git
You can add this as a Git pre-push hook:
#!/bin/bash
# .git/hooks/pre-push
echo "Running CI pipeline validation..."
bash scripts/test-ci-pipeline.sh
if [ $? -ne 0 ]; then
echo "❌ CI pipeline validation failed. Push aborted."
exit 1
fi
echo "✅ CI pipeline validation passed. Proceeding with push..."
exit 0
Continuous Integration Compatibility
This script simulates:
- ✅ GitHub Actions (
.github/workflows/build-deploy.yml) - ✅ GitLab CI (
.gitlab-ci.yml) - ✅ Gitea Actions (
.gitea/workflows/ci.yml)
All checks performed locally will also pass in the actual CI/CD platforms.
📝 Report Files
After running the validation script, you'll find:
ci-pipeline-report-TIMESTAMP.txt: Plain text summaryCI_VALIDATION_REPORT.md: Comprehensive markdown report with details
🚀 Quick Start
# First time setup
poetry install
# Run validation
bash scripts/test-ci-pipeline.sh
# If all passes, commit and push
git add .
git commit -m "your commit message"
git push
🔧 Troubleshooting
"poetry: command not found"
Install Poetry: https://python-poetry.org/docs/#installation
"Black would reformat X files"
Run: poetry run black src/ tests/
"Ruff found X errors"
Run: poetry run ruff check --fix src/ tests/
"MyPy found X errors"
Fix type errors or add type ignores where appropriate.
Docker validation fails
Ensure Docker or Podman is installed:
- Ubuntu/Debian:
sudo apt install docker.io - Fedora:
sudo dnf install podman podman-compose
📚 Additional Resources
- CLAUDE.md - Project documentation for AI assistants
- README.md - Project overview
- TODO.md - Development roadmap
- CI_VALIDATION_REPORT.md - Latest validation report