From c1d55a1e6a62fd02d5137e7aa1d5a6dea79a4a86 Mon Sep 17 00:00:00 2001 From: Ian Yenien Serrano Date: Fri, 31 May 2024 15:02:20 +0200 Subject: [PATCH 1/5] Add documentation for Wazuh dashboard Packages generation --- .../packaging/generate-dashboard-package.rst | 186 ++++++++++++++++++ source/development/packaging/index.rst | 1 + 2 files changed, 187 insertions(+) create mode 100644 source/development/packaging/generate-dashboard-package.rst diff --git a/source/development/packaging/generate-dashboard-package.rst b/source/development/packaging/generate-dashboard-package.rst new file mode 100644 index 0000000000..0dafa61a53 --- /dev/null +++ b/source/development/packaging/generate-dashboard-package.rst @@ -0,0 +1,186 @@ +=============== +Wazuh Dashboard +=============== + +The packages' generation process is orchestrated by one script, which is +found within the ``dev-tools/build-packages/build-packages.sh`` folder of the repository: + +- ``build-packages.sh``: This script is responsible for bundling plugins into 1 single application in tar, rpm and/or deb distributions. With the parameters ``version``, ``revision``, ``distribution``, package of ``wazuh-dashboard``, ``wazuh-dashboard-plugins`` and ``wazuh-security-dashboards-plugin``. + +Official packages are built through a GitHub Actions pipeline, however, +the process is designed to be independent enough for maximum +portability. The building process is self-contained in the application +code. + +Build manually +^^^^^^^^^^^^^^ + +1. To use the scrip you first need to generate the packages from the repositories: + +- ``wazuh-dashboard`` +- ``wazuh-security-dashboards-plugin`` +- ``wazuh-dashboard-plugins`` + +To do so, follow these steps: + + 1.1. Clone the Wazuh Dashboard repository and build the application. + + .. code:: console + + # git clone -b https://www.github.com/wazuh/wazuh-dashboard.git + # cd wazuh-dashboard/ + # yarn osd bootstrap + # yarn build --linux --skip-os-packages --release + + 1.2. Clone the Wazuh Security Dashboards Plugin and build the plugin. + + .. code:: console + + # cd plugins/ + # git clone -b https://www.github.com/wazuh/wazuh-security-dashboards-plugin.git + # cd wazuh-security-dashboards-plugin/ + # yarn + # yarn build + + 1.3. Clone the Wazuh Dashboard Plugins repository and build the plugins. + + .. code:: console + + # cd ../ + # git clone -b https://www.github.com/wazuh/wazuh-dashboard-plugins.git + # cd wazuh-dashboard-plugins/ + # cp -r plugins/* ../ + # cd ../main + # yarn + # yarn build + # cd ../wazuh-core/ + # yarn + # yarn build + # cd ../wazuh-check-updates/ + # yarn + # yarn build + + 1.4. Zip the packages and move them to the packages folder + + .. code:: console + + # cd ../../../ + # mkdir packages + # cd packages + # zip -r -j ./dashboard-package.zip ../wazuh-dashboard/target/opensearch-dashboards--linux-x64.tar.gz + # zip -r -j ./security-package.zip ../wazuh-dashboard/plugins/wazuh-security-dashboards-plugin/build/security-dashboards-.0.zip + # zip -r -j ./wazuh-package.zip ../wazuh-dashboard/plugins/wazuh-check-updates/build/wazuhCheckUpdates-.zip ../wazuh-dashboard/plugins/main/build/wazuh-.zip ../wazuh-dashboard/plugins/wazuh-core/build/wazuhCore-.zip + +At this point you must have 3 packages in the packages folder: + +- ``dashboard-package.zip`` +- ``security-package.zip`` +- ``wazuh-package.zip`` + +2. Generate the final packages, by running the script ``build-packages.sh`` in the ``dev-tools/build-packages/`` folder of the repository. +The script requires the following parameters: + +- ``-v``: Version of the package. +- ``-r``: Revision of the package. +- ``--deb`` or ``--rpm``: Distribution of the package. +- ``-a``: Path to the ``wazuh-package.zip``. +- ``-s``: Path to the ``security-package.zip``. +- ``-b``: Path to the ``dashboard-package.zip``. + +.. code:: console + + # cd ../wazuh-dashboard/dev-tools/build-packages/ + # ./build-packages.sh -v -r -a -s -b + +The package will be generated in the ``output`` folder of the same directory where the script is located. + + +Build with Docker image +^^^^^^^^^^^^^^^^^^^^^^^ + +With this option you can create an image that has the package in tar.gz format +and then if desired you can use the created package to generate the .deb or .rpm file. + +1. Clone the Wazuh Dashboard repository. + +.. code:: console + + # git clone -b https://www.github.com/wazuh/wazuh-dashboard.git + # cd wazuh-dashboard/dev-tools/build-packages/ + +2. Build the Docker image with the following parameters: + +- ``NODE_VERSION``: Node version to use in the ``.nvmrc`` file. +- ``WAZUH_DASHBOARDS_BRANCH``: Branch of the Wazuh Dashboards repository. +- ``WAZUH_DASHBOARDS_PLUGINS``: Branch of the Wazuh Dashboards Plugins repository. +- ``WAZUH_SECURITY_DASHBOARDS_PLUGIN_BRANCH``: Branch of the Wazuh Security Dashboards Plugin repository. +- ``OPENSEARCH_DASHBOARDS_VERSION``: Version of the OpenSearch Dashboards(you can find the version in the package.json file of the Wazuh Dashboards repository) +- ``-t``: Tag of the image. + +.. code:: console + + # docker build \ + # --build-arg NODE_VERSION= \ + # --build-arg WAZUH_DASHBOARDS_BRANCH= \ + # --build-arg WAZUH_DASHBOARDS_PLUGINS= \ + # --build-arg WAZUH_SECURITY_DASHBOARDS_PLUGIN_BRANCH= \ + # --build-arg OPENSEARCH_DASHBOARDS_VERSION= \ + # -t \ + # -f wazuh-dashboard.Dockerfile . + +Example: + +.. code:: console + + # docker build \ + # --build-arg NODE_VERSION=18.19.0 \ + # --build-arg WAZUH_DASHBOARDS_BRANCH=4.9.0 \ + # --build-arg WAZUH_DASHBOARDS_PLUGINS=4.9.0 \ + # --build-arg WAZUH_SECURITY_DASHBOARDS_PLUGIN_BRANCH=4.9.0 \ + # --build-arg OPENSEARCH_DASHBOARDS_VERSION=2.13.0 \ + # -t wzd:4.9.0 \ + # -f wazuh-dashboard.Dockerfile . + +3. Run the Docker image: + +.. code:: console + + # docker run -d --rm --name wazuh-dashboard-package tail -f /dev/null + +Example: + +.. code:: console + + # docker run -d --rm --name wazuh-dashboard-package wzd:4.9.0 tail -f /dev/null + +4. Copy the package to the host: + +.. code:: console + + # docker cp wazuh-dashboard-package:/home/node/packages/. + +Example: + +.. code:: console + + # docker cp wazuh-dashboard-package:/home/node/packages/. / + +This copies the final package and the packages that were used to generate the final package. + +5 (Optional). If you want to generate the .deb or .rpm file, you can use the script ``launcher.sh`` in the ``dev-tools/build-packages/(rpm or deb)/`` folder of the repository with the following parameters: + +- ``-v``: Version of the package. +- ``-r``: Revision of the package. +- ``-p``: Path to the package in tar.gz format generated in the previous step + +.. code:: console + + # ./launcher.sh -v -r -p + +Example: + +.. code:: console + + # ./launcher.sh -v 4.9.0 -r 1 -p file:///wazuh-dashboard-4.9.0-1-linux-x64.tar.gz + +The package will be generated in the ``output`` folder of the ``rpm`` or ``deb`` folder. \ No newline at end of file diff --git a/source/development/packaging/index.rst b/source/development/packaging/index.rst index cca09b60cf..a645e8552c 100644 --- a/source/development/packaging/index.rst +++ b/source/development/packaging/index.rst @@ -24,3 +24,4 @@ This section will show you how to generate your own Wazuh packages for different generate-ova generate-windows-package generate-wpk-package + generate-dashboard-package \ No newline at end of file From e04e0083fd3efee3b22d3b54e24606003186268c Mon Sep 17 00:00:00 2001 From: Ian Yenien Serrano Date: Fri, 31 May 2024 16:56:37 +0200 Subject: [PATCH 2/5] Remove www. to git clone --- .../development/packaging/generate-dashboard-package.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/development/packaging/generate-dashboard-package.rst b/source/development/packaging/generate-dashboard-package.rst index 0dafa61a53..cae9e5c66b 100644 --- a/source/development/packaging/generate-dashboard-package.rst +++ b/source/development/packaging/generate-dashboard-package.rst @@ -27,7 +27,7 @@ To do so, follow these steps: .. code:: console - # git clone -b https://www.github.com/wazuh/wazuh-dashboard.git + # git clone -b https://github.com/wazuh/wazuh-dashboard.git # cd wazuh-dashboard/ # yarn osd bootstrap # yarn build --linux --skip-os-packages --release @@ -37,7 +37,7 @@ To do so, follow these steps: .. code:: console # cd plugins/ - # git clone -b https://www.github.com/wazuh/wazuh-security-dashboards-plugin.git + # git clone -b https://github.com/wazuh/wazuh-security-dashboards-plugin.git # cd wazuh-security-dashboards-plugin/ # yarn # yarn build @@ -47,7 +47,7 @@ To do so, follow these steps: .. code:: console # cd ../ - # git clone -b https://www.github.com/wazuh/wazuh-dashboard-plugins.git + # git clone -b https://github.com/wazuh/wazuh-dashboard-plugins.git # cd wazuh-dashboard-plugins/ # cp -r plugins/* ../ # cd ../main @@ -105,7 +105,7 @@ and then if desired you can use the created package to generate the .deb or .rpm .. code:: console - # git clone -b https://www.github.com/wazuh/wazuh-dashboard.git + # git clone -b https://github.com/wazuh/wazuh-dashboard.git # cd wazuh-dashboard/dev-tools/build-packages/ 2. Build the Docker image with the following parameters: From ecd55373f7c9fad2d26aed42d2b7a296fd0d599a Mon Sep 17 00:00:00 2001 From: Ian Yenien Serrano Date: Mon, 3 Jun 2024 18:26:31 +0200 Subject: [PATCH 3/5] Fix comments --- .../packaging/generate-dashboard-package.rst | 91 +++++++++++++++++-- 1 file changed, 81 insertions(+), 10 deletions(-) diff --git a/source/development/packaging/generate-dashboard-package.rst b/source/development/packaging/generate-dashboard-package.rst index cae9e5c66b..3a37e19199 100644 --- a/source/development/packaging/generate-dashboard-package.rst +++ b/source/development/packaging/generate-dashboard-package.rst @@ -2,7 +2,7 @@ Wazuh Dashboard =============== -The packages' generation process is orchestrated by one script, which is +The packages generation process is orchestrated by one script, which is found within the ``dev-tools/build-packages/build-packages.sh`` folder of the repository: - ``build-packages.sh``: This script is responsible for bundling plugins into 1 single application in tar, rpm and/or deb distributions. With the parameters ``version``, ``revision``, ``distribution``, package of ``wazuh-dashboard``, ``wazuh-dashboard-plugins`` and ``wazuh-security-dashboards-plugin``. @@ -15,7 +15,7 @@ code. Build manually ^^^^^^^^^^^^^^ -1. To use the scrip you first need to generate the packages from the repositories: +1. To use the script you first need to generate the packages from the repositories: - ``wazuh-dashboard`` - ``wazuh-security-dashboards-plugin`` @@ -27,27 +27,70 @@ To do so, follow these steps: .. code:: console - # git clone -b https://github.com/wazuh/wazuh-dashboard.git + # git clone -b https://github.com/wazuh/wazuh-dashboard.git # cd wazuh-dashboard/ # yarn osd bootstrap # yarn build --linux --skip-os-packages --release - 1.2. Clone the Wazuh Security Dashboards Plugin and build the plugin. + Example: + + .. code:: console + + # git clone -b 4.9.0 https://github.com/wazuh/wazuh-dashboard.git + # cd wazuh-dashboard/ + # yarn osd bootstrap + # yarn build --linux --skip-os-packages --release + + 1.2. Clone the Wazuh Security Dashboards Plugin in the plugins folder and build the plugin. + + .. code:: console + + # cd plugins/ + # git clone -b https://github.com/wazuh/wazuh-security-dashboards-plugin.git + # cd wazuh-security-dashboards-plugin/ + # yarn + # yarn build + + Example: .. code:: console # cd plugins/ - # git clone -b https://github.com/wazuh/wazuh-security-dashboards-plugin.git + # git clone -b 4.9.0 https://github.com/wazuh/wazuh-security-dashboards-plugin.git # cd wazuh-security-dashboards-plugin/ # yarn # yarn build - 1.3. Clone the Wazuh Dashboard Plugins repository and build the plugins. + 1.3. Clone the Wazuh Dashboard Plugins repository in the plugins folder, + move the contents of the plugins folder to the folder where the repository was cloned and build the plugins. + + .. note:: + + The yarn build command requires an entry specifying the OpenSearch Dashboard version. This version can be obtained from the package.json file. + + + .. code:: console + + # cd ../ + # git clone -b https://github.com/wazuh/wazuh-dashboard-plugins.git + # cd wazuh-dashboard-plugins/ + # cp -r plugins/* ../ + # cd ../main + # yarn + # yarn build + # cd ../wazuh-core/ + # yarn + # yarn build + # cd ../wazuh-check-updates/ + # yarn + # yarn build + + Example: .. code:: console # cd ../ - # git clone -b https://github.com/wazuh/wazuh-dashboard-plugins.git + # git clone -b 4.9.0 https://github.com/wazuh/wazuh-dashboard-plugins.git # cd wazuh-dashboard-plugins/ # cp -r plugins/* ../ # cd ../main @@ -67,10 +110,23 @@ To do so, follow these steps: # cd ../../../ # mkdir packages # cd packages - # zip -r -j ./dashboard-package.zip ../wazuh-dashboard/target/opensearch-dashboards--linux-x64.tar.gz + # zip -r -j ./dashboard-package.zip ../wazuh-dashboard/target/opensearch-dashboards-2.13.0-linux-x64.tar.gz # zip -r -j ./security-package.zip ../wazuh-dashboard/plugins/wazuh-security-dashboards-plugin/build/security-dashboards-.0.zip # zip -r -j ./wazuh-package.zip ../wazuh-dashboard/plugins/wazuh-check-updates/build/wazuhCheckUpdates-.zip ../wazuh-dashboard/plugins/main/build/wazuh-.zip ../wazuh-dashboard/plugins/wazuh-core/build/wazuhCore-.zip + Example: + + .. code:: console + + # cd ../../../ + # mkdir packages + # cd packages + # zip -r -j ./dashboard-package.zip ../wazuh-dashboard/target/opensearch-dashboards-2.13.0-linux-x64.tar.gz + # zip -r -j ./security-package.zip ../wazuh-dashboard/plugins/wazuh-security-dashboards-plugin/build/security-dashboards-2.13.0.0.zip + # zip -r -j ./wazuh-package.zip ../wazuh-dashboard/plugins/wazuh-check-updates/build/wazuhCheckUpdates-2.13.0.zip ../wazuh-dashboard/plugins/main/build/wazuh-2.13.0.zip ../wazuh-dashboard/plugins/wazuh-core/build/wazuhCore-2.13.0.zip + + + At this point you must have 3 packages in the packages folder: - ``dashboard-package.zip`` @@ -90,7 +146,15 @@ The script requires the following parameters: .. code:: console # cd ../wazuh-dashboard/dev-tools/build-packages/ - # ./build-packages.sh -v -r -a -s -b + # ./build-packages.sh -v -r -a file:/// -s file:/// -b file:/// + +Example: + +.. code:: console + + # cd ../wazuh-dashboard/dev-tools/build-packages/ + # ./build-packages.sh -v 4.9.0 -r 1 --deb -a file:///packages/wazuh-package.zip -s file:///packages/security-package.zip -b file:///packages/dashboard-package.zip + The package will be generated in the ``output`` folder of the same directory where the script is located. @@ -105,7 +169,14 @@ and then if desired you can use the created package to generate the .deb or .rpm .. code:: console - # git clone -b https://github.com/wazuh/wazuh-dashboard.git + # git clone -b https://github.com/wazuh/wazuh-dashboard.git + # cd wazuh-dashboard/dev-tools/build-packages/ + +Example: + +.. code:: console + + # git clone -b 4.9.0 https://github.com/wazuh/wazuh-dashboard.git # cd wazuh-dashboard/dev-tools/build-packages/ 2. Build the Docker image with the following parameters: From d53f757856935536cab7d39acf94f39835e3123d Mon Sep 17 00:00:00 2001 From: Ian Yenien Serrano Date: Mon, 3 Jun 2024 20:06:12 +0200 Subject: [PATCH 4/5] Add requirements --- source/development/packaging/generate-dashboard-package.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/development/packaging/generate-dashboard-package.rst b/source/development/packaging/generate-dashboard-package.rst index 3a37e19199..007715b9bf 100644 --- a/source/development/packaging/generate-dashboard-package.rst +++ b/source/development/packaging/generate-dashboard-package.rst @@ -15,6 +15,12 @@ code. Build manually ^^^^^^^^^^^^^^ +Requirements: + +- Docker + +Steps: + 1. To use the script you first need to generate the packages from the repositories: - ``wazuh-dashboard`` From 25794271b2ce0c14af81382c9e3c9087a557efec Mon Sep 17 00:00:00 2001 From: Javier Medeot Date: Mon, 3 Jun 2024 19:51:00 -0300 Subject: [PATCH 5/5] Add changes from review --- source/_static/js/redirects.js | 1 + .../packaging/generate-dashboard-package.rst | 239 +++++++++--------- .../packaging/generate-indexer-package.rst | 2 +- 3 files changed, 121 insertions(+), 121 deletions(-) diff --git a/source/_static/js/redirects.js b/source/_static/js/redirects.js index a7a28e4f3e..645c2b16f0 100644 --- a/source/_static/js/redirects.js +++ b/source/_static/js/redirects.js @@ -113,6 +113,7 @@ newUrls['4.9'] = [ '/deployment-options/offline-installation/step-by-step.html', '/deployment-options/offline-installation/installation-assistant.html', '/development/coredump.html', + '/development/packaging/generate-dashboard-package.html', '/development/packaging/generate-indexer-package.html', 'development/packaging/generate-deb-rpm-package.html', '/cloud-security/amazon/services/supported-services/amazon-security-lake/index.html', diff --git a/source/development/packaging/generate-dashboard-package.rst b/source/development/packaging/generate-dashboard-package.rst index 007715b9bf..12a756ab8e 100644 --- a/source/development/packaging/generate-dashboard-package.rst +++ b/source/development/packaging/generate-dashboard-package.rst @@ -1,39 +1,43 @@ -=============== -Wazuh Dashboard +.. Copyright (C) 2015, Wazuh, Inc. + +.. meta:: + :description: Wazuh provides an automated way of building packages for the Wazuh components. Learn how to build your own Wazuh dashboard package in this section of our documentation. + +Wazuh dashboard =============== -The packages generation process is orchestrated by one script, which is -found within the ``dev-tools/build-packages/build-packages.sh`` folder of the repository: +The packages generation process is orchestrated by the ``build-packages.sh`` script, which is found within the ``dev-tools/build-packages/`` folder of the repository. This script is responsible for bundling plugins into one single application in tar, rpm and/or deb distributions. It takes the following parameters: -- ``build-packages.sh``: This script is responsible for bundling plugins into 1 single application in tar, rpm and/or deb distributions. With the parameters ``version``, ``revision``, ``distribution``, package of ``wazuh-dashboard``, ``wazuh-dashboard-plugins`` and ``wazuh-security-dashboards-plugin``. +- version +- revision +- distribution +- wazuh-dashboard, wazuh-dashboard-plugins, and wazuh-security-dashboards-plugin package paths -Official packages are built through a GitHub Actions pipeline, however, -the process is designed to be independent enough for maximum -portability. The building process is self-contained in the application -code. +Official packages are built through a GitHub Actions pipeline, however, the process is designed to be independent enough for maximum portability. The building process is self-contained in the application code. Build manually ^^^^^^^^^^^^^^ Requirements: -- Docker +- Docker -Steps: +Generating zip packages +~~~~~~~~~~~~~~~~~~~~~~~ -1. To use the script you first need to generate the packages from the repositories: +To use the script you first need to generate the packages from these repositories: -- ``wazuh-dashboard`` -- ``wazuh-security-dashboards-plugin`` -- ``wazuh-dashboard-plugins`` +- ``wazuh-dashboard`` +- ``wazuh-security-dashboards-plugin`` +- ``wazuh-dashboard-plugins`` -To do so, follow these steps: +To build the packages, follow these steps: - 1.1. Clone the Wazuh Dashboard repository and build the application. +#. Clone the Wazuh dashboard repository and build the application. .. code:: console - # git clone -b https://github.com/wazuh/wazuh-dashboard.git + # git clone -b https://github.com/wazuh/wazuh-dashboard.git # cd wazuh-dashboard/ # yarn osd bootstrap # yarn build --linux --skip-os-packages --release @@ -47,12 +51,12 @@ To do so, follow these steps: # yarn osd bootstrap # yarn build --linux --skip-os-packages --release - 1.2. Clone the Wazuh Security Dashboards Plugin in the plugins folder and build the plugin. +#. Clone the Wazuh Security Dashboards Plugin repository in the plugins folder and build the plugin. .. code:: console # cd plugins/ - # git clone -b https://github.com/wazuh/wazuh-security-dashboards-plugin.git + # git clone -b https://github.com/wazuh/wazuh-security-dashboards-plugin.git # cd wazuh-security-dashboards-plugin/ # yarn # yarn build @@ -67,18 +71,16 @@ To do so, follow these steps: # yarn # yarn build - 1.3. Clone the Wazuh Dashboard Plugins repository in the plugins folder, - move the contents of the plugins folder to the folder where the repository was cloned and build the plugins. +#. Clone the Wazuh dashboard plugins repository in the plugins folder, move the contents of the plugins folder to the folder where the repository was cloned and build the plugins. .. note:: - The yarn build command requires an entry specifying the OpenSearch Dashboard version. This version can be obtained from the package.json file. - + The yarn build command requires an entry specifying the OpenSearch Dashboard version. This version can be obtained from the ``package.json`` file. .. code:: console # cd ../ - # git clone -b https://github.com/wazuh/wazuh-dashboard-plugins.git + # git clone -b https://github.com/wazuh/wazuh-dashboard-plugins.git # cd wazuh-dashboard-plugins/ # cp -r plugins/* ../ # cd ../main @@ -109,7 +111,7 @@ To do so, follow these steps: # yarn # yarn build - 1.4. Zip the packages and move them to the packages folder +#. Zip the packages and move them to the packages folder .. code:: console @@ -117,8 +119,8 @@ To do so, follow these steps: # mkdir packages # cd packages # zip -r -j ./dashboard-package.zip ../wazuh-dashboard/target/opensearch-dashboards-2.13.0-linux-x64.tar.gz - # zip -r -j ./security-package.zip ../wazuh-dashboard/plugins/wazuh-security-dashboards-plugin/build/security-dashboards-.0.zip - # zip -r -j ./wazuh-package.zip ../wazuh-dashboard/plugins/wazuh-check-updates/build/wazuhCheckUpdates-.zip ../wazuh-dashboard/plugins/main/build/wazuh-.zip ../wazuh-dashboard/plugins/wazuh-core/build/wazuhCore-.zip + # zip -r -j ./security-package.zip ../wazuh-dashboard/plugins/wazuh-security-dashboards-plugin/build/security-dashboards-.0.zip + # zip -r -j ./wazuh-package.zip ../wazuh-dashboard/plugins/wazuh-check-updates/build/wazuhCheckUpdates-.zip ../wazuh-dashboard/plugins/main/build/wazuh-.zip ../wazuh-dashboard/plugins/wazuh-core/build/wazuhCore-.zip Example: @@ -131,28 +133,28 @@ To do so, follow these steps: # zip -r -j ./security-package.zip ../wazuh-dashboard/plugins/wazuh-security-dashboards-plugin/build/security-dashboards-2.13.0.0.zip # zip -r -j ./wazuh-package.zip ../wazuh-dashboard/plugins/wazuh-check-updates/build/wazuhCheckUpdates-2.13.0.zip ../wazuh-dashboard/plugins/main/build/wazuh-2.13.0.zip ../wazuh-dashboard/plugins/wazuh-core/build/wazuhCore-2.13.0.zip - - -At this point you must have 3 packages in the packages folder: +At this point you must have three packages in the ``packages`` folder: - ``dashboard-package.zip`` - ``security-package.zip`` - ``wazuh-package.zip`` -2. Generate the final packages, by running the script ``build-packages.sh`` in the ``dev-tools/build-packages/`` folder of the repository. -The script requires the following parameters: +Using the script +~~~~~~~~~~~~~~~~ -- ``-v``: Version of the package. -- ``-r``: Revision of the package. -- ``--deb`` or ``--rpm``: Distribution of the package. -- ``-a``: Path to the ``wazuh-package.zip``. -- ``-s``: Path to the ``security-package.zip``. -- ``-b``: Path to the ``dashboard-package.zip``. +Run the ``build-packages.sh`` script in the ``dev-tools/build-packages/`` folder of the repository. The script requires the following parameters: + +- ``-v``: Version of the package. +- ``-r``: Revision of the package. +- ``--deb`` or ``--rpm``: Distribution of the package. +- ``-a``: Path to the ``wazuh-package.zip``. +- ``-s``: Path to the ``security-package.zip``. +- ``-b``: Path to the ``dashboard-package.zip``. .. code:: console # cd ../wazuh-dashboard/dev-tools/build-packages/ - # ./build-packages.sh -v -r -a file:/// -s file:/// -b file:/// + # ./build-packages.sh -v -r -- -a file:/// -s file:/// -b file:/// Example: @@ -161,103 +163,100 @@ Example: # cd ../wazuh-dashboard/dev-tools/build-packages/ # ./build-packages.sh -v 4.9.0 -r 1 --deb -a file:///packages/wazuh-package.zip -s file:///packages/security-package.zip -b file:///packages/dashboard-package.zip - The package will be generated in the ``output`` folder of the same directory where the script is located. - Build with Docker image ^^^^^^^^^^^^^^^^^^^^^^^ -With this option you can create an image that has the package in tar.gz format -and then if desired you can use the created package to generate the .deb or .rpm file. - -1. Clone the Wazuh Dashboard repository. - -.. code:: console - - # git clone -b https://github.com/wazuh/wazuh-dashboard.git - # cd wazuh-dashboard/dev-tools/build-packages/ - -Example: - -.. code:: console - - # git clone -b 4.9.0 https://github.com/wazuh/wazuh-dashboard.git - # cd wazuh-dashboard/dev-tools/build-packages/ - -2. Build the Docker image with the following parameters: - -- ``NODE_VERSION``: Node version to use in the ``.nvmrc`` file. -- ``WAZUH_DASHBOARDS_BRANCH``: Branch of the Wazuh Dashboards repository. -- ``WAZUH_DASHBOARDS_PLUGINS``: Branch of the Wazuh Dashboards Plugins repository. -- ``WAZUH_SECURITY_DASHBOARDS_PLUGIN_BRANCH``: Branch of the Wazuh Security Dashboards Plugin repository. -- ``OPENSEARCH_DASHBOARDS_VERSION``: Version of the OpenSearch Dashboards(you can find the version in the package.json file of the Wazuh Dashboards repository) -- ``-t``: Tag of the image. - -.. code:: console - - # docker build \ - # --build-arg NODE_VERSION= \ - # --build-arg WAZUH_DASHBOARDS_BRANCH= \ - # --build-arg WAZUH_DASHBOARDS_PLUGINS= \ - # --build-arg WAZUH_SECURITY_DASHBOARDS_PLUGIN_BRANCH= \ - # --build-arg OPENSEARCH_DASHBOARDS_VERSION= \ - # -t \ - # -f wazuh-dashboard.Dockerfile . - -Example: - -.. code:: console - - # docker build \ - # --build-arg NODE_VERSION=18.19.0 \ - # --build-arg WAZUH_DASHBOARDS_BRANCH=4.9.0 \ - # --build-arg WAZUH_DASHBOARDS_PLUGINS=4.9.0 \ - # --build-arg WAZUH_SECURITY_DASHBOARDS_PLUGIN_BRANCH=4.9.0 \ - # --build-arg OPENSEARCH_DASHBOARDS_VERSION=2.13.0 \ - # -t wzd:4.9.0 \ - # -f wazuh-dashboard.Dockerfile . - -3. Run the Docker image: - -.. code:: console - - # docker run -d --rm --name wazuh-dashboard-package tail -f /dev/null - -Example: +With this option you can create an image that has the package in tar.gz format and then if desired you can use the created package to generate the .deb or .rpm file. -.. code:: console - - # docker run -d --rm --name wazuh-dashboard-package wzd:4.9.0 tail -f /dev/null +#. Clone the Wazuh dashboard repository. -4. Copy the package to the host: - -.. code:: console - - # docker cp wazuh-dashboard-package:/home/node/packages/. + .. code:: console + + # git clone -b https://github.com/wazuh/wazuh-dashboard.git + # cd wazuh-dashboard/dev-tools/build-packages/ + + Example: + + .. code:: console + + # git clone -b 4.9.0 https://github.com/wazuh/wazuh-dashboard.git + # cd wazuh-dashboard/dev-tools/build-packages/ -Example: +#. Build the Docker image with the following parameters: -.. code:: console + - ``NODE_VERSION``: Node version to use in the ``.nvmrc`` file. + - ``WAZUH_DASHBOARDS_BRANCH``: Branch of the Wazuh dashboards repository. + - ``WAZUH_DASHBOARDS_PLUGINS``: Branch of the Wazuh dashboards Plugins repository. + - ``WAZUH_SECURITY_DASHBOARDS_PLUGIN_BRANCH``: Branch of the Wazuh Security Dashboards Plugin repository. + - ``OPENSEARCH_DASHBOARDS_VERSION``: Version of the OpenSearch Dashboards. You can find the version in the ``package.json`` file of the Wazuh dashboards repository. + - ``-t``: Tag of the image. - # docker cp wazuh-dashboard-package:/home/node/packages/. / + .. code:: console + + # docker build \ + --build-arg NODE_VERSION= \ + --build-arg WAZUH_DASHBOARDS_BRANCH= \ + --build-arg WAZUH_DASHBOARDS_PLUGINS= \ + --build-arg WAZUH_SECURITY_DASHBOARDS_PLUGIN_BRANCH= \ + --build-arg OPENSEARCH_DASHBOARDS_VERSION= \ + -t \ + -f wazuh-dashboard.Dockerfile . -This copies the final package and the packages that were used to generate the final package. + Example: + + .. code:: console + + # docker build \ + --build-arg NODE_VERSION=18.19.0 \ + --build-arg WAZUH_DASHBOARDS_BRANCH=4.9.0 \ + --build-arg WAZUH_DASHBOARDS_PLUGINS=4.9.0 \ + --build-arg WAZUH_SECURITY_DASHBOARDS_PLUGIN_BRANCH=4.9.0 \ + --build-arg OPENSEARCH_DASHBOARDS_VERSION=2.13.0 \ + -t wzd:4.9.0 \ + -f wazuh-dashboard.Dockerfile . + +#. Run the Docker image: -5 (Optional). If you want to generate the .deb or .rpm file, you can use the script ``launcher.sh`` in the ``dev-tools/build-packages/(rpm or deb)/`` folder of the repository with the following parameters: + .. code:: console + + # docker run -d --rm --name wazuh-dashboard-package tail -f /dev/null + + Example: + + .. code:: console + + # docker run -d --rm --name wazuh-dashboard-package wzd:4.9.0 tail -f /dev/null -- ``-v``: Version of the package. -- ``-r``: Revision of the package. -- ``-p``: Path to the package in tar.gz format generated in the previous step +#. Copy the package to the host: -.. code:: console + .. code:: console + + # docker cp wazuh-dashboard-package:/home/node/packages/. - # ./launcher.sh -v -r -p + Example: + + .. code:: console + + # docker cp wazuh-dashboard-package:/home/node/packages/. / -Example: + This copies the final package and the packages that were used to generate the final package. -.. code:: console +#. Optional. If you want to generate the .deb or .rpm file, you can use the script ``launcher.sh`` in the ``dev-tools/build-packages/rpm/`` or ``dev-tools/build-packages/deb/`` folder of the repository with the following parameters: - # ./launcher.sh -v 4.9.0 -r 1 -p file:///wazuh-dashboard-4.9.0-1-linux-x64.tar.gz + - ``-v``: Version of the package. + - ``-r``: Revision of the package. + - ``-p``: Path to the package in tar.gz format generated in the previous step + + .. code:: console + + # ./launcher.sh -v -r -p + + Example: + + .. code:: console + + # ./launcher.sh -v 4.9.0 -r 1 -p file:///wazuh-dashboard-4.9.0-1-linux-x64.tar.gz The package will be generated in the ``output`` folder of the ``rpm`` or ``deb`` folder. \ No newline at end of file diff --git a/source/development/packaging/generate-indexer-package.rst b/source/development/packaging/generate-indexer-package.rst index d61ecd0686..cfcc0b1037 100644 --- a/source/development/packaging/generate-indexer-package.rst +++ b/source/development/packaging/generate-indexer-package.rst @@ -3,7 +3,7 @@ .. meta:: :description: Wazuh provides an automated way of building packages for the Wazuh components. Learn how to build your own Wazuh indexer package in this section of our documentation. -Wazuh Indexer +Wazuh indexer ============= The packages' generation process is orchestrated by two scripts, which are found within the ``packaging_scripts`` folder of the repository: