VPS refactoring: ARM64 support, graceful shutdown, persistence & Discord notifications#1944
Open
aharada54914 wants to merge 5 commits intokoala73:mainfrom
Open
VPS refactoring: ARM64 support, graceful shutdown, persistence & Discord notifications#1944aharada54914 wants to merge 5 commits intokoala73:mainfrom
aharada54914 wants to merge 5 commits intokoala73:mainfrom
Conversation
Comprehensive refactoring plan targeting the Hetzner CAX21 (ARM64/Debian/8GB) environment. Covers 17 items across P0–P3 priority levels: - P0: ARM64 platform declaration, graceful shutdown, Redis persistence, log rotation, systemd auto-start - P1: Swap config, per-service memory limits, seed retry with backoff, ufw firewall, cron seeding - P2: Structured JSON logging, health check automation, Docker Secrets - P3: TLS via Cloudflare Proxy https://claude.ai/code/session_012cgux13dymqPbJMuJoWBWs
Revise VPS_REFACTORING_PLAN.md to include Gemini-powered Discord
periodic notification as a P1 item (Section 7):
- New script: scripts/discord-notify.mjs
- Fetches 8 data categories from Redis in parallel
(earthquakes M5+, unrest HIGH, military flights HIGH,
natural disasters, weather EXTREME/SEVERE, cyber CRITICAL,
armed conflict, market movers ±2%)
- Summarizes via Gemini 2.0 Flash (direct API) with
OpenRouter fallback (google/gemini-2.5-flash)
- Posts rich Discord Embed with color-coded threat level
- Supports configurable interval via DISCORD_NOTIFY_INTERVAL_MINUTES
- Runs as one-shot (cron) or daemon (--daemon flag)
- New env vars: DISCORD_WEBHOOK_URL, GEMINI_API_KEY,
GEMINI_MODEL, DISCORD_NOTIFY_INTERVAL_MINUTES, DISCORD_NOTIFY_LANGUAGE
- Added to Week 2 roadmap alongside other P1 items
- Updated file list and status summary tables
https://claude.ai/code/session_012cgux13dymqPbJMuJoWBWs
…ation P0 — Production-critical: - docker-compose.yml: add linux/arm64 platform to all build sections - docker-compose.yml: enable Redis AOF+RDB persistence, maxmemory 1GB - docker-compose.yml: add per-service mem_limit (2g/3g/1.2g/256m) - docker-compose.yml: add json-file log rotation (max-size/max-file) - local-api-server.mjs: add createLogger() for structured JSON logging in Docker mode; plain console in desktop/sidecar mode - local-api-server.mjs: add SIGTERM/SIGINT graceful shutdown with 30-second force-exit safety net P1 — Operational stability + Discord notifications: - docker-compose.yml: add DISCORD_WEBHOOK_URL / GEMINI_API_KEY / GEMINI_MODEL / DISCORD_NOTIFY_INTERVAL_MINUTES / DISCORD_NOTIFY_LANGUAGE env vars; add OPENROUTER_API_KEY passthrough - scripts/discord-notify.mjs (new): Redis → Gemini → Discord pipeline - Fetches 8 data categories in parallel from Redis - Filters for notable events (M5+ quakes, HIGH unrest, CRITICAL cyber, etc.) - Summarises with Gemini 2.0 Flash (direct API) or OpenRouter fallback - Posts rich colour-coded Discord Embed with per-category fields - One-shot mode (cron) or --daemon mode (supervisord) - Exits 0 when env vars unset so supervisord does not restart - scripts/run-seeders.sh: replace single-attempt loop with run_with_retry() (3 attempts, exponential backoff 1s/4s) - docker/supervisord.conf: add discord-notify program (autorestart=unexpected) - scripts/setup-vps.sh (new): one-shot VPS bootstrap script (2GB swap, Docker install, ufw firewall, systemd service, cron jobs) - docker/worldmonitor.service (new): systemd unit template with __REPO_DIR__ placeholder substituted by setup-vps.sh P2 — Monitoring: - scripts/health-check.sh (new): polls /api/health every 2 min, sends Discord alert and optional email on DEGRADED/UNHEALTHY/UNREACHABLE Misc: - .env.example: document DISCORD_WEBHOOK_URL, GEMINI_API_KEY, GEMINI_MODEL, DISCORD_NOTIFY_INTERVAL_MINUTES, DISCORD_NOTIFY_LANGUAGE https://claude.ai/code/session_012cgux13dymqPbJMuJoWBWs
|
@claude is attempting to deploy a commit to the Elie Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Comprehensive refactoring plan and implementation for 24/7 stable operation on Hetzner CAX21 (ARM64 Debian). Adds critical production-readiness features: ARM64 Docker builds, graceful shutdown, Redis persistence, automated service startup, Docker log rotation, and a new Discord notification system powered by Gemini AI.
Type of change
Affected areas
Changes
P0 — Critical (Production Readiness)
ARM64 Platform Support
platforms: [linux/arm64]to all Docker build configs indocker-compose.ymlGraceful Shutdown
src-tauri/sidecar/local-api-server.mjsRedis Persistence
--save 300 100 --save 60 1000)--appendonly yes --appendfsync everysec)Docker Log Rotation
loggingconfig to all services withmax-sizeandmax-filelimitsAutomatic Service Startup
docker/worldmonitor.servicesystemd unitP1 — High Priority (Stability & Monitoring)
Discord Periodic Notifications (New Feature)
scripts/discord-notify.mjs— fetches 8 data categories from Redis, summarizes with Gemini 2.0 Flash, posts to DiscordDISCORD_NOTIFY_INTERVAL_MINUTESMemory Management
Seed Script Resilience
scripts/run-seeders.shwith exponential backoff retry logic (3 attempts)Firewall & Security
scripts/setup-vps.sh— automated ufw configurationHealth Monitoring
scripts/health-check.sh— 2-minute interval health checksCron Automation
P2 — Medium Priority
Structured Logging
local-api-server.mjsfor Docker modeEnvironment Variables
.env.exampleSupervisord Integration
discord-notifyprogram todocker/supervisord.conffor daemon modeConfiguration
Required Environment Variables (for Discord notifications)