#!/bin/bash source _common.sh source /usr/share/yunohost/helpers #================================================= # MODIFY URL IN NGINX CONF #================================================= ynh_script_progression "Updating NGINX web server configuration..." #doc in: https://docs.gitlab.com/omnibus/settings/configuration.html#configure-the-external-url-for-gitlab ynh_config_change_url_nginx #================================================= # 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 ! sysctl --write $value_to_check="$(sysctl --value $value_to_check)"; then modify_kernel_parameters="false" break fi done #================================================= # CONFIGURE GITLAB #================================================= ynh_script_progression "Configure GitLab..." 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_config_add --template="$YNH_APP_BASEDIR/conf/gitlab.rb" --destination="$config_path/gitlab.rb" #================================================= # RECONFIGURE GITLAB #================================================= ynh_hide_warnings gitlab-ctl reconfigure #================================================= # WAITING GITLAB #================================================= ynh_script_progression "Waiting for GitLab..." ynh_systemctl --action=restart --service="gitlab-runsvdir" --log_path="/var/log/$app/puma/current" --wait_until="Listening on http://127.0.0.1:$port_puma" --timeout=300 #================================================= # END OF SCRIPT #================================================= ynh_script_progression "Change of URL completed for GitLab"