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

Add necessary functions to allow upgrade using installation assistant #1771

Open
wants to merge 361 commits into
base: 4.4
Choose a base branch
from

Conversation

DFolchA
Copy link
Contributor

@DFolchA DFolchA commented Aug 5, 2022

Related issue
#862

Description

This PR adds new functions to the installation assistant to upgrade existing installations.

  • Added -up|--upgrade function
  • Added upgrade.sh file containing upgrade related functions.
    • Add function to check if the packages installed are upgradable
    • Add function to upgrade upgradable packages.
    • Add necessary error handling

Logs example

[root@centos repo]# bash ./wazuh-install.sh -up
05/08/2022 12:40:39 INFO: Starting Wazuh installation assistant. Wazuh version: 4.3.6
05/08/2022 12:40:39 INFO: Verbose logging redirected to /var/log/wazuh-install.log
05/08/2022 12:40:40 INFO: --- Upgrading existing Wazuh installation ---
05/08/2022 12:40:42 INFO: Upgrading Wazuh Manager to 4.3.6
05/08/2022 12:41:54 WARNING: Filebeat is already installed and is up to date.
05/08/2022 12:41:54 INFO: Upgrading Wazuh Indexer to 4.3.6
05/08/2022 12:43:51 INFO: Upgrading Wazuh Dashboard to 4.3.6

Tests

  • Centos 7
    • AIO
    • Distributed only Wazuh-server
    • Distributed only Wazuh-indexer
    • Distributed only Wazuh-dashboard
    • Wazuh-server already updated
    • Wazuh-indexer already updated
    • Wazuh-dashboard already updated
    • Possible update but not matching script version
  • Ubuntu 18
    • AIO
    • Distributed only Wazuh-server
    • Distributed only Wazuh-indexer
    • Distributed only Wazuh-dashboard
    • Wazuh-server already updated
    • Wazuh-indexer already updated
    • Wazuh-dashboard already updated
    • Possible update but not matching script version

@DFolchA DFolchA self-assigned this Aug 5, 2022
@DFolchA DFolchA linked an issue Aug 29, 2022 that may be closed by this pull request
Copy link
Contributor

@okynos okynos left a comment

Choose a reason for hiding this comment

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

Minor changes, THX.

Include a test battery definitions into the issue and include a proof of tests.

@DFolchA DFolchA force-pushed the 862-upgrade-installation-assistant branch from 0fbb5a7 to 405d0de Compare November 9, 2022 09:56
@DFolchA DFolchA changed the base branch from 4.3 to 4.4 November 9, 2022 09:57
Copy link
Contributor

@alberpilot alberpilot left a comment

Choose a reason for hiding this comment

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

  • Add a filebeat module version checker to upgrade the module if needed.
  • Additionally, this situation is not acceptable:
[root@ip-172-31-21-23 unattended_installer]# bash wazuh-install.sh -up
10/11/2022 15:08:40 INFO: Starting Wazuh installation assistant. Wazuh version: 4.4.0
10/11/2022 15:08:40 INFO: Verbose logging redirected to /var/log/wazuh-install.log
10/11/2022 15:08:42 INFO: --- Upgrading existing Wazuh installation ---
10/11/2022 15:08:49 WARNING: Wazuh manager can be upgraded but version does not match with the installation assistant version
10/11/2022 15:08:49 WARNING: Filebeat is already installed and is up to date.
10/11/2022 15:08:49 WARNING: Wazuh Indexer can be upgraded but version does not match with the installation assistant version
10/11/2022 15:08:49 INFO: Upgrading Wazuh Dashboard to 4.4.0

When more than one component is installed, you can't upgrade one and leave the other without the same version (excluding filebeat).

  • Message 10/11/2022 15:08:49 WARNING: Wazuh manager can be upgraded but version does not match with the installation assistant version needs to be 10/11/2022 15:08:49 WARNING: Wazuh manager can be upgraded but the version does not match the installation assistant version

@DFolchA DFolchA force-pushed the 862-upgrade-installation-assistant branch 4 times, most recently from 493b19c to 75c0471 Compare November 30, 2022 16:46
elif [ "${sys_type}" == "apt-get" ]; then
indexer_installed=$(apt list --installed 2>/dev/null | grep wazuh-indexer)
indexer_installed=$(apt list --installed 2>/dev/null | grep wazuh-indexer | cut -d' ' -f2 | sed -e "s/-.*//")
Copy link
Contributor

Choose a reason for hiding this comment

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

Two lines before you call command sed "s/-.*//g", without using argument -e. What is the reason for the inconsistency?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed c32120b

elif [ "${sys_type}" == "apt-get" ]; then
filebeat_installed=$(apt list --installed 2>/dev/null | grep filebeat)
filebeat_installed=$(apt list --installed 2>/dev/null | grep filebeat | cut -d' ' -f2 | sed -e "s/-.*//")
Copy link
Contributor

Choose a reason for hiding this comment

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

same

elif [ "${sys_type}" == "apt-get" ]; then
dashboard_installed=$(apt list --installed 2>/dev/null | grep wazuh-dashboard)
dashboard_installed=$(apt list --installed 2>/dev/null | grep wazuh-dashboard | cut -d' ' -f2 | sed -e "s/-.*//")
Copy link
Contributor

Choose a reason for hiding this comment

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

same

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed c32120b

Copy link
Contributor

@verdx verdx left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@alberpilot alberpilot left a comment

Choose a reason for hiding this comment

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

The pull request doesn't take into account the rolling upgrade for an Indexer cluster.

verdx and others added 30 commits February 7, 2023 16:38
Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
…er removal of the service on agent

Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
…ting docker containers

Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
* Initial version of the Offline installation action

* Improval of Offline installation action

* Finished workflow

* Fix workflow and filebeat installation

* Starting services manually in RPM test

* Action finished

* Added -I to checkFilebeatURL curls

* Added check_shards function to the Action

* Added -I to offline curls

* Improval of the offline test workflow

* General improvements of the Offline installation action

* Improval of the Offline installation workflow

* Added common_curl to offline-download
Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
…pull request is merged

Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
Signed-off-by: Miguel Verdaguer Velázquez <verdx@riseup.net>
Avoid installing `init.d` services when `init.d` is completely deprecated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add upgrade option to the unattended script