reorg folders again
This commit is contained in:
62
scratch/generate-mermaid.py
Executable file
62
scratch/generate-mermaid.py
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
"""
|
||||
Mermaid Diagram Generator for Homelab Nodes
|
||||
This script generates mermaid.js diagrams from node data
|
||||
"""
|
||||
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
def generate_mermaid_diagram(nodes_data, output_file):
|
||||
"""Generate a mermaid diagram from node data"""
|
||||
|
||||
# Start the mermaid diagram
|
||||
mermaid_content = "graph TD\n"
|
||||
mermaid_content += " %% Network Infrastructure\n"
|
||||
mermaid_content += " subgraph \"Homelab Network\"\n"
|
||||
|
||||
# Add nodes
|
||||
for node in nodes_data.get('nodes', []):
|
||||
node_name = node.get('name', 'Unknown')
|
||||
ip = node.get('ip', 'Unknown')
|
||||
node_type = node.get('type', 'Generic')
|
||||
node_id = node_name.replace(' ', '').replace('.', '')
|
||||
|
||||
mermaid_content += f" {node_id}[{node_name}<br/>{ip}]\n"
|
||||
|
||||
# Add connections
|
||||
for connection in nodes_data.get('connections', []):
|
||||
source = connection.get('source', '').replace(' ', '').replace('.', '')
|
||||
target = connection.get('target', '').replace(' ', '').replace('.', '')
|
||||
description = connection.get('description', 'Connection')
|
||||
|
||||
mermaid_content += f" {source} -->|{description}| {target}\n"
|
||||
|
||||
# End the diagram
|
||||
mermaid_content += " end\n"
|
||||
|
||||
# Write to file
|
||||
with open(output_file, 'w') as f:
|
||||
f.write(mermaid_content)
|
||||
|
||||
print(f"Mermaid diagram generated: {output_file}")
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 3:
|
||||
print("Usage: python3 generate-mermaid.py <input.json> <output.mmd>")
|
||||
return
|
||||
|
||||
input_file = sys.argv[1]
|
||||
output_file = sys.argv[2]
|
||||
|
||||
# Read input data
|
||||
with open(input_file, 'r') as f:
|
||||
nodes_data = json.load(f)
|
||||
|
||||
# Generate diagram
|
||||
generate_mermaid_diagram(nodes_data, output_file)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
85
scratch/setup-dashy.sh
Executable file
85
scratch/setup-dashy.sh
Executable file
@@ -0,0 +1,85 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Dashy Setup Script
|
||||
# This script automates the setup of Dashy for homelab dashboard
|
||||
|
||||
echo "Setting up Dashy dashboard for homelab services..."
|
||||
|
||||
# Create Dashy directory structure
|
||||
mkdir -p /opt/dashy/config
|
||||
mkdir -p /opt/dashy/public
|
||||
|
||||
# Create sample Dashy configuration
|
||||
cat > /opt/dashy/config/config.yml << 'EOF'
|
||||
# Dashy Configuration
|
||||
title: "My Homelab Dashboard"
|
||||
subtitle: "Home Network Services"
|
||||
theme: "default"
|
||||
favicon: "/public/favicon.ico"
|
||||
backgroundImage: "/public/background.jpg"
|
||||
showStats: true
|
||||
showSearch: true
|
||||
sections:
|
||||
- name: "Network Infrastructure"
|
||||
items:
|
||||
- title: "Router"
|
||||
description: "Main network router"
|
||||
url: "http://192.168.1.1"
|
||||
icon: "router"
|
||||
category: "network"
|
||||
- title: "Firewall"
|
||||
description: "Network security"
|
||||
url: "http://192.168.1.254"
|
||||
icon: "shield"
|
||||
category: "network"
|
||||
- title: "NAS"
|
||||
description: "Network attached storage"
|
||||
url: "http://192.168.1.10"
|
||||
icon: "server"
|
||||
category: "storage"
|
||||
- name: "Media Services"
|
||||
items:
|
||||
- title: "Media Server"
|
||||
description: "Home media streaming"
|
||||
url: "http://192.168.1.20"
|
||||
icon: "tv"
|
||||
category: "media"
|
||||
- title: "Smart TV"
|
||||
description: "4K streaming device"
|
||||
url: "http://192.168.1.104"
|
||||
icon: "smart-tv"
|
||||
category: "media"
|
||||
- name: "Home Automation"
|
||||
items:
|
||||
- title: "Home Hub"
|
||||
description: "Home automation control"
|
||||
url: "http://192.168.1.30"
|
||||
icon: "home"
|
||||
category: "automation"
|
||||
- title: "IoT Devices"
|
||||
description: "Internet of Things"
|
||||
url: "http://192.168.1.150"
|
||||
icon: "devices"
|
||||
category: "automation"
|
||||
EOF
|
||||
|
||||
# Create systemd service file for Dashy
|
||||
cat > /etc/systemd/system/dashy.service << 'EOF'
|
||||
[Unit]
|
||||
Description=Dashy Homelab Dashboard
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=dashy
|
||||
Group=dashy
|
||||
WorkingDirectory=/opt/dashy
|
||||
ExecStart=/usr/local/bin/dashy --config /opt/dashy/config/config.yml
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
echo "Dashy setup complete. You can now run: sudo systemctl start dashy"
|
||||
53
scratch/setup-scanopy.sh
Executable file
53
scratch/setup-scanopy.sh
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Scanopy Setup Script
|
||||
# This script automates the setup of Scanopy for homelab network documentation
|
||||
|
||||
echo "Setting up Scanopy for homelab network documentation..."
|
||||
|
||||
# Create required directories
|
||||
mkdir -p /opt/scanopy/config
|
||||
mkdir -p /opt/scanopy/data
|
||||
|
||||
# Create basic Scanopy configuration
|
||||
cat > /opt/scanopy/config/scanopy.yml << 'EOF'
|
||||
# Scanopy Configuration
|
||||
name: "MyHomelab"
|
||||
description: "Homelab network documentation"
|
||||
scan:
|
||||
interval: 3600
|
||||
targets:
|
||||
- 192.168.1.0/24
|
||||
protocols:
|
||||
- snmp
|
||||
- ssh
|
||||
- http
|
||||
- https
|
||||
# Add additional configuration as needed
|
||||
export:
|
||||
formats:
|
||||
- mermaid
|
||||
- svg
|
||||
- confluence
|
||||
output_dir: /opt/scanopy/data
|
||||
EOF
|
||||
|
||||
# Create systemd service file for Scanopy
|
||||
cat > /etc/systemd/system/scanopy.service << 'EOF'
|
||||
[Unit]
|
||||
Description=Scanopy Network Documentation
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=scanopy
|
||||
Group=scanopy
|
||||
ExecStart=/usr/local/bin/scanopy --config /opt/scanopy/config/scanopy.yml
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
echo "Scanopy setup complete. You can now run: sudo systemctl start scanopy"
|
||||
Reference in New Issue
Block a user