mirror of
https://github.com/YunoHost-Apps/gitlab_ynh.git
synced 2024-09-03 18:36:35 +02:00
Merge pull request #39 from YunoHost-Apps/unicorn-workers
worker_processes according to the doc
This commit is contained in:
commit
1419e821d8
4 changed files with 35 additions and 1 deletions
|
@ -23,6 +23,7 @@ nginx['listen_addresses'] = ["0.0.0.0", "[::]"] # listen on all IPv4 and IPv6 ad
|
|||
|
||||
unicorn['port'] = __PORTUNICORN__
|
||||
|
||||
unicorn['worker_processes'] = 2
|
||||
# https://docs.gitlab.com/ee/install/requirements.html#unicorn-workers
|
||||
unicorn['worker_processes'] = __UNICORN_WORKER_PROCESSES__
|
||||
|
||||
sidekiq['concurrency'] = 5 # base: 25
|
||||
|
|
|
@ -31,6 +31,7 @@ final_path=$(ynh_app_setting_get $app final_path)
|
|||
config_path=$(ynh_app_setting_get $app config_path)
|
||||
port=$(ynh_app_setting_get "$app" web_port)
|
||||
portUnicorn=$(ynh_app_setting_get "$app" unicorn_port)
|
||||
unicorn_worker_processes=$(ynh_app_setting_get "$app" unicorn_worker_processes)
|
||||
|
||||
#=================================================
|
||||
# CHECK THE SYNTAX OF THE PATHS
|
||||
|
@ -111,6 +112,7 @@ path_url="$new_path"
|
|||
ynh_replace_string "__GENERATED_EXTERNAL_URL__" "https://$domain${path_url%/}" "$config_path/gitlab.rb"
|
||||
ynh_replace_string "__PORT__" "$port" "$config_path/gitlab.rb"
|
||||
ynh_replace_string "__PORTUNICORN__" "$portUnicorn" "$config_path/gitlab.rb"
|
||||
ynh_replace_string "__UNICORN_WORKER_PROCESSES__" "$unicorn_worker_processes" "$config_path/gitlab.rb"
|
||||
|
||||
ynh_store_file_checksum "$config_path/gitlab.rb"
|
||||
|
||||
|
|
|
@ -54,6 +54,18 @@ else
|
|||
your hardware and the result of the command \"uname -m\"." 1
|
||||
fi
|
||||
|
||||
# https://docs.gitlab.com/ee/install/requirements.html#unicorn-workers
|
||||
unicorn_worker_processes=$(($(nproc) + 1 ))
|
||||
|
||||
# If the server has at least 2GB of RAM
|
||||
if [ $(free -g --si | grep Mem: | awk '{print $2}') -ge 2 ]; then
|
||||
# Min 3 worker processes
|
||||
unicorn_worker_processes=$(($unicorn_worker_processes>3?$unicorn_worker_processes:3))
|
||||
else
|
||||
# 2 worker processes
|
||||
unicorn_worker_processes=2
|
||||
fi
|
||||
|
||||
path_url=$(ynh_normalize_url_path $path_url)
|
||||
|
||||
# Register (book) web path
|
||||
|
@ -71,6 +83,7 @@ ynh_app_setting_set $app use_web_account $use_web_account
|
|||
ynh_app_setting_set $app final_path $final_path
|
||||
ynh_app_setting_set $app config_path $config_path
|
||||
ynh_app_setting_set $app architecture $architecture
|
||||
ynh_app_setting_set $app unicorn_worker_processes $unicorn_worker_processes
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
|
@ -108,6 +121,7 @@ cp -f ../conf/gitlab.rb "$config_path/gitlab.rb"
|
|||
ynh_replace_string "__GENERATED_EXTERNAL_URL__" "https://$domain${path_url%/}" "$config_path/gitlab.rb"
|
||||
ynh_replace_string "__PORT__" "$port" "$config_path/gitlab.rb"
|
||||
ynh_replace_string "__PORTUNICORN__" "$portUnicorn" "$config_path/gitlab.rb"
|
||||
ynh_replace_string "__UNICORN_WORKER_PROCESSES__" "$unicorn_worker_processes" "$config_path/gitlab.rb"
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
|
|
|
@ -28,6 +28,7 @@ config_path=$(ynh_app_setting_get $app config_path)
|
|||
port=$(ynh_app_setting_get "$app" web_port)
|
||||
portUnicorn=$(ynh_app_setting_get "$app" unicorn_port)
|
||||
architecture=$(ynh_app_setting_get "$app" architecture)
|
||||
unicorn_worker_processes=$(ynh_app_setting_get "$app" unicorn_worker_processes)
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
|
@ -54,6 +55,21 @@ if [ -z "$config_path" ]; then
|
|||
ynh_app_setting_set $app config_path $config_path
|
||||
fi
|
||||
|
||||
if [ -z "$unicorn_worker_processes" ]; then
|
||||
# https://docs.gitlab.com/ee/install/requirements.html#unicorn-workers
|
||||
unicorn_worker_processes=$(($(nproc) + 1 ))
|
||||
|
||||
# If the server has at least 2GB of RAM
|
||||
if [ $(free -g --si | grep Mem: | awk '{print $2}') -ge 2 ]; then
|
||||
# Min 3 worker processes
|
||||
unicorn_worker_processes=$(($unicorn_worker_processes>3?$unicorn_worker_processes:3))
|
||||
else
|
||||
# 2 worker processes
|
||||
unicorn_worker_processes=2
|
||||
fi
|
||||
ynh_app_setting_set $app unicorn_worker_processes $unicorn_worker_processes
|
||||
fi
|
||||
|
||||
# If architecture doesn't exist, create it
|
||||
if [ -z "$architecture" ]; then
|
||||
# Detect the system architecture
|
||||
|
@ -151,6 +167,7 @@ cp -f ../conf/gitlab.rb "$config_path/gitlab.rb"
|
|||
ynh_replace_string "__GENERATED_EXTERNAL_URL__" "https://$domain${path_url%/}" "$config_path/gitlab.rb"
|
||||
ynh_replace_string "__PORT__" "$port" "$config_path/gitlab.rb"
|
||||
ynh_replace_string "__PORTUNICORN__" "$portUnicorn" "$config_path/gitlab.rb"
|
||||
ynh_replace_string "__UNICORN_WORKER_PROCESSES__" "$unicorn_worker_processes" "$config_path/gitlab.rb"
|
||||
|
||||
ynh_store_file_checksum "$config_path/gitlab.rb"
|
||||
|
||||
|
|
Loading…
Reference in a new issue