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 #4365

Merged
merged 23 commits into from
Aug 12, 2022

Conversation

yenienserrano
Copy link
Member

@yenienserrano yenienserrano commented Jul 29, 2022

Description:

The way to restart the manager/cluster was centralized in a service, since each view that had the option to restart the manager/cluster did it in a different way,
The delay of the /cluster/restart request was removed and the delay was added before the request to wait for all the nodes to synchronize.
Removed code that is no longer used

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 Management>Configuration>Edit configuration || Management>Status || Management>Rules||Decoders||CDB lists and edit file
  2. Click on "Restart cluster||Restart Manager" and wait for the modal to disappear
  3. Navigate to another route that uses some request for the API

Restart no complite

  1. Navigate to Management>Configuration>Edit configuration || Management>Status || Management>Rules||Decoders||CDB lists and edit file
  2. Click on "Restart cluster||Restart Manager".
  3. When you make the first attempt to remove the container from the manager
  4. Wait for all attempts, change the modal and redirect to healthcheck

Screenshot:

Updated screenshots in comments

restart.mp4

@yenienserrano yenienserrano linked an issue Jul 29, 2022 that may be closed by this pull request
@yenienserrano
Copy link
Member Author

Added a modal so that the user cannot navigate during Wazuh restart

restart.mp4

@Mayons95 Mayons95 self-requested a review August 3, 2022 10:48
@Mayons95

This comment was marked as outdated.

Copy link
Contributor

@Mayons95 Mayons95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test OK

@yenienserrano yenienserrano marked this pull request as ready for review August 3, 2022 11:21
@AlexRuiz7 AlexRuiz7 marked this pull request as draft August 4, 2022 14:07
@AlexRuiz7 AlexRuiz7 requested a review from Mayons95 August 8, 2022 14:30
@yenienserrano
Copy link
Member Author

Modal sync:
Sync

Modal error
error

Modal attempt
attempt

Restart:

restart.mp4

Not restart:

norestart.mp4

Copy link
Member

@asteriscos asteriscos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: ✔️
Test: ✔️

Peek 2022-08-12 11-36

@asteriscos
Copy link
Member

Worker restarting error are properly handled ✔️

image

@github-actions
Copy link
Contributor

Jest Test Coverage % values
Statements 6.91% ( 2525 / 36525 )
Branches 2.74% ( 773 / 28247 )
Functions 4.59% ( 410 / 8941 )
Lines 6.99% ( 2444 / 34943 )

@chantal-kelm chantal-kelm requested review from chantal-kelm and removed request for Mayons95 August 12, 2022 17:20
@chantal-kelm chantal-kelm merged commit 6598df9 into 4.3-7.10 Aug 12, 2022
@chantal-kelm chantal-kelm deleted the fix/4277-service-to-restart-wazuh branch August 12, 2022 17:21
@github-actions
Copy link
Contributor

The backport to 4.3-7.16 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-4.3-7.16 4.3-7.16
# Navigate to the new working tree
cd .worktrees/backport-4.3-7.16
# Create a new branch
git switch --create backport-4365-to-4.3-7.16
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 6598df94983af1117e3c9bb04f9e2045ca348f0a
# Push it to GitHub
git push --set-upstream origin backport-4365-to-4.3-7.16
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-4.3-7.16

Then, create a pull request where the base branch is 4.3-7.16 and the compare/head branch is backport-4365-to-4.3-7.16.

github-actions bot pushed a commit that referenced this pull request Aug 12, 2022
* 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 <[email protected]>
Co-authored-by: Federico Rodriguez <[email protected]>
Co-authored-by: chantal.kelm <[email protected]>
(cherry picked from commit 6598df9)
chantal-kelm added a commit that referenced this pull request Aug 12, 2022
* 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 <[email protected]>
Co-authored-by: Federico Rodriguez <[email protected]>
Co-authored-by: chantal.kelm <[email protected]>
(cherry picked from commit 6598df9)

* Updated Changelog

Co-authored-by: Ian Yenien Serrano <[email protected]>
Co-authored-by: Chantal Belén kelm <[email protected]>
yenienserrano added a commit that referenced this pull request Aug 22, 2022
asteriscos pushed a commit that referenced this pull request Aug 22, 2022
Revert "Create service to restart wazuh (#4365)"

This reverts commit 6598df9.
yenienserrano added a commit that referenced this pull request Aug 24, 2022
* 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 <[email protected]>
Co-authored-by: Federico Rodriguez <[email protected]>
Co-authored-by: chantal.kelm <[email protected]>
(cherry picked from commit 6598df9)
yenienserrano added a commit that referenced this pull request Sep 2, 2022
* 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 <[email protected]>
Co-authored-by: Federico Rodriguez <[email protected]>
Co-authored-by: chantal.kelm <[email protected]>
(cherry picked from commit 6598df9)
yenienserrano added a commit that referenced this pull request Sep 6, 2022
* 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 <[email protected]>
Co-authored-by: Federico Rodriguez <[email protected]>
Co-authored-by: chantal.kelm <[email protected]>
(cherry picked from commit 6598df9)

* Updated Changelog

Co-authored-by: Ian Yenien Serrano <[email protected]>
Co-authored-by: Chantal Belén kelm <[email protected]>
yenienserrano added a commit that referenced this pull request Sep 6, 2022
* 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 <[email protected]>
Co-authored-by: Federico Rodriguez <[email protected]>
Co-authored-by: chantal.kelm <[email protected]>
(cherry picked from commit 6598df9)
yenienserrano added a commit that referenced this pull request Sep 6, 2022
* 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 <[email protected]>
Co-authored-by: Federico Rodriguez <[email protected]>
Co-authored-by: chantal.kelm <[email protected]>
(cherry picked from commit 6598df9)
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
6 participants