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:
parent
cfd028b9fb
commit
2e142769d3
2 changed files with 33 additions and 25 deletions
|
@ -104,11 +104,18 @@ ynh_install_app_dependencies $pkg_dependencies
|
|||
# DEFINE THE NUMBER OF WORKERS USED
|
||||
#=================================================
|
||||
|
||||
#https://docs.gitlab.com/ce/install/requirements.html#puma-workers
|
||||
puma_worker_processes=$(( $(nproc) > 2 ? $(nproc) : 2 ))
|
||||
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
|
||||
|
||||
# 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_max_threads=1
|
||||
else
|
||||
|
@ -124,19 +131,13 @@ ynh_app_setting_set --app=$app --key=puma_min_threads --value=$puma_min_threads
|
|||
# ADD SWAP IF NEEDED
|
||||
#=================================================
|
||||
|
||||
total_memory=$(ynh_get_ram --total)
|
||||
total_swap=$(ynh_get_ram --total --only_swap)
|
||||
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
|
||||
if [ $(($total_swap + $swap_needed)) -lt 2048 ]; then
|
||||
swap_needed=$((2048 - $total_swap))
|
||||
if [ $total_swap -lt 2048 ]; then
|
||||
swap_needed=$((2048 - total_swap))
|
||||
fi
|
||||
|
||||
if [ $swap_needed -gt 0 ]; then
|
||||
|
|
|
@ -58,10 +58,7 @@ if [ -z "$config_path" ]; then
|
|||
ynh_app_setting_set --app=$app --key=config_path --value=$config_path
|
||||
fi
|
||||
|
||||
if [ -z "$puma_worker_processes" ]; then
|
||||
#https://docs.gitlab.com/ce/install/requirements.html#puma-workers
|
||||
puma_worker_processes=$(( $(nproc) > 2 ? $(nproc) : 2 ))
|
||||
|
||||
if [ -z "$puma_max_threads" ] || [ -z "$puma_min_threads" ]; then
|
||||
# If the server has less than 2GB of RAM
|
||||
if [ $(ynh_get_ram --total --ignore_swap) -lt 2000 ]; then
|
||||
puma_min_threads=1
|
||||
|
@ -71,7 +68,6 @@ if [ -z "$puma_worker_processes" ]; then
|
|||
puma_max_threads=4
|
||||
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_min_threads --value=$puma_min_threads
|
||||
|
||||
|
@ -178,26 +174,37 @@ ynh_script_progression --message="Installing dependencies..." --weight=5
|
|||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# ADD SWAP IF NEEDED
|
||||
# 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
|
||||
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)
|
||||
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
|
||||
if [ $(($total_swap + $swap_needed)) -lt 2048 ]; then
|
||||
swap_needed=$((2048 - $total_swap))
|
||||
fi
|
||||
|
||||
ynh_script_progression --message="Adding $swap_needed Mo to swap..." --weight=1
|
||||
ynh_add_swap --size=$swap_needed
|
||||
if [ $swap_needed -gt 0 ]; then
|
||||
ynh_script_progression --message="Adding $swap_needed Mo to swap..."
|
||||
ynh_add_swap --size=$swap_needed
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
|
Loading…
Add table
Reference in a new issue