forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add install-plugins and entrypoint to wzd.dockerfile
- Loading branch information
1 parent
8ecae44
commit 8d68801
Showing
6 changed files
with
120 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
## Images | ||
|
||
To setup the crendentials (**this only has to be done once**): | ||
|
||
1. Login to Quay.io and navigate to User Settings. | ||
2. Click on `CLI Password: Generate Encrypted Password` | ||
3. In the new window that opens, click on `Docker Configuration` and follow the steps. | ||
|
||
To build an image, use the docker build command like: | ||
|
||
Use the `--build-arg` flag to specify the version of Node and the version of | ||
the platform. The version of Node to use is defined in the `.nvmrc` file. Use | ||
the Node version defined in that file for the target platform version, as the | ||
version of Node might be increased between platfform's versions. | ||
|
||
For example, to build the image for OpenSearch Dashboards `5.0.0`: | ||
|
||
```bash | ||
# Usage: | ||
docker build \ | ||
--build-arg NODE_VERSION=18.19.0 \ | ||
--build-arg OPENSEARCH_DASHBOARD_VERSION=2.17.1.0 \ | ||
--build-arg WAZUH_DASHBOARD_BRANCH=5.0.0 \ | ||
--build-arg WAZUH_DASHBOARD_SECURITY_BRANCH=5.0.0 \ | ||
--build-arg WAZUH_DASHBOARD_REPORTING_BRANCH=5.0.0 \ | ||
--build-arg WAZUH_DASHBOARD_PLUGINS_BRANCH=5.0.0 \ | ||
-t quay.io/wazuh/osd-dev:2.17.1 \ | ||
-f wzd.dockerfile . | ||
``` | ||
|
||
For arm architecture if you have amd architecture you need to add `--platform linux/arm64` and if you have arm for amd architecture you need to add `--platform linux/amd64` | ||
|
||
Push the image to Quay: | ||
|
||
```bash | ||
docker push quay.io/wazuh/image-name:version | ||
``` | ||
|
||
If you're creating a new image, copy one of the ones already present | ||
in the directory, and adapt it to the new version. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,12 @@ | ||
plugins=$(cat /home/node/plugins) | ||
wazuh_dashboard_plugins=$(cat /home/node/wazuh-dashboard-plugins) | ||
#!/bin/bash | ||
base_path_plugins="/home/node/kbn/plugins" | ||
plugins=$(ls $base_path_plugins) | ||
for plugin in $plugins; do | ||
echo "Cloning $plugin" | ||
cd /home/node/kbn/plugins | ||
if [[ $plugin =~ wazuh* ]]; then | ||
|
||
if [[ $plugin == "wazuh-security-dashboards-plugin" ]]; then | ||
git clone --depth 1 --branch ${WAZUH_DASHBOARD_SECURITY_BRANCH} https://github.com/wazuh/$plugin.git | ||
fi | ||
|
||
if [[ $plugin == "wazuh-dashboards-reporting" ]]; then | ||
git clone --depth 1 --branch ${WAZUH_DASHBOARD_REPORTING_BRANCH} https://github.com/wazuh/$plugin.git | ||
fi | ||
|
||
if [[ $plugin == "wazuh-dashboard-plugins" ]]; then | ||
git clone --depth 1 --branch ${WAZUH_DASHBOARD_PLUGINS_BRANCH} https://github.com/wazuh/$plugin.git | ||
mv $plugin/plugins/* ./ | ||
for wazuh_dashboard_plugin in $wazuh_dashboard_plugins; do | ||
cd /home/node/kbn/plugins/$wazuh_dashboard_plugin | ||
yarn install | ||
done | ||
cd /home/node/kbn/plugins | ||
rm -rf $plugin | ||
fi | ||
|
||
else | ||
git clone --depth 1 --branch ${OPENSEARCH_DASHBOARD_VERSION} https://github.com/opensearch-project/$plugin.git | ||
fi | ||
if [[ $plugin != "wazuh-dashboard-plugins" ]]; then | ||
cd $plugin | ||
if [ ! -d "$base_path_plugins/$plugin/node_modules" ]; then | ||
cd $base_path_plugins/$plugin | ||
echo "Installing dependencies for $plugin" | ||
yarn install | ||
fi | ||
done | ||
|
||
tail -f /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
plugins=$(cat /home/node/plugins) | ||
base_path_plugins="/home/node/kbn/plugins" | ||
category_explore="id: 'explore',label: 'Explore',order: 100,euiIconType: 'search'," | ||
category_dashboard_management='{id:"management",label:"Indexer management",order:5e3,euiIconType:"managementApp"}' | ||
old_category_default="DEFAULT_APP_CATEGORIES\.management," | ||
old_category_object="id: 'opensearch',/{ | ||
N | ||
N | ||
s/id: 'opensearch',\n\s*label: 'OpenSearch Plugins',\n\s*order: 2000," | ||
for plugin in $plugins; do | ||
cd $base_path_plugins | ||
if [[ $plugin =~ wazuh* ]]; then | ||
# Clone the Wazuh security plugin | ||
if [[ $plugin == "wazuh-security-dashboards-plugin" ]]; then | ||
git clone --depth 1 --branch ${WAZUH_DASHBOARD_SECURITY_BRANCH} https://github.com/wazuh/$plugin.git | ||
fi | ||
# Clone the Wazuh dashboards reporting plugin | ||
if [[ $plugin == "wazuh-dashboards-reporting" ]]; then | ||
git clone --depth 1 --branch ${WAZUH_DASHBOARD_REPORTING_BRANCH} https://github.com/wazuh/$plugin.git | ||
fi | ||
# Clone the Wazuh dashboards plugins and move the plugins to the plugins folder | ||
if [[ $plugin == "wazuh-dashboard-plugins" ]]; then | ||
git clone --depth 1 --branch ${WAZUH_DASHBOARD_PLUGINS_BRANCH} https://github.com/wazuh/$plugin.git | ||
wazuh_dashboard_plugins=$(ls $base_path_plugins/$plugin/plugins) | ||
mv $plugin/plugins/* ./ | ||
for wazuh_dashboard_plugin in $wazuh_dashboard_plugins; do | ||
cd $base_path_plugins/$wazuh_dashboard_plugin | ||
yarn install | ||
done | ||
cd $base_path_plugins | ||
rm -rf $plugin | ||
fi | ||
|
||
else | ||
git clone --depth 1 --branch ${OPENSEARCH_DASHBOARD_VERSION} https://github.com/opensearch-project/$plugin.git | ||
cd $base_path_plugins/$plugin/public | ||
|
||
# Notification plugin: Modify the plugin.ts file to add the Explore category | ||
if [[ $plugin == "dashboards-notifications" ]]; then | ||
sed -i -e "s/${old_category_default}/{${category_explore}},/g" ./plugin.ts | ||
fi | ||
|
||
# Alerting plugin: Modify the plugin.ts file to add the Explore category | ||
if [[ $plugin == "alerting-dashboards-plugin" ]]; then | ||
sed -i -e "/${old_category_object}/${category_explore}/}" plugin.tsx | ||
fi | ||
|
||
# Maps plugin: Modify the plugin.ts file to add the Explore category | ||
if [[ $plugin == "dashboards-maps" ]]; then | ||
sed -i -e "/${old_category_object}/${category_explore}/}" plugin.tsx | ||
fi | ||
|
||
# Index Management plugin: Modify the plugin.ts file to add the Explore category | ||
if [[ $plugin == "index-management-dashboards-plugin" ]]; then | ||
sed -i -e "s/${old_category_default}/${category_dashboard_management},/g" ./plugin.ts | ||
fi | ||
|
||
fi | ||
if [[ $plugin != "wazuh-dashboard-plugins" ]]; then | ||
cd $base_path_plugins/$plugin | ||
yarn install | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters