mirror of
https://github.com/YunoHost-Apps/gitlab_ynh.git
synced 2024-09-03 18:36:35 +02:00
puma is automatically configured
This commit is contained in:
parent
f18afe6ffb
commit
dd7ab571db
4 changed files with 14 additions and 61 deletions
|
@ -1190,9 +1190,9 @@ gitlab_rails['gitlab_shell_ssh_port'] = __SSH_PORT__
|
|||
# puma['enable'] = true
|
||||
# puma['ha'] = false
|
||||
# puma['worker_timeout'] = 60
|
||||
puma['worker_processes'] = __PUMA_WORKER_PROCESSES__
|
||||
puma['min_threads'] = __PUMA_MIN_THREADS__
|
||||
puma['max_threads'] = __PUMA_MAX_THREADS__
|
||||
# puma['worker_processes'] = 2
|
||||
# puma['min_threads'] = 4
|
||||
# puma['max_threads'] = 4
|
||||
|
||||
### Advanced settings
|
||||
# puma['listen'] = '127.0.0.1'
|
||||
|
|
|
@ -44,33 +44,6 @@ ynh_app_setting_set --app=$app --key=overwrite_nginx --value="1"
|
|||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# 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
|
||||
|
||||
# If the server has less than 2GB of RAM
|
||||
if [ $(ynh_get_ram --total --ignore_swap) -lt 2048 ]; then
|
||||
puma_min_threads=1
|
||||
puma_max_threads=1
|
||||
else
|
||||
puma_min_threads=2
|
||||
puma_max_threads=4
|
||||
fi
|
||||
|
||||
ynh_app_setting_set --app=$app --key=puma_worker_processes --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
|
||||
|
||||
#=================================================
|
||||
# ADD SWAP IF NEEDED
|
||||
#=================================================
|
||||
|
|
|
@ -28,20 +28,19 @@ fi
|
|||
config_path=/etc/$app
|
||||
chmod 755 $install_dir
|
||||
|
||||
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
|
||||
puma_max_threads=1
|
||||
else
|
||||
puma_min_threads=2
|
||||
puma_max_threads=4
|
||||
fi
|
||||
if [ -n $(ynh_app_setting_get --app=$app --key=puma_worker_processes) ]
|
||||
then
|
||||
ynh_app_setting_delete --app=$app --key=puma_worker_processes
|
||||
fi
|
||||
|
||||
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
|
||||
if [ -n $(ynh_app_setting_get --app=$app --key=puma_max_threads) ]
|
||||
then
|
||||
ynh_app_setting_delete --app=$app --key=puma_max_threads
|
||||
fi
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=unicorn_worker_processes
|
||||
if [ -n $(ynh_app_setting_get --app=$app --key=puma_min_threads) ]
|
||||
then
|
||||
ynh_app_setting_delete --app=$app --key=puma_min_threads
|
||||
fi
|
||||
|
||||
# If architecture doesn't exist, create it
|
||||
|
@ -74,22 +73,6 @@ fi
|
|||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# 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_worker_processes --value=$puma_worker_processes
|
||||
|
||||
#=================================================
|
||||
# ADD SWAP IF NEEDED
|
||||
#=================================================
|
||||
|
|
|
@ -128,9 +128,6 @@ EOS"
|
|||
sed -i "s/# gitlab_rails\['gitlab_shell_ssh_port'\] = 22/gitlab_rails['gitlab_shell_ssh_port'] = __SSH_PORT__/" $conf_file
|
||||
|
||||
# Change puma settings
|
||||
sed -i "s/# puma\['worker_processes'\] = .*/puma['worker_processes'] = __PUMA_WORKER_PROCESSES__/" $conf_file
|
||||
sed -i "s/# puma\['min_threads'\] = .*/puma['min_threads'] = __PUMA_MIN_THREADS__/" $conf_file
|
||||
sed -i "s/# puma\['max_threads'\] = .*/puma['max_threads'] = __PUMA_MAX_THREADS__/" $conf_file
|
||||
sed -i "s/# puma\['port'\] = .*/puma['port'] = __PORT_PUMA__/" $conf_file
|
||||
|
||||
# Change sidekiq settings
|
||||
|
|
Loading…
Add table
Reference in a new issue