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

71 lines
2.4 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
#doc in: https://docs.gitlab.com/omnibus/settings/configuration.html#configure-the-external-url-for-gitlab
ynh_change_url_nginx_config
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# 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
#=================================================
# CONFIGURE GITLAB
#=================================================
ynh_script_progression --message="Configure GitLab..." --weight=28
config_path=/etc/$app
mkdir -p $config_path
ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+")
domain="$new_domain"
path="$new_path"
generated_external_url="https://$domain${path%/}"
ynh_add_config --template="$YNH_APP_BASEDIR/conf/gitlab.rb" --destination="$config_path/gitlab.rb"
#=================================================
# RECONFIGURE GITLAB
#=================================================
ynh_exec_warn_less gitlab-ctl reconfigure
#=================================================
# WAITING GITLAB
#=================================================
ynh_script_progression --message="Waiting for GitLab..." --weight=15
ynh_systemd_action --action=restart --service_name="gitlab-runsvdir" --log_path="/var/log/$app/puma/current" --line_match="Listening on http://127.0.0.1:$port_puma" --timeout=300
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for GitLab" --last