deployment, frontend updates

This commit is contained in:
buenosairesam
2026-01-26 15:11:03 -03:00
parent bf7bcbc37a
commit 3122facaba
16 changed files with 1692 additions and 113 deletions

View File

@@ -0,0 +1,180 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Deskmeter - Architecture & Design</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<h1>Deskmeter</h1>
<p class="subtitle">Productivity Tracking - Architecture Documentation</p>
</header>
<main>
<section class="graph-section" id="overview">
<div class="graph-header-row">
<h2>System Overview</h2>
<a href="graph.html?g=01-system-overview" class="view-btn">View Full</a>
</div>
<a href="graph.html?g=01-system-overview" class="graph-preview">
<img src="01-system-overview.svg" alt="System Overview">
</a>
<div class="graph-details">
<p>High-level architecture showing local tracking, data sync, and remote portfolio deployment.</p>
<h4>Key Components</h4>
<ul>
<li><strong>dmcore</strong>: Workspace tracking daemon using wmctrl (X11)</li>
<li><strong>dmweb</strong>: Flask web dashboard with calendar and switches views</li>
<li><strong>dmsync</strong>: Change Streams daemon pushing data to remote MongoDB</li>
<li><strong>GNOME Extension</strong>: Panel indicator showing current task</li>
</ul>
</div>
</section>
<section class="graph-section" id="data-sync">
<div class="graph-header-row">
<h2>Data Sync Architecture</h2>
<a href="graph.html?g=02-data-sync" class="view-btn">View Full</a>
</div>
<a href="graph.html?g=02-data-sync" class="graph-preview">
<img src="02-data-sync.svg" alt="Data Sync">
</a>
<div class="graph-details">
<p>Real-time sync using MongoDB Change Streams with resume token persistence.</p>
<h4>Collections Synced</h4>
<table class="details-table">
<thead>
<tr>
<th>Collection</th>
<th>Purpose</th>
<th>Size</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>switch</code></td>
<td>Workspace switch events with timestamps and durations</td>
<td>~33k docs</td>
</tr>
<tr>
<td><code>task</code></td>
<td>Current task definitions from task file</td>
<td>~50 docs</td>
</tr>
<tr>
<td><code>task_history</code></td>
<td>Cached historic task path lookups</td>
<td>~200 docs</td>
</tr>
<tr>
<td><code>state</code></td>
<td>Current workspace and task state</td>
<td>1 doc</td>
</tr>
</tbody>
</table>
<h4>Why Change Streams?</h4>
<ul>
<li>Reacts to actual changes (not polling)</li>
<li>Resume token ensures no data loss on restart</li>
<li>Native MongoDB feature (requires replica set)</li>
<li>Clean, intentional architecture for portfolio</li>
</ul>
</div>
</section>
<section class="graph-section" id="deployment">
<div class="graph-header-row">
<h2>Deployment Architecture</h2>
<a href="graph.html?g=03-deployment" class="view-btn">View Full</a>
</div>
<a href="graph.html?g=03-deployment" class="graph-preview">
<img src="03-deployment.svg" alt="Deployment">
</a>
<div class="graph-details">
<p>Docker Compose deployment on AWS EC2 with Nginx reverse proxy.</p>
<h4>Networks</h4>
<ul>
<li><strong>gateway</strong>: External network connecting Nginx to dmweb</li>
<li><strong>internal</strong>: Private network for dmweb ↔ MongoDB communication</li>
</ul>
<h4>Deployment Flow</h4>
<ul>
<li>Build Docker image locally</li>
<li>Push to private registry (registry.mcrn.ar)</li>
<li>Pull and deploy on AWS EC2</li>
</ul>
</div>
</section>
<section class="findings-section">
<h2>Design Decisions</h2>
<div class="findings-grid">
<article class="finding-card">
<h3>Bare Metal Core</h3>
<p>dmcore runs on bare metal (not Docker) because it requires direct OS access for workspace detection via wmctrl and X11.</p>
</article>
<article class="finding-card">
<h3>Single-Node Replica Set</h3>
<p>Local MongoDB configured as replica set (rs0) to enable Change Streams. No actual replication, just API requirement.</p>
</article>
<article class="finding-card">
<h3>Push Sync Model</h3>
<p>Local machine pushes to remote (not pull). MongoDB on remote is not exposed to internet - only accessible from the sync daemon.</p>
</article>
<article class="finding-card">
<h3>Portfolio-Ready</h3>
<p>Remote instance shows historical data. "Current task" reflects last-synced state, not real-time.</p>
</article>
</div>
</section>
<section class="tech-section">
<h2>Technology Stack</h2>
<div class="tech-grid">
<div class="tech-column">
<h3>Core</h3>
<ul>
<li>Python 3.11</li>
<li>Flask</li>
<li>PyMongo</li>
<li>Jinja2 Templates</li>
</ul>
</div>
<div class="tech-column">
<h3>Data</h3>
<ul>
<li>MongoDB 7</li>
<li>Change Streams</li>
<li>Replica Set</li>
</ul>
</div>
<div class="tech-column">
<h3>Infrastructure</h3>
<ul>
<li>Docker</li>
<li>Docker Compose</li>
<li>Nginx</li>
<li>AWS EC2</li>
</ul>
</div>
<div class="tech-column">
<h3>OS Integration</h3>
<ul>
<li>wmctrl (X11)</li>
<li>GNOME Shell Extension</li>
<li>systemd</li>
</ul>
</div>
</div>
</section>
</main>
<footer>
<p>Deskmeter - Architecture Documentation</p>
<p class="date">Generated: <time datetime="2025-01">January 2025</time></p>
</footer>
</body>
</html>