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

Create service to restart wazuh #4433

Closed
wants to merge 72 commits into from
Closed

Conversation

yenienserrano
Copy link
Member

@yenienserrano yenienserrano commented Sep 1, 2022

Description:

The way to restart the manager or cluster was centralized in a service since each view that had the option to restart did it differently.

In order to allow the cluster to synchronize ruleset changes, a delay was applied before restarting Wazuh. This delay has been removed as it's been replaced by a polling system, so it's no longer required. The app will ping the Wazuh API and wait until it's back up again. If this does not happen, the app will show an error message, as the API did not come back online.

Due to the changes of this development, code has been removed as it was no longer used.

PR above with more information (a revert was made):

Issue:

Test:

To test it you have to go to any page that has the restart option and try doing the restart, when it tells you that it has restarted try navigating between pages that make requests to the API.

Successful restart

  1. Navigate to one of the following sections:
  • Management > Configuration > Edit configuration
  • Management > Status
  • Management > Rules and edit file
  • Management > Decoders and edit file
  • Management > CDB lists and edit file
  1. Click on the restart button and wait until it's done.
  2. Navigate to another route that uses some request for the API, and check that no error is thrown.

Restart failure

  1. Navigate to one of the following sections:
  • Management > Configuration > Edit configuration
  • Management > Status
  • Management > Rules and edit file
  • Management > Decoders and edit file
  • Management > CDB lists and edit file
  1. Click on the restart button and wait until it's done.
  2. Once the first polling cycle is done, disconnect the manager from the app (in Docker, stop the container).
  3. Wait until the modal changes state, showing that the restart has failed. A button to redirect to the Healthcheck must also appear. Check this button works properly.

Screenshot:

Ongoing restart:

image

Successfully restarted:

image

Restart error:

image

Cluster synchronization:

image

Cluster synchronization error:

image

yenienserrano and others added 15 commits August 12, 2022 17:22
* file to be added with the restart functions

* restart calls were changed to service calls

* the restarting on time sign appears

* modal while restarting added

* countDown change of location

* cleaning

* modal redesign

* model and code update

* modified delays and designs

* change text Synchronizing cluster

* Update restart-cluster-manager-callout.tsx

* Code improvements

* suggestions implemented

* polling sync add

* Code improvements

* add endpoint

* add comment

* add close button

* suggestions implemented

* add modal wazuh restarted

* delete unnecessary toast

* Set clearState on restart error

* disabled unneeded console.log

Co-authored-by: Alex Ruiz Becerra <alejandro.ruiz.becerra@wazuh.com>
Co-authored-by: Federico Rodriguez <federico.rodriguez@wazuh.com>
Co-authored-by: chantal.kelm <chantal.belen.kelm@gmail.com>
(cherry picked from commit 6598df9)
* Create service to restart wazuh (#4365)

* file to be added with the restart functions

* restart calls were changed to service calls

* the restarting on time sign appears

* modal while restarting added

* countDown change of location

* cleaning

* modal redesign

* model and code update

* modified delays and designs

* change text Synchronizing cluster

* Update restart-cluster-manager-callout.tsx

* Code improvements

* suggestions implemented

* polling sync add

* Code improvements

* add endpoint

* add comment

* add close button

* suggestions implemented

* add modal wazuh restarted

* delete unnecessary toast

* Set clearState on restart error

* disabled unneeded console.log

Co-authored-by: Alex Ruiz Becerra <alejandro.ruiz.becerra@wazuh.com>
Co-authored-by: Federico Rodriguez <federico.rodriguez@wazuh.com>
Co-authored-by: chantal.kelm <chantal.belen.kelm@gmail.com>
(cherry picked from commit 6598df9)

* Updated Changelog

Co-authored-by: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com>
Co-authored-by: Chantal Belén kelm <99441266+chantal-kelm@users.noreply.github.com>
* fix: Fixed a routes loop when reinstalling Wazuh indexer

* fix: replaced the display error in the plugin loop

* changelog: add PR entry

* fix import variable

Co-authored-by: Matias Ezequiel Moreno <matiasmoreno876@gmail.com>
…4401)

