Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPIKE - Installation assistant #150

Open
teddytpc1 opened this issue Nov 29, 2024 · 2 comments
Open

SPIKE - Installation assistant #150

teddytpc1 opened this issue Nov 29, 2024 · 2 comments
Assignees
Labels
level/task Task issue type/enhancement Enhancement issue

Comments

@teddytpc1
Copy link
Member

teddytpc1 commented Nov 29, 2024

Objective
https://github.com/wazuh/internal-devel-requests/issues/1319

Description

As part of the DevOps overhaul objective, we need to research, analyze alternatives, and design how to implement the following changes:

  1. Simplification:

    • The installation assistant must be streamlined.
    • Remove the offline installation option from the script.
    • Eliminate additional configuration options to reduce complexity.
  2. Package Usage:

    • Transition to using Wazuh packages instead of package repositories.
  3. Configuration Standardization:

    • Utilize out-of-the-box Wazuh configurations for installations.
  4. Requirements Validation:

    • Add a validation step to ensure minimum requirements are met before proceeding with the installation.
  5. Tool Optimization:

    • Leverage well-known tools to improve reliability and maintainability.
    • Avoid using additional dependencies to the ones required by Wazuh.
  6. Testing Improvements:

    • Enhance the DevOps-owned testing for the installation assistant.
    • The GH Workflows must allow testing with Production, pre-release, and development packages.

Implementation restrictions

  • Testing Environment:
    • Tests must be implemented using GitHub Actions (GHA).
  • Compatibility:
    • Ensure compatibility with supported operating systems and environments.
  • Minimal Maintenance:
    • Focus on reducing complexity and ensuring the script is easy to maintain.

Plan

  1. Research & Analysis:

    • Review the current installation assistant to identify areas of complexity.
    • Analyze the impact of removing offline installation and additional configuration options.
  2. Simplification:

    • Remove the offline installation option from the script.
    • Eliminate unnecessary configuration options to streamline the process.
  3. Package & Configuration Updates:

    • Modify the script to use Wazuh packages instead of package repositories.
    • Ensure out-of-the-box configurations are implemented throughout the installation process.
  4. Requirements Validation:

    • Add pre-installation checks to validate system requirements.
    • Notify users if minimum requirements are not met and provide guidance.
  5. Tool Integration:

    • Replace custom implementations with well-known tools where applicable.
    • Document the reasons for tool selection and usage.
  6. Testing Enhancements:

    • Create comprehensive GHA workflows to test the installation assistant.
    • Include tests for package installation, configuration application, and requirements validation.
  7. Documentation Updates:

    • Update the installation assistant documentation to reflect the new process.
    • Simplify instructions and focus on the prerequisites for using the script.
  8. Validation & Feedback:

    • Test the updated installation assistant across various environments.
    • Collect feedback from stakeholders and users to ensure alignment with expectations.
@teddytpc1 teddytpc1 added level/task Task issue type/enhancement Enhancement issue labels Nov 29, 2024
@wazuhci wazuhci moved this to Backlog in Release 5.0.0 Nov 29, 2024
@wazuhci wazuhci moved this from Backlog to In progress in Release 5.0.0 Dec 30, 2024
@Enaraque
Copy link
Member

Update report

The different parts of the code have been reviewed to assess the feasibility of using Python as the programming language, particularly concerning the external dependencies it may require. This investigation is tentative for now, as the installation assistant for version 5.0.0 will differ significantly from what we currently know. Therefore, to conduct an investigation that allows us to determine if Python is the right language and whether implementation will not encounter too many external dependencies, it will be divided into three parts:

  • Core Code: This is the most relevant part of the investigation. It represents the code that is most likely to remain in the implementation, in other words, the code that is most likely to be part of the new implementation in Python.
  • Adaptable Code: This includes probable code to be implemented but might undergo changes in the Python implementation or due to future decisions.
  • Deprecated Code: This consists of code likely to be removed from the installation assistant.

This division in the investigation reflects the priority of the different parts, with the Core Code being the most critical for decision-making and the Deprecated Code being the least significant.

@Enaraque
Copy link
Member

Enaraque commented Jan 7, 2025

Dependencies of the Installation Assistant

Types of Dependencies

The installation assistant has two types of dependencies:

  1. Libraries required for the proper functioning of Wazuh: These libraries are not tied to the installation assistant's code but to Wazuh's main components, so they do not impact this investigation.

These libraries are:

Components Libraries
Wazuh Indexer - apt: debconf, adduser, procps
- yum: coreutils
Wazuh Manager - apt: gnupg, apt-transport-https
Wazuh Dashboard - apt: debhelper, tar, curl, libcap2-bin,
- yum: libcap
  1. Libraries used by the code: These are libraries necessary for the execution of the installation assistant's code. They may or may not be required for Wazuh's proper functioning. These are the ones analyzed in this investigation.
Library Description Python Library Native in Python Minimum Python Version
grep Text search utility re Yes 🟢 1.x
tar Archive compression/decompression tool tarfile Yes 🟢 2.3
coreutils Basic system utilities os, pathlib Yes 🟢 3.4 (pathlib)
procps-ng Used to manage processes (e.g., kill) os, signal Yes 🟢 1.x
gawk Text processing utility re Yes 1.x
curl Data transfer utility requests, urllib Requests: No 🔴, urllib: Yes 🟢 3.0 (urllib)

Minimum Python version to use

Most of the libraries to be used have been part of Python for quite some time. However, the minimum version required, for now, would be 3.4, as pathlib is included starting from this version.

Important

It is also important to note that elements such as dataclasses (>=3.7), f-strings (>=3.6), or Enums (>=3.4) can be used in the code logic. Therefore, a definitive minimum Python version to use has not yet been established.

Conclusion

After completing the investigation, it can be concluded that all dependencies of the installation assistant are native to Python, so no additional dependencies need to be installed for its proper functioning.

Note

The most commonly used library for making HTTP requests in Python is requests. However, it is not necessary to install it because urllib is a native Python library and can be used for the same purpose. Still, if more complex HTTP requests are required in the future, the possibility of needing to install requests should not be ruled out.

Disclaimer

As shown, there are currently no external libraries required in the installation assistant's code. However, this does not mean that external libraries won't need to be added as the code evolves, such as the use of Pydantic, among others.

@wazuhci wazuhci moved this from In progress to Blocked in Release 5.0.0 Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level/task Task issue type/enhancement Enhancement issue
Projects
Status: Blocked
Development

No branches or pull requests

2 participants