wazuh / wazuh-agent

Wazuh agent, the Wazuh agent for endpoints.
GNU Affero General Public License v3.0
2 stars 1 forks source link

Define new repository layout design #6

Closed vikman90 closed 3 weeks ago

vikman90 commented 4 weeks ago

Description

In order to improve the structure and maintainability of the wazuh-agent repository, we need to define a new layout design. This will help in organizing the codebase more efficiently, making it easier for developers to navigate and contribute. The new layout should follow best practices and be aligned with the overall architecture of the Wazuh project.

Functional requirements

  1. Modular structure: The new layout should have a clear separation of concerns, organizing the code into well-defined modules.
  2. Scalability: The design should accommodate future growth, allowing for the addition of new features without major restructuring.
  3. Consistency: The layout should maintain consistency with other repositories in the Wazuh project to ensure uniformity.
  4. Documentation: Each module and significant component should include appropriate documentation to aid developers.
  5. Testing: The layout should facilitate testing, ensuring that unit tests, integration tests, and other automated tests are easy to implement and run.
  6. Build system integration: The new layout should integrate seamlessly with the existing build systems and CI/CD pipelines.

Implementation restrictions

  1. Adherence to standards: The design should comply with existing coding standards and guidelines used by the Wazuh project.
  2. Review and approval: The proposed layout must be reviewed and approved by the Agent development team before implementation begins.

Plan

  1. Research and Analysis:

    • Analyze the layouts of other successful open-source projects for best practices.
    • Gather input from the development team regarding pain points and suggestions.
  2. Design proposal:

    • Create a draft layout design, including directory structure and module organization.
    • Document the rationale behind the proposed design.
    • Share the proposal with the team for feedback and iteration.
  3. Review and approval:

    • Incorporate feedback from the team.
    • Present the revised design to the Agent development team for approval.
    • Address any concerns or suggestions raised during the review.
  4. Implementation:

    • Plan the migration to the new layout in stages to ensure minimal disruption.
    • Update the repository structure according to the approved design.

By following this plan, we aim to achieve a well-organized, scalable, and maintainable repository layout for wazuh-agent.

Related issues

Parent issue:

Related directory layout proposal:

vikman90 commented 3 weeks ago

Proposal

Directory layout (v1) ``` wazuh-agent/ ├── src/ │ ├── │ ├── CMakeLists.txt │ ├── vcpkg.json │ ├── dependencies/ ❓ │ ├── modules/ │ │ ├── agent/ │ │ │ ├── CMakeLists.txt │ │ │ ├── include/ │ │ │ │ └── [header files...] (include error_messages) │ │ │ ├── src/ │ │ │ │ └── [source files...] │ │ │ └── tests/ │ │ │ ├── CMakeLists.txt │ │ │ └── [test files...] │ │ ├── active_response/ (former os_execd + active_response) │ │ ├── agent_upgrade/ │ │ ├── aws/ │ │ ├── azure/ │ │ ├── docker/ │ │ ├── gcp/ │ │ ├── github/ │ │ ├── ms_graph/ │ │ ├── office365/ │ │ ├── logcollector/ │ │ ├── rootcheck/ │ │ ├── fim/ (former syscheck) │ │ ├── inventory/ (former syscollector) │ │ ├── sca/ │ │ └── [additional modules...] │ ├── common/ │ │ ├── data_provider/ │ │ ├── dbsync/ │ │ ├── rsync/ ❓ │ │ ├── os_crypto/ ❓ │ │ ├── os_net/ ❓ │ │ ├── os_regex/ ❓ │ │ ├── os_xml/ ❓ │ │ ├── os_zlib/ ❓ │ │ ├── shared/ (include headers) │ │ ├── utils/ (from shared_modules) │ │ ├── commonDefs.h (from shared_modules/common) │ │ └── [additional modules...] │ └── build/ │ └── [build output...] ├── ci/ ├── etc/ │ ├── config/ │ ├── selinux/ │ └── ruleset/ │ ├── sca/ │ └── rootcheck/ ├── packages/ ├── tools/ └── installers/ ├── unix/ (former init folder, including upgrade.sh and install.sh) └── win32/ ```

Source: https://github.com/wazuh/wazuh-agent/issues/1#issuecomment-2130262872

vikman90 commented 3 weeks ago

Requested changes

  1. tests/ should be a structure similar to what we discussed at https://github.com/wazuh/wazuh/issues/17427.
  2. Move everything inside /common/utils/ to subfolders in /common/.
  3. Delete /ci/, move what we need into the related component's test/ directory.
  4. Remove /tools/. Move bump-version.sh to the repository's root.
  5. Try to delete /installer/. At most, fit it into /packages/.
Directory layout (v2) ``` wazuh-agent/ ├── src/ │ ├── │ ├── CMakeLists.txt │ ├── vcpkg.json │ ├── dependencies/ ❓ │ ├── modules/ │ │ ├── agent/ │ │ │ ├── CMakeLists.txt │ │ │ ├── include/ │ │ │ │ └── [header files...] (include error_messages) │ │ │ ├── src/ │ │ │ │ └── [source files...] │ │ │ ├── component_A/ │ │ │ | ├── include/ │ │ │ │ │ └── [header files...] │ │ │ | ├── src/ │ │ │ │ │ └── [source files...] │ │ │ │ └── tests/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── unit/ │ │ │ │ ├── component/ │ │ │ │ └── benchmark/ │ │ │ └── tests/ │ │ │ ├── CMakeLists.txt │ │ │ ├── unit/ ❓ │ │ │ └── integration/ │ │ │ ├── features/ │ │ │ ├── steps/ │ │ │ └── environment.py │ │ │ │ │ ├── active_response/ (former os_execd + active_response) │ │ ├── agent_upgrade/ │ │ ├── aws/ │ │ │ ├── include/ │ │ │ │ └── [header files...] │ │ │ ├── src/ │ │ │ │ └── [source files...] │ │ │ ├── scripts/ │ │ │ │ └── [scripts...] │ │ │ └── tests/ │ │ │ └── [test files...] │ │ ├── azure/ │ │ ├── docker/ │ │ ├── gcp/ │ │ ├── github/ │ │ ├── ms_graph/ │ │ ├── office365/ │ │ ├── osquery/ │ │ ├── logcollector/ │ │ ├── rootcheck/ │ │ ├── fim/ (former syscheck) │ │ ├── inventory/ (former syscollector) │ │ ├── sca/ │ │ └── [additional modules...] │ ├── common/ │ │ ├── data_provider/ │ │ ├── dbsync/ │ │ ├── rsync/ ❓ │ │ ├── os_crypto/ ❓ │ │ ├── os_net/ ❓ │ │ ├── os_regex/ ❓ │ │ ├── os_xml/ ❓ │ │ ├── os_zlib/ ❓ │ │ └── [additional modules...] │ └── build/ │ └── [build output...] ├── etc/ │ ├── config/ │ ├── selinux/ │ └── ruleset/ │ ├── sca/ │ ├── rootcheck/ │ └── [additional modules...] ├── packages/ │ ├── installers/ │ │ ├── unix/ (former init folder, including upgrade.sh and install.sh) │ │ └── win32/ │ └── [packages...] └── bump-version.sh ```