Moved the file config-equivalences to common (#4399)

* common/config-equivalences

* add changelog

(cherry picked from commit a40a2ae)

Co-authored-by: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com>
Signed-off-by: yenienserrano <ian.serrano@wazuh.com>
@yenienserrano yenienserrano self-assigned this Sep 1, 2022
@yenienserrano yenienserrano linked an issue Sep 1, 2022 that may be closed by this pull request
AlexRuiz7 and others added 13 commits September 1, 2022 13:14
* file to be added with the restart functions

* restart calls were changed to service calls

* the restarting on time sign appears

* modal while restarting added

* countDown change of location

* cleaning

* modal redesign

* model and code update

* modified delays and designs

* change text Synchronizing cluster

* Update restart-cluster-manager-callout.tsx

* Code improvements

* suggestions implemented

* polling sync add

* Code improvements

* add endpoint

* add comment

* add close button

* suggestions implemented

* add modal wazuh restarted

* delete unnecessary toast

* Set clearState on restart error

* disabled unneeded console.log

Co-authored-by: Alex Ruiz Becerra <alejandro.ruiz.becerra@wazuh.com>
Co-authored-by: Federico Rodriguez <federico.rodriguez@wazuh.com>
Co-authored-by: chantal.kelm <chantal.belen.kelm@gmail.com>
(cherry picked from commit 6598df9)
Signed-off-by: yenienserrano <ian.serrano@wazuh.com>
* Use POST method when requesting the API login endpoint

* changelog: add PR entry

Co-authored-by: Matias Ezequiel Moreno <matiasmoreno876@gmail.com>
Co-authored-by: Álex <alex-r-b@hotmail.com>
Co-authored-by: Antonio David Gutiérrez <antonio.gutierrez@wazuh.com>
(cherry picked from commit 3977e45)

Co-authored-by: Manuel Carmona Pérez <manuelvillarcarmona@gmail.com>
…rvice config (#4322)

Added new key request block in Registration service config (#3956)

* Added new key request block

* Removed failed snapshots

* Updated some test snapshots

* Updated descriptions registration-service

(cherry picked from commit 2b6ecf3)

Co-authored-by: Maximiliano Ibarra <maximilianoaibarra@gmail.com>
AlexRuiz7 and others added 14 commits September 6, 2022 09:26
* Use POST method when requesting the API login endpoint

* changelog: add PR entry

Co-authored-by: Matias Ezequiel Moreno <matiasmoreno876@gmail.com>
Co-authored-by: Álex <alex-r-b@hotmail.com>
Co-authored-by: Antonio David Gutiérrez <antonio.gutierrez@wazuh.com>
(cherry picked from commit 3977e45)

Co-authored-by: Manuel Carmona Pérez <manuelvillarcarmona@gmail.com>
…rvice config (#4322)

Added new key request block in Registration service config (#3956)

* Added new key request block

* Removed failed snapshots

* Updated some test snapshots

* Updated descriptions registration-service

(cherry picked from commit 2b6ecf3)

Co-authored-by: Maximiliano Ibarra <maximilianoaibarra@gmail.com>
Sorting by agents in the table groups (#4323)

* Added sortable by agent count option to the groups table

* Added changelog entry

Co-authored-by: Álex <alejandro.ruiz.becerra@wazuh.com>
(cherry picked from commit 9079f07)

Co-authored-by: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com>
* file to be added with the restart functions

* restart calls were changed to service calls

* the restarting on time sign appears

* modal while restarting added

* countDown change of location

* cleaning

* modal redesign

* model and code update

* modified delays and designs

* change text Synchronizing cluster

* Update restart-cluster-manager-callout.tsx

* Code improvements

* suggestions implemented

* polling sync add

* Code improvements

* add endpoint

* add comment

* add close button

* suggestions implemented

* add modal wazuh restarted

* delete unnecessary toast

* Set clearState on restart error

* disabled unneeded console.log

Co-authored-by: Alex Ruiz Becerra <alejandro.ruiz.becerra@wazuh.com>
Co-authored-by: Federico Rodriguez <federico.rodriguez@wazuh.com>
Co-authored-by: chantal.kelm <chantal.belen.kelm@gmail.com>
(cherry picked from commit 6598df9)
Signed-off-by: yenienserrano <ian.serrano@wazuh.com>
@AlexRuiz7
Copy link
Member

We need to review this PR to check it includes only the work related to this issue. @yenienserrano

@AlexRuiz7 AlexRuiz7 changed the base branch from 4.4-2.3-wzd to 4.5-2.3-wzd November 17, 2022 17:20
@AlexRuiz7 AlexRuiz7 closed this Dec 14, 2022
@AlexRuiz7 AlexRuiz7 deleted the backport-4365-to-4.3-1.2-wzd branch December 14, 2022 10:13
@AlexRuiz7
Copy link
Member

Branch renamed: 4277-centralized-restart-service-4.3-1.2-wzd
New pull request required

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.

Centralized service to restart Wazuh
5 participants