diff --git a/conf/lutim.conf.template b/conf/lutim.conf.template index 5a6f5f5..f434f7d 100644 --- a/conf/lutim.conf.template +++ b/conf/lutim.conf.template @@ -11,6 +11,9 @@ # if you use Lutim behind a reverse proxy like Nginx, you want to set proxy to 1 # if you use Lutim directly, let it commented proxy => 1, + + # Number of worker processes + workers => __WORKERS__, }, ################ diff --git a/scripts/actions/reset_default_config b/scripts/actions/reset_default_config index 1c37b5a..d68db89 100755 --- a/scripts/actions/reset_default_config +++ b/scripts/actions/reset_default_config @@ -52,6 +52,8 @@ then ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config_file" ynh_replace_string --match_string="__ENCRYPT__" --replace_string="$always_encrypt" --target_file="$config_file" ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="$config_file" + # Set the number of process for Lutim to twice the number of CPU core. + ynh_replace_string --match_string="__WORKERS__" --replace_string="$(( $(nproc) * 2 ))" --target_file="$final_path/lutim.conf" fi # Calculate and store the config file checksum into the app settings diff --git a/scripts/install b/scripts/install index 1b1d74d..55f3b12 100644 --- a/scripts/install +++ b/scripts/install @@ -116,6 +116,8 @@ ynh_replace_string --match_string="__ENCRYPT__" --replace_string="$always_encryp secret=$(ynh_string_random) ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="$final_path/lutim.conf" ynh_app_setting_set --app=$app --key=secret --value="$secret" +# Set the number of process for Lutim to twice the number of CPU core. +ynh_replace_string --match_string="__WORKERS__" --replace_string="$(( $(nproc) * 2 ))" --target_file="$final_path/lutim.conf" # Calculate and store the config file checksum into the app settings ynh_store_file_checksum --file="$final_path/lutim.conf" diff --git a/scripts/upgrade b/scripts/upgrade index abd823e..1bde983 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -188,6 +188,8 @@ then ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/lutim.conf" ynh_replace_string --match_string="__ENCRYPT__" --replace_string="$always_encrypt" --target_file="$final_path/lutim.conf" ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="$final_path/lutim.conf" + # Set the number of process for Lutim to twice the number of CPU core. + ynh_replace_string --match_string="__WORKERS__" --replace_string="$(( $(nproc) * 2 ))" --target_file="$final_path/lutim.conf" # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="$final_path/lutim.conf"