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:
- 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.
Requirements:
- Docker
To use the script you first need to generate the packages from these repositories:
wazuh-dashboard
wazuh-security-dashboards-plugin
wazuh-dashboard-plugins
To build the packages, follow these steps:
Clone the Wazuh dashboard repository and build the application.
# git clone -b <BRANCH_OR_TAG> https://github.com/wazuh/wazuh-dashboard.git # cd wazuh-dashboard/ # yarn osd bootstrap # yarn build --linux --skip-os-packages --release
Example:
# 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
Clone the Wazuh Security Dashboards Plugin repository in the plugins folder and build the plugin.
# cd plugins/ # git clone -b <BRANCH_OR_TAG> https://github.com/wazuh/wazuh-security-dashboards-plugin.git # cd wazuh-security-dashboards-plugin/ # yarn # yarn build
Example:
# cd plugins/ # git clone -b 4.9.0 https://github.com/wazuh/wazuh-security-dashboards-plugin.git # cd wazuh-security-dashboards-plugin/ # yarn # yarn build
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.# cd ../ # git clone -b <BRANCH_OR_TAG> 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:
# cd ../ # git clone -b 4.9.0 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
Zip the packages and move them to the packages folder
# 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-<OPENSEARCH_VERSION>.0.zip # zip -r -j ./wazuh-package.zip ../wazuh-dashboard/plugins/wazuh-check-updates/build/wazuhCheckUpdates-<OPENSEARCH_VERSION>.zip ../wazuh-dashboard/plugins/main/build/wazuh-<OPENSEARCH_VERSION>.zip ../wazuh-dashboard/plugins/wazuh-core/build/wazuhCore-<OPENSEARCH_VERSION>.zip
Example:
# 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 three packages in the packages
folder:
dashboard-package.zip
security-package.zip
wazuh-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 thewazuh-package.zip
.-s
: Path to thesecurity-package.zip
.-b
: Path to thedashboard-package.zip
.
# cd ../wazuh-dashboard/dev-tools/build-packages/
# ./build-packages.sh -v <VERSION> -r <REVISION> --<DISTRIBUTION_(--deb_OR_--rpm)> -a file:///<PATH_TO_wazuh-package.zip> -s file:///<PATH_TO_security-package.zip> -b file:///<PATH_TO_dashboard-package.zip>
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.
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.
Clone the Wazuh dashboard repository.
# git clone -b <BRANCH_OR_TAG> https://github.com/wazuh/wazuh-dashboard.git # cd wazuh-dashboard/dev-tools/build-packages/
Example:
# git clone -b 4.9.0 https://github.com/wazuh/wazuh-dashboard.git # cd wazuh-dashboard/dev-tools/build-packages/
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 thepackage.json
file of the Wazuh dashboards repository.-t
: Tag of the image.
# docker build \ --build-arg NODE_VERSION=<NODE_VERSION> \ --build-arg WAZUH_DASHBOARDS_BRANCH=<BRANCH_OF_wazuh-dashboard> \ --build-arg WAZUH_DASHBOARDS_PLUGINS=<BRANCH_OF_wazuh-dashboard-plugins> \ --build-arg WAZUH_SECURITY_DASHBOARDS_PLUGIN_BRANCH=<BRANCH_OF_wazuh-security-dashboards-plugin> \ --build-arg OPENSEARCH_DASHBOARDS_VERSION=<OPENSEARCH_DASHBOARDS_VERSION> \ -t <TAG_OF_IMAGE> \ -f wazuh-dashboard.Dockerfile .
Example:
# 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:
# docker run -d --rm --name wazuh-dashboard-package <TAG_OF_IMAGE> tail -f /dev/null
Example:
# docker run -d --rm --name wazuh-dashboard-package wzd:4.9.0 tail -f /dev/null
Copy the package to the host:
# docker cp wazuh-dashboard-package:/home/node/packages/. <PATH_TO_SAVE_THE_PACKAGE>
Example:
# docker cp wazuh-dashboard-package:/home/node/packages/. /
This copies the final package and the packages that were used to generate the final package.
Optional. If you want to generate the .deb or .rpm file, you can use the script
launcher.sh
in thedev-tools/build-packages/rpm/
ordev-tools/build-packages/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
# ./launcher.sh -v <VERSION> -r <REVISION> -p <PATH_TO_PACKAGE>
Example:
# ./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.