Adding nodejs recommended node_options and plugin optimization

This commit is contained in:
Zenidd 2020-03-10 15:23:35 +01:00
parent cf55550589
commit 163c89dbab
3 changed files with 19 additions and 7 deletions

View File

@ -43,8 +43,11 @@ nodejs:
repo_dict:
debian: "deb"
redhat: "rpm"
repo_url_ext: "nodesource.com/setup_8.x"
repo_url_ext: "nodesource.com/setup_8.x"
# Build from sources
build_from_sources: false
wazuh_plugin_branch: 3.11-7.6
#Nodejs NODE_OPTIONS
node_options: --max-old-space-size=4096

View File

@ -63,9 +63,7 @@
chdir: "/tmp/app/build"
- name: Install Wazuh Plugin (can take a while)
shell: "/usr/share/kibana/bin/kibana-plugin install file:///tmp/app/build/{{ wazuhapp_package_name.stdout }}"
environment:
NODE_OPTIONS: "--max-old-space-size=3072"
shell: 'NODE_OPTIONS="{{node_options}}" /usr/share/kibana/bin/kibana-plugin install file:///tmp/app/build/{{ wazuhapp_package_name.stdout }}'
args:
executable: /bin/bash
creates: /usr/share/kibana/plugins/wazuh/package.json

View File

@ -62,6 +62,12 @@
- kibana_xpack_security
tags: xpack-security
- name: Node configuration
replace:
path: /usr/share/kibana/bin/kibana
regexp: 'NODE_OPTIONS=\"--no-warnings --max-http-header-size=65536 \$\{NODE_OPTIONS\}\" NODE_ENV=production exec \"\$\{NODE}\" \"\$\{DIR\}/src/cli\" \$\{@\}'
replace: 'NODE_OPTIONS="--no-warnings {{node_options}} --max-http-header-size=65536 ${NODE_OPTIONS}" NODE_ENV=production exec "${NODE}" "${DIR}/src/cli" ${@}'
- name: Ensuring certificates folder owner
file:
path: "{{ node_certs_destination }}/"
@ -119,9 +125,7 @@
- name: Install Wazuh Plugin (can take a while)
shell: "/usr/share/kibana/bin/kibana-plugin install {{ wazuh_app_url }}-{{ wazuh_version }}_{{ elastic_stack_version }}.zip"
environment:
NODE_OPTIONS: "--max-old-space-size=3072"
shell: 'NODE_OPTIONS="{{node_options}}" /usr/share/kibana/bin/kibana-plugin install {{ wazuh_app_url }}-{{ wazuh_version }}_{{ elastic_stack_version }}.zip'
args:
executable: /bin/bash
creates: /usr/share/kibana/plugins/wazuh/package.json
@ -135,6 +139,13 @@
when:
- not build_from_sources
- name: Kibana optimization (can take a while)
shell: 'NODE_OPTIONS="{{node_options}}" /usr/share/kibana/bin/kibana --optimize --allow-root'
args:
executable: /bin/bash
become: yes
become_user: kibana
- name: Wait for Elasticsearch port
wait_for: host={{ elasticsearch_network_host }} port={{ elasticsearch_http_port }}