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

fix upgrade

This commit is contained in:
Kay0u 2021-06-24 16:31:46 +02:00
parent a011277fa1
commit c0c5ce5834
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D
2 changed files with 2902 additions and 19 deletions

2865
conf/gitlab.13.rb Normal file

File diff suppressed because it is too large Load diff

View file

@ -203,6 +203,27 @@ if [ $swap_needed -gt 0 ]; then
fi
fi
#=================================================
# CHECK IF KERNEL IS READ-ONLY
#=================================================
modify_kernel_parameters="true"
for value_to_check in "kernel.shmall" "kernel.shmmax" "kernel.sem" "net.core.somaxconn"
do
if ! ynh_exec_fully_quiet sysctl --write $value_to_check="$(sysctl --value $value_to_check)"; then
modify_kernel_parameters="false"
break
fi
done
# For gitlab rb
mkdir -p $config_path
ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+")
generated_external_url="https://$domain${path_url%/}"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -274,33 +295,30 @@ then
ynh_exec_warn_less ynh_secure_remove --file="$tempdir"
current_version=$(grep gitlab-ce /opt/gitlab/version-manifest.txt | cut -d' ' -f2)
done
# Sometimes we need to update the gitlab.rb configuration file in order to migrate to the next version.
if [ -e "$YNH_APP_BASEDIR/conf/gitlab.$current_major_version.rb" ]; then
if [ -e "$YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.$current_major_version.last.sh" ]; then
source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.$current_major_version.last.sh
fi
if dpkg --compare-versions "$gitlab_version" "ge" "$current_version"; then
ynh_add_config --template="$YNH_APP_BASEDIR/conf/gitlab.$current_major_version.rb" --destination="$config_path/gitlab.rb"
#=================================================
# CHECK IF KERNEL IS READ-ONLY
#=================================================
touch "$config_path/gitlab-persistent.rb"
chown root:root "$config_path/gitlab-persistent.rb"
chmod 640 "$config_path/gitlab-persistent.rb"
modify_kernel_parameters="true"
for value_to_check in "kernel.shmall" "kernel.shmmax" "kernel.sem" "net.core.somaxconn"
do
if ! ynh_exec_fully_quiet sysctl --write $value_to_check="$(sysctl --value $value_to_check)"; then
modify_kernel_parameters="false"
break
gitlab-ctl reconfigure
fi
fi
done
fi
#=================================================
# RECONFIGURE GITLAB
#=================================================
ynh_script_progression --message="Reconfigure GitLab..." --weight=13
mkdir -p $config_path
ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+")
generated_external_url="https://$domain${path_url%/}"
ynh_add_config --template="$YNH_APP_BASEDIR/conf/gitlab.rb" --destination="$config_path/gitlab.rb"
touch "$config_path/gitlab-persistent.rb"