1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gitlab_ynh.git synced 2024-09-03 18:36:35 +02:00

Update requirements

This commit is contained in:
Kay0u 2021-02-23 13:52:33 +01:00
parent cfd028b9fb
commit 2e142769d3
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D
2 changed files with 33 additions and 25 deletions

View file

@ -104,11 +104,18 @@ ynh_install_app_dependencies $pkg_dependencies
# DEFINE THE NUMBER OF WORKERS USED # DEFINE THE NUMBER OF WORKERS USED
#================================================= #=================================================
total_memory=$(ynh_get_ram --total)
if [ $total_memory -lt 4096 ]; then
#https://docs.gitlab.com/omnibus/settings/puma.html#running-in-memory-constrained-environments
puma_worker_processes=0
else
#https://docs.gitlab.com/ce/install/requirements.html#puma-workers #https://docs.gitlab.com/ce/install/requirements.html#puma-workers
puma_worker_processes=$(( $(nproc) > 2 ? $(nproc) : 2 )) puma_worker_processes=$(( $(nproc) > 2 ? $(($(nproc) - 1)) : 2 ))
fi
# If the server has less than 2GB of RAM # If the server has less than 2GB of RAM
if [ $(ynh_get_ram --total --ignore_swap) -lt 2000 ]; then if [ $(ynh_get_ram --total --ignore_swap) -lt 2048 ]; then
puma_min_threads=1 puma_min_threads=1
puma_max_threads=1 puma_max_threads=1
else else
@ -124,19 +131,13 @@ ynh_app_setting_set --app=$app --key=puma_min_threads --value=$puma_min_threads
# ADD SWAP IF NEEDED # ADD SWAP IF NEEDED
#================================================= #=================================================
total_memory=$(ynh_get_ram --total)
total_swap=$(ynh_get_ram --total --only_swap) total_swap=$(ynh_get_ram --total --only_swap)
swap_needed=0 swap_needed=0
# https://docs.gitlab.com/ce/install/requirements.html#memory # https://docs.gitlab.com/ce/install/requirements.html#memory
if [ $total_memory -lt 8192 ]; then
# Need a minimum of 8Go of memory
swap_needed=$((8192 - $total_memory))
fi
# Need at least 2Go of swap # Need at least 2Go of swap
if [ $(($total_swap + $swap_needed)) -lt 2048 ]; then if [ $total_swap -lt 2048 ]; then
swap_needed=$((2048 - $total_swap)) swap_needed=$((2048 - total_swap))
fi fi
if [ $swap_needed -gt 0 ]; then if [ $swap_needed -gt 0 ]; then

View file

@ -58,10 +58,7 @@ if [ -z "$config_path" ]; then
ynh_app_setting_set --app=$app --key=config_path --value=$config_path ynh_app_setting_set --app=$app --key=config_path --value=$config_path
fi fi
if [ -z "$puma_worker_processes" ]; then if [ -z "$puma_max_threads" ] || [ -z "$puma_min_threads" ]; then
#https://docs.gitlab.com/ce/install/requirements.html#puma-workers
puma_worker_processes=$(( $(nproc) > 2 ? $(nproc) : 2 ))
# If the server has less than 2GB of RAM # If the server has less than 2GB of RAM
if [ $(ynh_get_ram --total --ignore_swap) -lt 2000 ]; then if [ $(ynh_get_ram --total --ignore_swap) -lt 2000 ]; then
puma_min_threads=1 puma_min_threads=1
@ -71,7 +68,6 @@ if [ -z "$puma_worker_processes" ]; then
puma_max_threads=4 puma_max_threads=4
fi fi
ynh_app_setting_set --app=$app --key=puma_workers --value=$puma_worker_processes
ynh_app_setting_set --app=$app --key=puma_max_threads --value=$puma_max_threads ynh_app_setting_set --app=$app --key=puma_max_threads --value=$puma_max_threads
ynh_app_setting_set --app=$app --key=puma_min_threads --value=$puma_min_threads ynh_app_setting_set --app=$app --key=puma_min_threads --value=$puma_min_threads
@ -178,26 +174,37 @@ ynh_script_progression --message="Installing dependencies..." --weight=5
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# ADD SWAP IF NEEDED # DEFINE THE NUMBER OF WORKERS USED
#================================================= #=================================================
total_memory=$(ynh_get_ram --total) total_memory=$(ynh_get_ram --total)
if [ $total_memory -lt 4096 ]; then
#https://docs.gitlab.com/omnibus/settings/puma.html#running-in-memory-constrained-environments
puma_worker_processes=0
else
#https://docs.gitlab.com/ce/install/requirements.html#puma-workers
puma_worker_processes=$(( $(nproc) > 2 ? $(($(nproc) - 1)) : 2 ))
fi
ynh_app_setting_set --app=$app --key=puma_workers --value=$puma_worker_processes
#=================================================
# ADD SWAP IF NEEDED
#=================================================
total_swap=$(ynh_get_ram --total --only_swap) total_swap=$(ynh_get_ram --total --only_swap)
swap_needed=0 swap_needed=0
# https://docs.gitlab.com/ce/install/requirements.html#memory
if [ $total_memory -lt 8192 ]; then
# Need a minimum of 8Go of memory
swap_needed=$((8192 - $total_memory))
fi
# Need at least 2Go of swap # Need at least 2Go of swap
if [ $(($total_swap + $swap_needed)) -lt 2048 ]; then if [ $(($total_swap + $swap_needed)) -lt 2048 ]; then
swap_needed=$((2048 - $total_swap)) swap_needed=$((2048 - $total_swap))
fi fi
ynh_script_progression --message="Adding $swap_needed Mo to swap..." --weight=1 if [ $swap_needed -gt 0 ]; then
ynh_script_progression --message="Adding $swap_needed Mo to swap..."
ynh_add_swap --size=$swap_needed ynh_add_swap --size=$swap_needed
fi
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE