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

Preserve state of wazuh-indexer service on upgrade #492

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

QU3B1M
Copy link
Member

@QU3B1M QU3B1M commented Oct 24, 2024

Description

Update wazuh-indexer pre, and post installation scripts to preserve the previous service status, maintaining consistency with the rest of Wazuh central components packages.

Related Issues

Resolves #487

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.


Testing evidence

Upgrade .deb package validation

  1. Upgrade with service running
    • Service is running before upgrade
      systemctl status wazuh-indexer
      ● wazuh-indexer.service - wazuh-indexer
           Loaded: loaded (/lib/systemd/system/wazuh-indexer.service; enabled; preset: enabled)
           Active: active (running) since Fri 2024-10-25 07:22:28 PDT; 7s ago
             Docs: https://documentation.wazuh.com
         Main PID: 4018 (java)
            Tasks: 72 (limit: 4571)
           Memory: 1.4G
              CPU: 14.054s
           CGroup: /system.slice/wazuh-indexer.service
                   └─4018 /usr/share/wazuh-indexer/jdk/bin/java -Xshare:auto -Dopensearch.networkaddress.cache.ttl=60 -Dope>
    • Upgrade wazuh-indexer
      dpkg -i wazuh-indexer_5.0.0-0_arm64_b2d1265.deb 
      (Reading database ... 151060 files and directories currently installed.)
      Preparing to unpack wazuh-indexer_5.0.0-0_arm64_da70239.deb ...
      Running Wazuh Indexer Pre-Installation Script
      Stop existing wazuh-indexer.service
      Unpacking wazuh-indexer (5.0.0-0) over (5.0.0-0) ...
      Setting up wazuh-indexer (5.0.0-0) ...
      Running Wazuh Indexer Post-Installation Script
      Restarting wazuh-indexer service...
    • Service is running after upgrade
      systemctl status wazuh-indexer
      ● wazuh-indexer.service - wazuh-indexer
           Loaded: loaded (/lib/systemd/system/wazuh-indexer.service; enabled; preset: enabled)
           Active: active (running) since Fri 2024-10-25 07:23:23 PDT; 7s ago
             Docs: https://documentation.wazuh.com
         Main PID: 4313 (java)
            Tasks: 73 (limit: 4571)
           Memory: 1.3G
              CPU: 13.464s
           CGroup: /system.slice/wazuh-indexer.service
                   └─4313 /usr/share/wazuh-indexer/jdk/bin/java -Xshare:auto -Dopensearch.networkaddress.cache.ttl=60 -Dope>
  2. Upgrade with service stopped
    • Service is stopped before upgrade
      systemctl status wazuh-indexer
      ○ wazuh-indexer.service - wazuh-indexer
           Loaded: loaded (/lib/systemd/system/wazuh-indexer.service; enabled; preset: enabled)
           Active: inactive (dead) since Fri 2024-10-25 07:25:05 PDT; 8s ago
         Duration: 1min 41.067s
             Docs: https://documentation.wazuh.com
          Process: 4313 ExecStart=/usr/share/wazuh-indexer/bin/systemd-entrypoint -p ${PID_DIR}/wazuh-indexer.pid --quiet (>
         Main PID: 4313 (code=exited, status=143)
              CPU: 16.562s
    • Upgrade wazuh-indexer
      (Reading database ... 151060 files and directories currently installed.)
      Preparing to unpack wazuh-indexer_5.0.0-0_arm64_da70239.deb ...
      Running Wazuh Indexer Pre-Installation Script
      Unpacking wazuh-indexer (5.0.0-0) over (5.0.0-0) ...
      Setting up wazuh-indexer (5.0.0-0) ...
      Running Wazuh Indexer Post-Installation Script
      ### NOT starting on installation, please execute the following statements to configure wazuh-indexer service to start automatically using systemd
       sudo systemctl daemon-reload
       sudo systemctl enable wazuh-indexer.service
      ### You can start wazuh-indexer service by executing
       sudo systemctl start wazuh-indexer.service
      
    • Service is stopped after upgrade
      systemctl status wazuh-indexer
      ○ wazuh-indexer.service - wazuh-indexer
           Loaded: loaded (/lib/systemd/system/wazuh-indexer.service; enabled; preset: enabled)
           Active: inactive (dead) since Fri 2024-10-25 07:25:05 PDT; 19s ago
         Duration: 1min 41.067s
             Docs: https://documentation.wazuh.com
         Main PID: 4313 (code=exited, status=143)
              CPU: 16.562s

Upgrade .rpm package validation

  1. Upgrade with service running
    • Service is running before upgrade
      systemctl status wazuh-indexer
      ● wazuh-indexer.service - wazuh-indexer
           Loaded: loaded (/usr/lib/systemd/system/wazuh-indexer.service; disabled; preset: disabled)
           Active: active (running) since Fri 2024-10-25 14:14:44 -03; 1min 4s ago
             Docs: https://documentation.wazuh.com
         Main PID: 38161 (java)
            Tasks: 69 (limit: 22569)
           Memory: 1.3G
              CPU: 15.619s
           CGroup: /system.slice/wazuh-indexer.service
                   └─38161 /usr/share/wazuh-indexer/jdk/bin/java -Xshare:auto -Dopensearch.networkaddress.cache.ttl=60 -Dop>
      
    • Upgrade wazuh-indexer
      rpm -i wazuh-indexer_5.0.0-0_aarch64_da70239.rpm --force 
      Stop existing wazuh-indexer.service
      Restarting wazuh-indexer service...
      
    • Service is running after upgrade
      ● wazuh-indexer.service - wazuh-indexer
           Loaded: loaded (/usr/lib/systemd/system/wazuh-indexer.service; disabled; preset: disabled)
           Active: active (running) since Fri 2024-10-25 14:31:53 -03; 14s ago
             Docs: https://documentation.wazuh.com
         Main PID: 38490 (java)
            Tasks: 72 (limit: 22569)
           Memory: 1.4G
              CPU: 13.157s
           CGroup: /system.slice/wazuh-indexer.service
                   └─38490 /usr/share/wazuh-indexer/jdk/bin/java -Xshare:auto -Dopensearch.networkaddress.cache.ttl=60 -Dop>
      
      
  2. Upgrade with service stopped
    • Service is stopped before upgrade
      systemctl status wazuh-indexer
      ○ wazuh-indexer.service - wazuh-indexer
           Loaded: loaded (/usr/lib/systemd/system/wazuh-indexer.service; disabled; preset: disabled)
           Active: inactive (dead)
             Docs: https://documentation.wazuh.com
    • Upgrade wazuh-indexer
      rpm -i wazuh-indexer_5.0.0-0_aarch64_da70239.rpm --force 
      ### NOT starting on installation, please execute the following statements to configure wazuh-indexer service to start automatically using systemd
       sudo systemctl daemon-reload
       sudo systemctl enable wazuh-indexer.service
      ### You can start wazuh-indexer service by executing
       sudo systemctl start wazuh-indexer.service
      
    • Service is stopped after upgrade
      systemctl status wazuh-indexer
      ○ wazuh-indexer.service - wazuh-indexer
           Loaded: loaded (/usr/lib/systemd/system/wazuh-indexer.service; disabled; preset: disabled)
           Active: inactive (dead)
             Docs: https://documentation.wazuh.com

@QU3B1M QU3B1M self-assigned this Oct 24, 2024
@QU3B1M QU3B1M requested a review from a team as a code owner October 24, 2024 15:39
@QU3B1M QU3B1M force-pushed the ci/487-preserve-status-of-service branch from 6dc22c9 to 35fc1e1 Compare October 24, 2024 20:03
@QU3B1M QU3B1M force-pushed the ci/487-preserve-status-of-service branch from 35fc1e1 to b2d1265 Compare October 24, 2024 20:51
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.

Preserve previous state of wazuh-indexer.service on upgrade
2 participants