mirror of
https://github.com/YunoHost-Apps/gitlab_ynh.git
synced 2024-09-03 18:36:35 +02:00
73 lines
2.4 KiB
Bash
73 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#configuring-the-external-url-for-gitlab
|
|
|
|
gitlab-ctl stop puma
|
|
gitlab-ctl stop sidekiq
|
|
|
|
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
|
|
|
|
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
|
|
#=================================================
|
|
|
|
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
|