Increase max_map_count

This commit is contained in:
Florent 2023-01-04 16:06:57 +01:00 committed by Florent F
parent 4c1b0ed47d
commit 921f56034a
5 changed files with 49 additions and 4 deletions

View file

@ -0,0 +1,3 @@
# Increase the number of allowed map count
# See: https://opensearch.org/docs/latest/install-and-configure/install-opensearch/index/#important-settings
vm.max_map_count=262144

View file

@ -56,6 +56,12 @@ ynh_backup --src_path="$datadir" --is_big
ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/logrotate.d/$app"
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/etc/sysctl.d/90-max_map_count-opensearch.conf"
#================================================= #=================================================
# BACKUP SYSTEMD # BACKUP SYSTEMD
#================================================= #=================================================

View file

@ -71,10 +71,6 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=15 ynh_script_progression --message="Setting up source files..." --weight=15
### `ynh_setup_source` is used to install an app from a zip or tar.gz file,
### downloaded from an upstream source, like a git repository.
### `ynh_setup_source` use the file conf/app.src
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --source_id="$YNH_ARCH" ynh_setup_source --dest_dir="$final_path" --source_id="$YNH_ARCH"
@ -118,6 +114,21 @@ ynh_add_config --template="jvm.options" --destination="$final_path/config/jvm.op
chmod 400 "$final_path/config/opensearch.yml" "$final_path/config/jvm.options.d/yunohost.options" chmod 400 "$final_path/config/opensearch.yml" "$final_path/config/jvm.options.d/yunohost.options"
chown $app:$app "$final_path/config/opensearch.yml" "$final_path/config/jvm.options.d/yunohost.options" chown $app:$app "$final_path/config/opensearch.yml" "$final_path/config/jvm.options.d/yunohost.options"
#=================================================
# INCREASE MAX_MAP_COUNT
#=================================================
ynh_script_progression --message="Increasing maximum map count (sysctl)..."
# Increase the maximum number of files inotify can monitor.
cp -a ../conf/90-max_map_count-opensearch.conf /etc/sysctl.d/
# Then, reload the kernel configuration.
if ! IS_PACKAGE_CHECK # LXC doesn't allow sysctl to play with kernel options.
then
sysctl -p /etc/sysctl.d/90-max_map_count-opensearch.conf
fi
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================

View file

@ -93,6 +93,18 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies # Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..."
ynh_restore_file --origin_path="/etc/sysctl.d/90-max_map_count-opensearch.conf"
if ! IS_PACKAGE_CHECK # LXC doesn't allow sysctl to play with kernel options.
then
sysctl -p /etc/sysctl.d/90-max_map_count-opensearch.conf
fi
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================

View file

@ -119,6 +119,19 @@ ynh_add_config --template="jvm.options" --destination="$final_path/config/jvm.op
chmod 400 "$final_path/config/opensearch.yml" "$final_path/config/jvm.options.d/yunohost.options" chmod 400 "$final_path/config/opensearch.yml" "$final_path/config/jvm.options.d/yunohost.options"
chown $app:$app "$final_path/config/opensearch.yml" "$final_path/config/jvm.options.d/yunohost.options" chown $app:$app "$final_path/config/opensearch.yml" "$final_path/config/jvm.options.d/yunohost.options"
#=================================================
# INCREASE MAX_MAP_COUNT
#=================================================
ynh_script_progression --message="Increasing maximum map count (sysctl)..."
# Increase the maximum number of files inotify can monitor.
cp -a ../conf/90-max_map_count-opensearch.conf /etc/sysctl.d/
# Then, reload the kernel configuration.
if ! IS_PACKAGE_CHECK # LXC doesn't allow sysctl to play with kernel options.
then
sysctl -p /etc/sysctl.d/90-max_map_count-opensearch.conf
fi
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================