mirror of
https://github.com/YunoHost-Apps/opensearch_ynh.git
synced 2024-09-03 19:46:35 +02:00
Merge 46401635c5
into aefa0ccd84
This commit is contained in:
commit
524ff7ee32
9 changed files with 75 additions and 99 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
*~
|
*~
|
||||||
*.sw[op]
|
*.sw[op]
|
||||||
|
.DS_Store
|
||||||
|
|
|
@ -20,7 +20,8 @@ code = "https://github.com/opensearch-project/OpenSearch"
|
||||||
cpe = "cpe:2.3:a:amazon:opensearch"
|
cpe = "cpe:2.3:a:amazon:opensearch"
|
||||||
|
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = ">= 11.2.20"
|
yunohost = ">= 11.2.18"
|
||||||
|
helpers_version = "2.1"
|
||||||
architectures = ["amd64", "arm64"]
|
architectures = ["amd64", "arm64"]
|
||||||
multi_instance = true
|
multi_instance = true
|
||||||
ldap = "not_relevant"
|
ldap = "not_relevant"
|
||||||
|
|
|
@ -1,17 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PERSONAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# EXPERIMENTAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# FUTURE OFFICIAL HELPERS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -8,37 +8,34 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
ynh_print_info "Declaring files to be backed up..."
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Declaring files to be backed up..."
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$install_dir"
|
ynh_backup "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE DATA DIR
|
# BACKUP THE DATA DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$data_dir" --is_big
|
ynh_backup "$data_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SYSTEM CONFIGURATION
|
# SYSTEM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
ynh_backup "/etc/logrotate.d/$app"
|
||||||
|
|
||||||
if [ "${container:-}" != "lxc" ]; then # lxc doesn't allow sysctl to play with kernel options.
|
if [ "${container:-}" != "lxc" ]; then # lxc doesn't allow sysctl to play with kernel options.
|
||||||
ynh_backup --src_path="/etc/sysctl.d/90-max_map_count-opensearch.conf"
|
ynh_backup "/etc/sysctl.d/90-max_map_count-opensearch.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
ynh_backup "/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
|
@ -8,15 +8,9 @@
|
||||||
# (validation of several interdependent fields, specific getter/setter for a value,
|
# (validation of several interdependent fields, specific getter/setter for a value,
|
||||||
# display dynamic informations or choices, pre-loading of config type .cube... ).
|
# display dynamic informations or choices, pre-loading of config type .cube... ).
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC STARTING
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
ynh_abort_if_errors
|
#REMOVEME? ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
|
@ -29,11 +23,11 @@ final_path=$(ynh_app_setting_get $app final_path)
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
get__xms() {
|
get__xms() {
|
||||||
ynh_app_setting_get --app=$app --key=xms
|
ynh_app_setting_get --key=xms
|
||||||
}
|
}
|
||||||
|
|
||||||
get__xmx() {
|
get__xmx() {
|
||||||
ynh_app_setting_get --app=$app --key=xmx
|
ynh_app_setting_get --key=xmx
|
||||||
}
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -45,22 +39,20 @@ get__xmx() {
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
regenerate_jvm_options() {
|
regenerate_jvm_options() {
|
||||||
ynh_add_config --template="jvm.options" --destination="$final_path/config/jvm.options.d/yunohost.options"
|
ynh_config_add --template="jvm.options" --destination="$final_path/config/jvm.options.d/yunohost.options"
|
||||||
chown $app:$app "$final_path/config/jvm.options.d/yunohost.options"
|
chown $app:$app "$final_path/config/jvm.options.d/yunohost.options"
|
||||||
chmod 400 "$final_path/config/jvm.options.d/yunohost.options"
|
chmod 400 "$final_path/config/jvm.options.d/yunohost.options"
|
||||||
}
|
}
|
||||||
|
|
||||||
set__xms() {
|
set__xms() {
|
||||||
ynh_app_setting_set --app=$app --key=xms --value=$xms
|
ynh_app_setting_set --key=xms --value=$xms
|
||||||
regenerate_jvm_options
|
regenerate_jvm_options
|
||||||
}
|
}
|
||||||
|
|
||||||
set__xmx() {
|
set__xmx() {
|
||||||
ynh_app_setting_set --app=$app --key=xmx --value=$xmx
|
ynh_app_setting_set --key=xmx --value=$xmx
|
||||||
regenerate_jvm_options
|
regenerate_jvm_options
|
||||||
}
|
}
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_app_config_run $1
|
ynh_app_config_run $1
|
||||||
|
|
|
@ -12,44 +12,43 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
xms=256m
|
xms=256m
|
||||||
ynh_app_setting_set --app="$app" --key="xms" --value="$xms"
|
ynh_app_setting_set --key="xms" --value="$xms"
|
||||||
|
|
||||||
xmx=1g
|
xmx=1g
|
||||||
ynh_app_setting_set --app="$app" --key="xmx" --value="$xmx"
|
ynh_app_setting_set --key="xmx" --value="$xmx"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=15
|
ynh_script_progression "Setting up source files..."
|
||||||
|
|
||||||
# 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="$install_dir"
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
|
|
||||||
chmod -R o-rwx "$install_dir"
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
||||||
chown -R "$app:$app" "$install_dir"
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:$app" "$install_dir"
|
||||||
|
|
||||||
chmod -R o-rwx "$data_dir"
|
chmod -R o-rwx "$data_dir"
|
||||||
chown -R "$app:www-data" "$data_dir"
|
chown -R "$app:www-data" "$data_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD CONFIGURATIONS
|
# ADD CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding $app's configuration files..." --weight=1
|
ynh_script_progression "Adding $app's configuration files..."
|
||||||
|
|
||||||
ynh_add_config --template="opensearch.yml" --destination="$install_dir/config/opensearch.yml"
|
ynh_config_add --template="opensearch.yml" --destination="$install_dir/config/opensearch.yml"
|
||||||
ynh_add_config --template="jvm.options" --destination="$install_dir/config/jvm.options.d/yunohost.options"
|
ynh_config_add --template="jvm.options" --destination="$install_dir/config/jvm.options.d/yunohost.options"
|
||||||
|
|
||||||
chmod 400 "$install_dir/config/opensearch.yml" "$install_dir/config/jvm.options.d/yunohost.options"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/config/opensearch.yml" "$install_dir/config/jvm.options.d/yunohost.options"
|
||||||
chown "$app:$app" "$install_dir/config/opensearch.yml" "$install_dir/config/jvm.options.d/yunohost.options"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app:$app" "$install_dir/config/opensearch.yml" "$install_dir/config/jvm.options.d/yunohost.options"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INCREASE MAX_MAP_COUNT
|
# INCREASE MAX_MAP_COUNT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Increasing maximum map count (sysctl)..."
|
ynh_script_progression "Increasing maximum map count (sysctl)..."
|
||||||
|
|
||||||
if [ "${container:-}" != "lxc" ]; then # lxc doesn't allow sysctl to play with kernel options.
|
if [ "${container:-}" != "lxc" ]; then # lxc doesn't allow sysctl to play with kernel options.
|
||||||
# Increase the maximum number of files inotify can monitor.
|
# Increase the maximum number of files inotify can monitor.
|
||||||
ynh_add_config --template="90-max_map_count-opensearch.conf" --destination="/etc/sysctl.d/"
|
ynh_config_add --template="90-max_map_count-opensearch.conf" --destination="/etc/sysctl.d/"
|
||||||
|
|
||||||
# Then, reload the kernel configuration.
|
# Then, reload the kernel configuration.
|
||||||
sysctl -p /etc/sysctl.d/90-max_map_count-opensearch.conf
|
sysctl -p /etc/sysctl.d/90-max_map_count-opensearch.conf
|
||||||
|
@ -58,25 +57,25 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# SYSTEM CONFIGURATION
|
# SYSTEM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
ynh_script_progression "Adding system configurations related to $app..."
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_config_add_systemd
|
||||||
yunohost service add "$app" --description="OpenSearch - Open source distributed and RESTful search engine" --log="/var/log/$app/$app.log"
|
yunohost service add "$app" --description="OpenSearch - Open source distributed and RESTful search engine" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate
|
ynh_config_add_logrotate
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemctl --service="$app" --action="start"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of $app completed" --last
|
ynh_script_progression "Installation of $app completed"
|
||||||
|
|
|
@ -10,26 +10,26 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SYSTEM CONFIGURATIONS
|
# REMOVE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
ynh_script_progression "Removing system configurations related to $app..."
|
||||||
|
|
||||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||||
if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
|
if ynh_hide_warnings yunohost service status "$app" >/dev/null; then
|
||||||
yunohost service remove "$app"
|
yunohost service remove "$app"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove the dedicated systemd config
|
# Remove the dedicated systemd config
|
||||||
ynh_remove_systemd_config
|
ynh_config_remove_systemd
|
||||||
|
|
||||||
# Remove the app-specific logrotate config
|
# Remove the app-specific logrotate config
|
||||||
ynh_remove_logrotate
|
ynh_config_remove_logrotate
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE VARIOUS FILES
|
# REMOVE VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing various files..."
|
ynh_script_progression "Removing various files..."
|
||||||
|
|
||||||
if [ -e "/etc/sysctl.d/90-max_map_count-opensearch.conf" ]; then
|
if [ -e "/etc/sysctl.d/90-max_map_count-opensearch.conf" ]; then
|
||||||
ynh_secure_remove --file="/etc/sysctl.d/90-max_map_count-opensearch.conf"
|
ynh_safe_rm "/etc/sysctl.d/90-max_map_count-opensearch.conf"
|
||||||
# Reload the kernel configuration.
|
# Reload the kernel configuration.
|
||||||
if ! [ "${container:-}" = "lxc" ]; then # lxc doesn't allow sysctl to play with kernel options.
|
if ! [ "${container:-}" = "lxc" ]; then # lxc doesn't allow sysctl to play with kernel options.
|
||||||
sysctl --system
|
sysctl --system
|
||||||
|
@ -40,4 +40,4 @@ fi
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Removal of $app completed" --last
|
ynh_script_progression "Removal of $app completed"
|
||||||
|
|
|
@ -11,19 +11,18 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
ynh_script_progression "Restoring the app main directory..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$install_dir"
|
ynh_restore "$install_dir"
|
||||||
|
|
||||||
chmod -R o-rwx "$install_dir"
|
|
||||||
chown -R "$app:www-data" "$install_dir"
|
|
||||||
|
|
||||||
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
||||||
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE DATA DIRECTORY
|
# RESTORE THE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
ynh_script_progression "Restoring the data directory..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
ynh_restore "$data_dir"
|
||||||
|
|
||||||
chmod -R o-rwx "$data_dir"
|
chmod -R o-rwx "$data_dir"
|
||||||
chown -R "$app:www-data" "$data_dir"
|
chown -R "$app:www-data" "$data_dir"
|
||||||
|
@ -31,33 +30,33 @@ chown -R "$app:www-data" "$data_dir"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE VARIOUS FILES
|
# RESTORE VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring various files..."
|
ynh_script_progression "Restoring various files..."
|
||||||
|
|
||||||
if [ "${container:-}" != "lxc" ]; then # lxc doesn't allow sysctl to play with kernel options.
|
if [ "${container:-}" != "lxc" ]; then # lxc doesn't allow sysctl to play with kernel options.
|
||||||
ynh_restore_file --origin_path="/etc/sysctl.d/90-max_map_count-opensearch.conf"
|
ynh_restore "/etc/sysctl.d/90-max_map_count-opensearch.conf"
|
||||||
sysctl -p /etc/sysctl.d/90-max_map_count-opensearch.conf
|
sysctl -p /etc/sysctl.d/90-max_map_count-opensearch.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEM CONFIGURATIONS
|
# RESTORE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
ynh_script_progression "Restoring system configurations related to $app..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
ynh_restore "/etc/systemd/system/$app.service"
|
||||||
systemctl enable "$app.service" --quiet
|
systemctl enable "$app.service" --quiet
|
||||||
yunohost service add "$app" --description="OpenSearch - Open source distributed and RESTful search engine" --log="/var/log/$app/$app.log"
|
yunohost service add "$app" --description="OpenSearch - Open source distributed and RESTful search engine" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
ynh_restore "/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
ynh_script_progression "Reloading NGINX web server and $app's service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemctl --service="$app" --action="start"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Restoration completed for $app" --last
|
ynh_script_progression "Restoration completed for $app"
|
||||||
|
|
|
@ -10,40 +10,39 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP SYSTEMD SERVICE
|
# STOP SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping $app's systemd service..." --weight=1
|
ynh_script_progression "Stopping $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log"
|
ynh_systemctl --service="$app" --action="stop"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=20
|
ynh_script_progression "Upgrading source files..."
|
||||||
|
|
||||||
# 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="$install_dir" --full_replace=1 --keep="config/opensearch.yml config/jvm.options.d/yunohost.conf"
|
ynh_setup_source --dest_dir="$install_dir" --full_replace --keep="config/opensearch.yml config/jvm.options.d/yunohost.conf"
|
||||||
|
|
||||||
chmod -R o-rwx "$install_dir"
|
|
||||||
chown -R "$app:$app" "$install_dir"
|
|
||||||
|
|
||||||
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
||||||
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:$app" "$install_dir"
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
ynh_script_progression "Updating configuration..."
|
||||||
|
|
||||||
ynh_add_config --template="opensearch.yml" --destination="$install_dir/config/opensearch.yml"
|
ynh_config_add --template="opensearch.yml" --destination="$install_dir/config/opensearch.yml"
|
||||||
ynh_add_config --template="jvm.options" --destination="$install_dir/config/jvm.options.d/yunohost.options"
|
ynh_config_add --template="jvm.options" --destination="$install_dir/config/jvm.options.d/yunohost.options"
|
||||||
|
|
||||||
chmod 400 "$install_dir/config/opensearch.yml" "$install_dir/config/jvm.options.d/yunohost.options"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/config/opensearch.yml" "$install_dir/config/jvm.options.d/yunohost.options"
|
||||||
chown "$app:$app" "$install_dir/config/opensearch.yml" "$install_dir/config/jvm.options.d/yunohost.options"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app:$app" "$install_dir/config/opensearch.yml" "$install_dir/config/jvm.options.d/yunohost.options"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INCREASE MAX_MAP_COUNT
|
# INCREASE MAX_MAP_COUNT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Increasing maximum map count (sysctl)..."
|
ynh_script_progression "Increasing maximum map count (sysctl)..."
|
||||||
|
|
||||||
if [ "${container:-}" != "lxc" ]; then # lxc doesn't allow sysctl to play with kernel options.
|
if [ "${container:-}" != "lxc" ]; then # lxc doesn't allow sysctl to play with kernel options.
|
||||||
# Increase the maximum number of files inotify can monitor.
|
# Increase the maximum number of files inotify can monitor.
|
||||||
ynh_add_config --template="90-max_map_count-opensearch.conf" --destination="/etc/sysctl.d/"
|
ynh_config_add --template="90-max_map_count-opensearch.conf" --destination="/etc/sysctl.d/"
|
||||||
|
|
||||||
# Then, reload the kernel configuration.
|
# Then, reload the kernel configuration.
|
||||||
sysctl -p /etc/sysctl.d/90-max_map_count-opensearch.conf
|
sysctl -p /etc/sysctl.d/90-max_map_count-opensearch.conf
|
||||||
|
@ -52,24 +51,24 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# REAPPLY SYSTEM CONFIGURATIONS
|
# REAPPLY SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
ynh_script_progression "Upgrading system configurations related to $app..."
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_config_add_systemd
|
||||||
yunohost service add "$app" --description="OpenSearch - Open source distributed and RESTful search engine" --log="/var/log/$app/$app.log"
|
yunohost service add "$app" --description="OpenSearch - Open source distributed and RESTful search engine" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
# Use logrotate to manage app-specific logfile(s)
|
# Use logrotate to manage app-specific logfile(s)
|
||||||
ynh_use_logrotate --non-append
|
ynh_config_add_logrotate
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemctl --service="$app" --action="start"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
ynh_script_progression "Upgrade of $app completed"
|
||||||
|
|
Loading…
Add table
Reference in a new issue