Initial resurrection kit — 81 scripts, 62 references, configs, systemd units, crons, Docker compose files, Caddy config, master README
This commit is contained in:
@@ -0,0 +1,163 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Send DR plan + consolidation proposal email to Germaine."""
|
||||
import smtplib, random, importlib.util
|
||||
from email.mime.text import MIMEText
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.base import MIMEBase
|
||||
from email import encoders
|
||||
|
||||
SMTP = "mail.germainebrown.com"
|
||||
PORT = 2525
|
||||
PASS = "Catches.bullets1985"
|
||||
FROM = "shonuff@germainebrown.com"
|
||||
TO = "g@germainebrown.com"
|
||||
|
||||
def load_list(path, attr="ITEMS"):
|
||||
spec = importlib.util.spec_from_file_location("mod", path)
|
||||
mod = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(mod)
|
||||
return getattr(mod, attr, [])
|
||||
|
||||
CLOSINGS = load_list("/root/.hermes/references/shonuff-closings.py", "SHONUFF_CLOSINGS")
|
||||
TITLES = load_list("/root/.hermes/references/shonuff-titles.py", "SHONUFF_TITLES")
|
||||
|
||||
# Create message
|
||||
msg = MIMEMultipart("mixed")
|
||||
msg["From"] = FROM
|
||||
msg["To"] = TO
|
||||
msg["Bcc"] = TO
|
||||
msg["Subject"] = "DR Plans + Consolidation Proposal — Full & Redacted"
|
||||
|
||||
# Full version text part
|
||||
full_body = """\
|
||||
<h2 style="color:#dc2626;border-bottom:2px solid #dc2626;padding-bottom:8px;">DR Plans + Memory Consolidation Proposal</h2>
|
||||
<hr style="border:none;border-top:2px solid #dc2626;margin:8px 0 16px 0;">
|
||||
|
||||
<h3>What's Attached</h3>
|
||||
|
||||
<p><strong>1. Per-Server DR Plans (full)</strong><br>
|
||||
Covers all 11 servers: Core, ai (admin-ai), wphost02, unms, unifi, hudu, fleettracker360, docker box, n8n, tony-vps, app1-bu (standby). Each with services, backup strategy, restore procedure, and dependency map.</p>
|
||||
|
||||
<p><strong>2. Per-Server DR Plans (redacted)</strong><br>
|
||||
IPs removed, credentials stripped, internal details generalized. Suitable for 3rd party review or compliance audit.</p>
|
||||
|
||||
<p><strong>3. Server Provisioning Standard v1</strong><br>
|
||||
Base OS config, SSH key deployment, standard users, Docker setup, firewall baseline. Every new server follows this pattern.</p>
|
||||
|
||||
<p><strong>4. Memory Consolidation Proposal</strong><br>
|
||||
Three options for improving the memory auto-pruning system — priority tagging, dual-store architecture, or template-based structuring. Recommendation in the document.</p>
|
||||
|
||||
<h3>Key Findings</h3>
|
||||
|
||||
<table style="width:100%;border-collapse:collapse;margin:12px 0;">
|
||||
<tr style="background:#1e293b;color:#e2e8f0;">
|
||||
<th style="padding:8px;border:1px solid #334155;text-align:left;">Item</th>
|
||||
<th style="padding:8px;border:1px solid #334155;text-align:left;">Status</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:8px;border:1px solid #334155;">AI server disk usage</td>
|
||||
<td style="padding:8px;border:1px solid #334155;color:#dc2626;"><strong>🔴 92% full — clean up before migration</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:8px;border:1px solid #334155;">Docker volume backups</td>
|
||||
<td style="padding:8px;border:1px solid #334155;color:#f59e0b;">🟡 Not automated — needs attention</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:8px;border:1px solid #334155;">Database dumps</td>
|
||||
<td style="padding:8px;border:1px solid #334155;color:#f59e0b;">🟡 Not automated for most servers</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:8px;border:1px solid #334155;">Hermes warm standby</td>
|
||||
<td style="padding:8px;border:1px solid #334155;color:#22c55e;">✅ Functional via app1-bu</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:8px;border:1px solid #334155;">WireGuard tunnel to home</td>
|
||||
<td style="padding:8px;border:1px solid #334155;color:#22c55e;">✅ Active (Core + app1-bu)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:8px;border:1px solid #334155;">Router SMTP</td>
|
||||
<td style="padding:8px;border:1px solid #334155;color:#22c55e;">✅ Sending via port 2525</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>No Servers Left Behind</h3>
|
||||
<p>Every Hetzner box is inventoried and documented in the DR plan. Migration targets identified per the RS 4000 standard the Network Services Team defined. The redacted version is clean for external review — no IPs, no credentials, minimal internal topology.</p>
|
||||
|
||||
<h3>Next Steps</h3>
|
||||
<ol>
|
||||
<li>Network Services Team reviews the consolidation proposal</li>
|
||||
<li>AI server disk cleanup (highest priority)</li>
|
||||
<li>Docker volume backup automation</li>
|
||||
<li>Database dump scheduling</li>
|
||||
<li>Begin netcup migration when ready</li>
|
||||
</ol>
|
||||
|
||||
<p>Files are saved locally at:<br>
|
||||
<code>/root/.hermes/references/server-dr-plans.md</code> (full)<br>
|
||||
<code>/root/.hermes/references/server-dr-plans-redacted.md</code> (redacted)<br>
|
||||
<code>/root/.hermes/references/server-provisioning-standard-v1.md</code><br>
|
||||
<code>/root/.hermes/references/memory-consolidation-proposal.md</code></p>
|
||||
"""
|
||||
|
||||
# Create the alternative parts (plain text + HTML)
|
||||
text_alt = MIMEMultipart("alternative")
|
||||
|
||||
# Plain text fallback
|
||||
text_part = MIMEText("""DR Plans + Consolidation Proposal
|
||||
|
||||
Attachments:
|
||||
1. Per-Server DR Plans (full) - ALL 11 servers
|
||||
2. Per-Server DR Plans (redacted) - for 3rd party review
|
||||
3. Server Provisioning Standard v1
|
||||
4. Memory Consolidation Proposal
|
||||
|
||||
Key Findings:
|
||||
- AI server disk 92% full - NEEDS CLEANUP
|
||||
- Docker volume backups not automated
|
||||
- Database dumps not automated
|
||||
- Hermes standby functional
|
||||
- WireGuard active on Core + app1-bu
|
||||
|
||||
Full files at:
|
||||
/root/.hermes/references/server-dr-plans.md
|
||||
/root/.hermes/references/server-dr-plans-redacted.md
|
||||
/root/.hermes/references/server-provisioning-standard-v1.md
|
||||
/root/.hermes/references/memory-consolidation-proposal.md
|
||||
""", "plain")
|
||||
|
||||
# HTML version
|
||||
sig = open("/root/.hermes/references/shonuff-email-signature.html").read()
|
||||
b64 = open("/root/.hermes/references/shonuff-image-b64.txt").read().strip()
|
||||
title = random.choice(TITLES)
|
||||
closing = random.choice(CLOSINGS)
|
||||
sig = sig.replace("%SHONUFF_IMAGE%", b64).replace("%SHONUFF_TITLE%", title)
|
||||
|
||||
html_full = f"<p>{full_body.replace(chr(10), '<br>')}</p><p><em>{closing}</em></p>{sig}"
|
||||
html_part = MIMEText(html_full, "html")
|
||||
|
||||
text_alt.attach(text_part)
|
||||
text_alt.attach(html_part)
|
||||
|
||||
msg.attach(text_alt)
|
||||
|
||||
# Attach the files
|
||||
for fname, display_name in [
|
||||
("/root/.hermes/references/server-dr-plans.md", "server-dr-plans-full.md"),
|
||||
("/root/.hermes/references/server-dr-plans-redacted.md", "server-dr-plans-redacted.md"),
|
||||
("/root/.hermes/references/server-provisioning-standard-v1.md", "server-provisioning-standard-v1.md"),
|
||||
("/root/.hermes/references/memory-consolidation-proposal.md", "memory-consolidation-proposal.md"),
|
||||
]:
|
||||
with open(fname, "rb") as f:
|
||||
attachment = MIMEBase("application", "octet-stream")
|
||||
attachment.set_payload(f.read())
|
||||
encoders.encode_base64(attachment)
|
||||
attachment.add_header("Content-Disposition", f"attachment; filename={display_name}")
|
||||
msg.attach(attachment)
|
||||
|
||||
# Send
|
||||
with smtplib.SMTP(SMTP, PORT) as s:
|
||||
s.starttls()
|
||||
s.login(FROM, PASS)
|
||||
s.send_message(msg)
|
||||
|
||||
print(f"Sent to {TO} — BCC'd g@germainebrown.com")
|
||||
Reference in New Issue
Block a user