PMM-14993 Add one-step PMM client installer script and UI integration#5250
PMM-14993 Add one-step PMM client installer script and UI integration#5250theTibi wants to merge 46 commits into
Conversation
- Introduced a new script `install-pmm-client.sh` for streamlined installation of the PMM client. - Updated Ansible tasks to copy the installer script to the appropriate directory. - Enhanced documentation with a new section for one-step installation from the UI. - Added a new Install Client page in the UI for generating installation commands. - Integrated navigation for the new Install Client page within the application. This update simplifies the PMM client installation process and improves user experience through the UI.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v3 #5250 +/- ##
==========================================
- Coverage 43.22% 43.19% -0.04%
==========================================
Files 413 413
Lines 42279 42279
==========================================
- Hits 18277 18263 -14
- Misses 22134 22149 +15
+ Partials 1868 1867 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Cleaned up import statements in `accesscontrol_grpc.pb.go` and `actions_grpc.pb.go` by removing unnecessary blank lines. - Updated `accesscontrol.pb.go` and `actions.pb.go` to reorder import statements for consistency. - Added validation checks in `accesscontrol.pb.validate.go` and `advisors.pb.validate.go` to ensure proper handling of optional fields. - Introduced new Swagger JSON files for `accesscontrol` and `actions` APIs to enhance API documentation. - Improved formatting and organization of code across multiple files for better readability and maintainability. These changes enhance the overall structure and documentation of the API, making it easier for developers to understand and use.
- Simplified the implementation of the createNodeInstallToken function by directly returning the response data from the API call. - Removed unnecessary parameters in the API post method for cleaner code. These changes enhance code readability and maintainability.
- Modified `install-pmm-client.sh` to enhance command options for node registration and configuration, including clearer error messages and improved handling of non-interactive installations. - Updated the UI to set `insecureTLS` to true by default and adjusted related tests to reflect this change. - Refactored command building logic in `InstallClientPage.utils.ts` to streamline the installation command generation, ensuring proper handling of flags and environment variables. These changes improve the installation process and user experience for the PMM client.
- Simplified the OS detection logic by removing unnecessary cases for various Linux distributions. - Updated the error message to clearly specify the supported 64-bit Linux distributions: Debian, Ubuntu (DEB) and RHEL, Oracle Linux, Amazon Linux (RPM). These changes enhance the clarity and maintainability of the installation script.
- Updated the default credentials mode to 'env' for improved security during installation. - Enhanced user guidance in the UI regarding the use of environment variables and flags for database credentials. - Added new helper text to clarify the limitations of using curl with the installation script. - Modified the command generation logic to include database environment variables when applicable, improving the handling of optional database fields in both prompt and env modes. - Updated tests to ensure correct behavior when optional database fields are provided. These changes improve the user experience and security of the PMM client installation process.
- Introduced environment variables for PMM agent configuration, allowing customization of the config file path, listen host, listen port, log file, and start timeout. - Implemented functions to ensure the PMM agent is running, handling both systemd and nohup startup methods. - Added checks to create the PMM agent config file if it does not exist, improving the robustness of the installation script. These changes enhance the installation process by ensuring the PMM agent is properly configured and running, especially in environments without systemd. Signed-off-by: theTibi <tkorocz@gmail.com>
- Updated the default lifetime of install tokens to 15 minutes for improved security, reflecting the short-lived nature of tokens used during the initial configuration. - Modified the `InstallClientPage` to include a countdown timer for token expiration, enhancing user awareness of token validity. - Added helper text to clarify the implications of token expiration and the need for regeneration. - Introduced a new utility function `formatExpiresIn` to format the remaining time of the token, improving the display of expiration information. - Updated tests to ensure correct functionality of the new token management features. These changes improve the security and usability of the PMM client installation process. Signed-off-by: theTibi <tkorocz@gmail.com>
- Added a new function `detect_node_hostname` to resolve the local node's hostname without relying on the `hostname` command, improving compatibility with minimal RHEL/UBI/Alpine images. - Updated service name assignments for MySQL, PostgreSQL, MongoDB, and Valkey to use the new hostname detection function, ensuring accurate service naming. These changes enhance the robustness of the PMM client installation script in diverse environments. Signed-off-by: theTibi <tkorocz@gmail.com>
- Refactored the `CreateNodeInstallToken` function to accept a technology parameter instead of a unique suffix, improving clarity and usability. - Implemented validation for technology input, ensuring it is not empty and normalizing casing and whitespace. - Updated tests to cover new validation logic and ensure correct behavior for various technology inputs, including error handling for invalid and empty cases. - Enhanced the `install_token.go` file to maintain consistency with the updated function signature and logic. These changes improve the robustness and reliability of the node installation token management process. Signed-off-by: theTibi <tkorocz@gmail.com>
- Clarified that the service token for PMM Client installation is generated with Grafana Admin role, enhancing security awareness. - Updated documentation to reflect the correct role and expiration details for generated tokens. - Modified the `CreateNodeInstallToken` function to ensure service accounts are created with Admin role, aligning with the updated security model. - Adjusted UI components to communicate the Admin role of generated tokens, reinforcing the importance of treating the token URL as a password. These changes improve the clarity and security of the PMM Client installation process. Signed-off-by: theTibi <tkorocz@gmail.com>
- Updated the `install-pmm-client.sh` script to clarify the behavior of the prompt mode, ensuring it correctly handles database credentials by prompting users when the script is run interactively. - Modified the UI components to reflect the new two-step command for the prompt mode, improving user guidance on how to execute the installation script. - Enhanced documentation to explain the differences between installation modes, particularly emphasizing the security benefits of using prompt mode for sensitive credentials. - Updated tests to validate the new command generation logic for prompt mode, ensuring that no sensitive information is exposed in the command output. These changes improve the security and usability of the PMM client installation process. Signed-off-by: theTibi <tkorocz@gmail.com>
…odes - Adjusted the default credentials mode in the UI from 'env' to 'prompt', aligning with the updated documentation that emphasizes the security benefits of prompting for database credentials. - Enhanced the installation documentation to clarify the differences between the credentials modes, particularly focusing on the two-step command for prompt mode. - Updated UI components to reflect the new default and provide clearer guidance on the available options for credential handling. These changes improve the usability and security of the PMM client installation process. Signed-off-by: theTibi <tkorocz@gmail.com>
mattiasimonato
left a comment
There was a problem hiding this comment.
After reviewing the frontend implementation, I have one small architectural note: the hook is colocated within the page/component, while the PMM codebase usually extracts hooks into separate modules. This is low priority and can be deferred, it does not need to block the dev preview
There was a problem hiding this comment.
Pull request overview
This PR adds a new “one-step” PMM Client installation flow by shipping an installer script from PMM Server, exposing a new UI page that generates install commands (with multiple credential-handling modes), and documenting the UI-driven workflow.
Changes:
- Added a new static installer script (
/pmm-static/install-pmm-client.sh) and Ansible packaging to ship it with PMM Server. - Added an “Install PMM Client” UI page + routing/navigation to generate install commands and mint short-lived install tokens via Grafana service accounts.
- Added documentation for the new UI-based one-step installation flow.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/apps/pmm/src/router.tsx | Adds a new route for the Install Client page. |
| ui/apps/pmm/src/pages/install-client/InstallClientPage.utils.ts | Builds server URL + install command strings for different credential modes. |
| ui/apps/pmm/src/pages/install-client/InstallClientPage.utils.test.ts | Adds unit tests for install command generation and token expiry formatting. |
| ui/apps/pmm/src/pages/install-client/InstallClientPage.tsx | New UI page to generate commands and mint short-lived tokens. |
| ui/apps/pmm/src/pages/install-client/index.ts | Barrel export for the new page. |
| ui/apps/pmm/src/contexts/navigation/navigation.constants.ts | Adds navigation entry under Inventory for Install PMM Client. |
| ui/apps/pmm/src/api/installToken.ts | New API helper to mint short-lived Grafana service-account tokens. |
| documentation/mkdocs-base.yml | Adds the new doc page to the MkDocs nav. |
| documentation/docs/install-pmm/install-pmm-client/one-step-ui-install.md | Documents the UI-driven one-step install flow and security notes. |
| build/ansible/roles/nginx/tasks/main.yml | Installs the installer script into the static content directory. |
| build/ansible/roles/nginx/files/install-pmm-client.sh | New installer script that installs pmm-client, configures the node, and adds a service. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@copilot adress my comments and fix them. |
Agent-Logs-Url: https://github.com/percona/pmm/sessions/171cec47-2b58-4382-a820-bbc69140fc34 Co-authored-by: fabio-silva <4190654+fabio-silva@users.noreply.github.com>
Agent-Logs-Url: https://github.com/percona/pmm/sessions/171cec47-2b58-4382-a820-bbc69140fc34 Co-authored-by: fabio-silva <4190654+fabio-silva@users.noreply.github.com>
Agent-Logs-Url: https://github.com/percona/pmm/sessions/171cec47-2b58-4382-a820-bbc69140fc34 Co-authored-by: fabio-silva <4190654+fabio-silva@users.noreply.github.com>
Addressed in separate commits as requested: |
|
@copilot just realized something:
|
Agent-Logs-Url: https://github.com/percona/pmm/sessions/583021bb-df4e-4016-8da7-3ddf0b35aa33 Co-authored-by: fabio-silva <4190654+fabio-silva@users.noreply.github.com>
Implemented in |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@copilot |
Agent-Logs-Url: https://github.com/percona/pmm/sessions/8a4da2e1-973b-4cc4-b28f-2293caa68d81 Co-authored-by: fabio-silva <4190654+fabio-silva@users.noreply.github.com>
Fixed in |
static directory
- Updated `install-pmm-client.sh` to include detailed descriptions for the `--force` and `--db-service-name` options, and added support for `--db-query-source`. - Improved documentation for the one-step installation process, clarifying the use of environment variables and advanced options. - Enhanced the Install Client UI to support MySQL query source selection and added a learn more section for better user guidance. - Updated utility functions to handle MySQL query sources and suggested service names based on user input. This update aims to streamline the installation process and improve user experience when configuring PMM clients. Signed-off-by: theTibi <tkorocz@gmail.com>
- Replaced the Alert component with a Box component for better styling control. - Updated typography colors for improved readability and consistency. - Enhanced the layout of the "Force re-register node" description for clarity. This change aims to improve the user interface and experience during the PMM client installation process. Signed-off-by: theTibi <tkorocz@gmail.com>
install-pmm-client.shfor streamlined installation of the PMM client.This update simplifies the PMM client installation process and improves user experience through the UI.
PMM-14993
Link to the Feature Build:
Percona-Lab/pmm-submodules#4330
If this PR adds, removes or alters one or more API endpoints, please review and update the relevant API documentation as well:
If this PR is related to other PRs, contributions, or ongoing work in this or other repositories, please reference them here: