Use prometheus as a monitoring server and storage #3079
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.
What is this PR about?
This pull request introduces a comprehensive Prometheus-based monitoring stack for Dokploy, providing a modern, scalable, and industry-standard alternative to the previous custom Go-based monitoring solution. The implementation includes robust setup utilities, extensive query and health-check utilities, thorough testing (unit and integration), detailed documentation, and a manual testing script. All changes are isolated, non-breaking, and fully tested, laying the foundation for future enhancements like Grafana dashboards and alerting.
Key changes:
Prometheus Monitoring Stack Implementation
prometheus-setup.tsfor automated setup and lifecycle management of Prometheus, Node Exporter, and cAdvisor containers, supporting both local and remote deployments with persistent storage and automatic configuration.prometheus-utils.tsproviding utilities for querying system and container metrics, health checks, and PromQL query construction, with support for both instant and range queries.Testing
prometheus-utils.test.ts, and 5 integration tests for full stack deployment and teardown inprometheus-setup.test.ts, ensuring 100% coverage and robust error handling.Documentation and Tools
docs/prometheus-monitoring.md, including architecture, usage, troubleshooting, and migration notes.test-prometheus-stack.ts, a CLI tool for manual testing and verification of the Prometheus stack.Environment Variable Handling Improvements
prepareEnvironmentVariablesand introducedprepareEnvironmentVariablesForShellto robustly handle and escape environment variables with special characters, spaces, quotes, newlines, unicode, and shell metacharacters, with extensive new test coverage for edge cases.Project Quality and Integration
For further details, see the new documentation in
docs/prometheus-monitoring.mdand the test suites inapps/dokploy/__test__/monitoring/.Checklist
Before submitting this PR, please make sure that:
canarybranch.Issues related (if applicable)
closes #2376
Screenshots (if applicable)