Skip to content

Conversation

@SSanjeevi
Copy link

@SSanjeevi SSanjeevi commented Nov 21, 2025

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

  • Added prometheus-setup.ts for automated setup and lifecycle management of Prometheus, Node Exporter, and cAdvisor containers, supporting both local and remote deployments with persistent storage and automatic configuration.
  • Added prometheus-utils.ts providing utilities for querying system and container metrics, health checks, and PromQL query construction, with support for both instant and range queries.

Testing

  • Added 12 new unit tests for all query functions and error handling in prometheus-utils.test.ts, and 5 integration tests for full stack deployment and teardown in prometheus-setup.test.ts, ensuring 100% coverage and robust error handling.

Documentation and Tools

  • Added a complete user and API guide in docs/prometheus-monitoring.md, including architecture, usage, troubleshooting, and migration notes.
  • Added test-prometheus-stack.ts, a CLI tool for manual testing and verification of the Prometheus stack.

Environment Variable Handling Improvements

  • Enhanced prepareEnvironmentVariables and introduced prepareEnvironmentVariablesForShell to 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

  • All new code is linted, formatted, and strictly typed. No breaking changes or runtime dependencies were introduced, and the implementation is fully compatible with existing systems and Docker setups.

For further details, see the new documentation in docs/prometheus-monitoring.md and the test suites in apps/dokploy/__test__/monitoring/.

Checklist

Before submitting this PR, please make sure that:

Issues related (if applicable)

closes #2376

Screenshots (if applicable)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use prometheus as a monitoring server and storage

1 participant