Admin VPS console, tips manager, secure health endpoint, and deployment hardening - #81
Conversation
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughDeployment infrastructure overhaul: Docker removed in favor of systemd-only deployment; added WEBAPP_HMAC_KEY environment variable; enhanced deploy.sh and prod-run.sh with directory creation, ownership management, health checks, and port conflict resolution; secured runewager.service with non-root user and hardening directives; refactored diagnostic tool for structured snapshot-based reporting. Changes
Sequence Diagram(s)sequenceDiagram
participant startup as Startup Script<br/>(prod-run.sh)
participant user as Service User<br/>Manager
participant port as Port Listener<br/>Manager
participant health as Health Endpoint<br/>Checker
participant systemd as Systemd<br/>Service
participant fallback as Fallback<br/>Recovery
startup->>user: ensure_service_user()
user-->>startup: User created/confirmed
startup->>startup: Create data/, logs/,<br/>data/backups/ dirs
startup->>startup: Set permissions<br/>(0750, 0640, 0600)
startup->>port: is_port_listening()
port-->>startup: Port status
alt Port conflict detected
startup->>port: free_port_if_conflicted()
port->>port: Kill conflicting<br/>processes
port-->>startup: Port freed
end
startup->>systemd: Start/restart service
systemd-->>startup: Service started
startup->>health: resolve_health_url()<br/>(TLS-aware)
health-->>startup: Health URL
startup->>health: wait_for_health()<br/>(with probe/retry)
alt Health check passes
health-->>startup: ✓ Healthy
startup-->>startup: Success, exit 0
else Health check fails
health-->>startup: ✗ Unhealthy
startup->>fallback: Attempt recovery
fallback->>port: free_port_if_conflicted()
fallback->>systemd: Conditional restart
fallback->>health: Retry health check
fallback-->>startup: Recovery attempt logged
startup-->>startup: Dump logs, may exit non-zero
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Nitpicks 🔍
|
|
CodeAnt AI finished reviewing your PR. |
User description
Motivation
prod-run.shwith health probing, port conflict recovery, service user handling, and log/permission management.Description
/sshv) with per-admin sessions, editor mode, command execution with safety checks, session persistence todata/sshv-sessions.json, GC of expired sessions, and many helper functions (getSshvSession,executeSshvCommand,persistSshvSessions, etc.).HTTPS_KEY_PATH/HTTPS_CERT_PATHare configured and validates allowed TLS paths viaresolveTlsCertPathIfAllowed;requestHealthPayloadcentralizes health probes used by admin commands.WEBAPP_HMAC_KEY(new env) instead of a constant string and returns false when not configured.validateSafePathand updatedloadJson/writeFileAtomic/saveJsonto prevent path traversal and ensure writes use atomic temp files underdata/.formatTipForHtml), added persistence todata/helpful_messages.jsonwith import/overwrite support via/tipaddand/tipedit, added scheduler improvements to avoid duplicate sends (lastSentTipId) and permission checks before posting./on/offand UI toggle), ephemeral promo prompt that auto-removes, centralizedreplaceCallbackPanel, callback-audit added totestall, and a global fallback for stale callback_data.Dockerfile, addedLICENSEandSECURITY.md, updated.env.examplewithWEBAPP_HMAC_KEY, cleaned up.gitignoreentries, and majorprod-run.shenhancements including service user creation, log/data directory ownership/permissions, TLS-aware health checks, port conflict resolution, wait-for-health retries, more secure systemd unit flags, and logrotate updates.runewager.servicedefaults to userunewageruser and hardened unit options; improvedscripts/self-diagnose.shto produce a structured snapshot report.Testing
CI=true node index.js) to ensure the updated module initializes without throwing; this succeeded.scripts/self-diagnose.shlocally to verify diagnostic output and presence of expected files and services; the script ran and produced a report.prod-run.shlogic in a non-production test environment by ensuring directories/files are created, the systemd unit template is written, and the health probe logic returns (health probe checks and port handling succeeded in the test run).Codex Task
CodeAnt-AI Description
Improve admin menus, make group tips HTML-safe and testable, and harden production deploys
What Changed
Impact
✅ Clearer group tips✅ Fewer duplicate tip posts✅ Shorter recovery from port conflicts💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.
Summary by CodeRabbit
Release Notes
New Features
Documentation
Improvements
Chores