diff --git a/source/development/packaging/generate-indexer-package.rst b/source/development/packaging/generate-indexer-package.rst index ebfd4f3dfd..f4a511b655 100644 --- a/source/development/packaging/generate-indexer-package.rst +++ b/source/development/packaging/generate-indexer-package.rst @@ -10,12 +10,10 @@ Wazuh indexer Local packages generation ######################### -While official ``Wazuh Indexer`` packages are generated in a GitHub Actions pipeline, packages can also be compiled locally or within a docker container. +While official ``Wazuh Indexer`` packages are generated in a GitHub Actions pipeline, packages can also be compiled locally within a :doc:`docker` container. -The packages' generation process is orchestrated by two scripts, found under the ``build-scripts`` directory of the repository: +The packages' generation process is controlled by the ``docker/builder/builder.sh`` script. This script prepares and launches a docker container that automates the build process. -- ``build.sh``: compiles the Java application and bundles it into a package. -- ``assemble.sh``: uses the package from the previous step and inflates it with plugins and configuration files, ready for production deployment. .. contents:: Table of contents: :depth: 2 @@ -30,185 +28,57 @@ Docker environment Pre-requisistes =============== -1. Clone the ``Wazuh Indexer`` GitHub repository and switch to the ``v|WAZUH_CURRENT|`` tag: +1. Install the :doc:`docker engine` + +2. Clone the ``Wazuh Indexer`` GitHub repository and switch to the ``v|WAZUH_CURRENT|`` tag: .. code:: console # git clone https://github.com/wazuh/wazuh-indexer/ # git checkout v|WAZUH_CURRENT| -2. Bring the docker environment up: - -.. code:: console - - # cd wazuh-indexer/docker/ci - # bash ci.sh up - # cd ../.. - -Build a minimal package -======================= - -A basic package including only the ``Wazuh Indexer`` engine without extra plugin is generated first. - -1. Set the environment variables: - -.. note:: +Build the package +================= - Replace ```` with one of ``x64`` or ``arm64`` and ```` with one of ``rpm``, ``deb`` or ``tar`` +The `builder.sh` script is controlled by a number of optional arguments that are detailed in its help page: .. code:: console - # ARCHITECTURE= - # PACKAGE_TYPE= + $ ./builder.sh -h + Usage: ./builder.sh [args] -2. Run the build script: + Arguments: + -p INDEXER_PLUGINS_BRANCH [Optional] wazuh-indexer-plugins repo branch, default is 'master'. + -r INDEXER_REPORTING_BRANCH [Optional] wazuh-indexer-reporting repo branch, default is 'master'. + -R REVISION [Optional] Package revision, default is '0'. + -s STAGE [Optional] Staging build, default is 'false'. + -d DISTRIBUTION [Optional] Distribution, default is 'rpm'. + -a ARCHITECTURE [Optional] Architecture, default is 'x64'. + -D Destroy the docker environment + -h Print help -.. code:: console - - # docker exec -it wi-build_$(`` with one of ``x64`` or ``arm64`` and ```` with one of ``rpm``, ``deb`` or ``tar``. +1. Change directory to the docker environment's path: .. code:: console - # ARCHITECTURE= - # PACKAGE_TYPE= + $ cd wazuh-indexer/docker/builder -2. Run the assembly process: +2. Launch the script with the selected option flags: .. code:: console - - # docker exec -it wi-assemble_$( - - -Pre-requisistes -================ - -1. Install build dependencies - -.. tabs:: - - .. group-tab:: RPM - - .. code-block:: console - # yum install -y git curl gnupg2 gcc gcc-c++ make cpio rpm-build mesa-libGLU freeglut alsa-lib atk at-spi2-core cairo cairo-devel cups-libs libdrm libgbm nspr nspr-devel nss pango libXcomposite libXdamage libXfixes libXfixes-devel libXi libxkbcommon libXrandr libXrender libXtst rpm rpm-build maven - - .. group-tab:: DEB + $ bash builder.sh \ + -p master \ + -r master \ + -R 0 \ + -s false \ + -d deb \ + -a amd64 - .. code-block:: console - - # apt-get update - # apt-get install -y git curl gnupg2 y build-essential cpio debhelper-compat debmake freeglut3 libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-dev libcairo2 libcairo2-dev libcups2 libdrm2 libgbm-dev libgconf-2-4 libnspr4 libnspr4-dev libnss3 libpangocairo-1.0-0 libxcomposite-dev libxdamage1 libxfixes-dev libxfixes3 libxi6 libxkbcommon-x11-0 libxrandr2 libxrender1 libxtst6 rpm rpm2cpio maven +The code above will build a ``.deb`` package for the ``amd64`` architecture, using the plugins' master branch. The package revision will be set to ``0``. -2. Clone the ``wazuh-indexer`` repository and switch to the appropriate branch +Once the build process finishes, built packages will be deployed to the ``artifacts/dist`` directory under the repo's root. -.. code:: console - - # git clone https://github.com/wazuh/wazuh-indexer - # git checkout v|WAZUH_CURRENT| - - -Build a minimal package -======================= - -A basic package including only the ``Wazuh Indexer`` engine without extra plugin is generated first. - -1. Set the environment variables: - -.. note:: - - Replace ```` with one of ``x64`` or ``arm64`` and ```` with one of ``rpm``, ``deb`` or ``tar`` - -.. code:: console - - # ARCHITECTURE= - # PACKAGE_TYPE= - -2. Run the build script: - -.. code:: console - - # bash build-scripts/build.sh -a $ARCHITECTURE -d $PACKAGE_TYPE -n $(bash build-scripts/baptizer.sh -a $ARCHITECTURE -d $PACKAGE_TYPE -m) - -After this step, a minimal package (without plugins) will be present under the ``artifacts`` directory. - -Full package assembly -===================== - -1. Set the ``ARCHITECTURE`` and ``PACKAGE_TYPE`` environment variables replacing ```` with one of ``tar``, ``deb`` or ``rpm`` and ```` with ``x64`` or ``arm64`` depending on the target system the packages are being built for. - -.. code:: console - - # ARCHITECTURE= - # PACKAGE_TYPE= - -2. Run the assembly process: - -.. code:: console - - # bash build-scripts/assemble.sh -a $ARCHITECTURE -d $PACKAGE_TYPE - -Build and assemble scripts reference -#################################### -.. raw:: html - -
-The packages' generation process is guided through bash scripts. - -Below is a reference of their inputs, outputs and code: - -.. code:: none - - scripts: - - file: build.sh - description: | - generates a distribution package by running the appropiate Gradle task - depending on the parameters. - inputs: - architecture: [x64, arm64] # Note: we only build x86_64 packages - distribution: [tar, deb, rpm] - name: the name of the package to be generated. - outputs: - package: minimal wazuh-indexer package for the required distribution. - - - file: assemble.sh - description: | - bundles the wazuh-indexer package generated in by build.sh with plugins, - configuration files and demo certificates (certificates yet to come). - inputs: - architecture: [x64, arm64] # Note: we only build x86_64 packages - distribution: [tar, deb, rpm] - revision: revision number. 0 by default. - outputs: - package: wazuh-indexer package. - - - file: provision.sh - description: Provision script for the assembly of DEB packages. - - - file: baptizer.sh - description: generate the wazuh-indexer package name depending on the parameters. - inputs: - architecture: [x64, arm64] # Note: we only build x86_64 packages - distribution: [tar, deb, rpm] - revision: revision number. 0 by default. - is_release: if set, uses release naming convention. - is_min: if set, the package name will start by `wazuh-indexer-min`. Used on the build stage. - outputs: - package: the name of the wazuh-indexer package