1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lutim_ynh.git synced 2024-09-03 19:36:24 +02:00

Set workers according to cpu

This commit is contained in:
maniack 2020-01-02 18:42:16 +01:00
parent 51113ba754
commit 58e2919497
4 changed files with 9 additions and 0 deletions

View file

@ -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__,
},
################

View file

@ -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

View file

@ -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"

View file

@ -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"