mirror of
https://github.com/YunoHost-Apps/gitlab_ynh.git
synced 2024-09-03 18:36:35 +02:00
[autopatch] Automatic patch attempt for helpers 2.1
This commit is contained in:
parent
b63972a816
commit
337e75a9d1
9 changed files with 123 additions and 191 deletions
|
@ -18,7 +18,8 @@ code = "https://gitlab.com/gitlab-org/omnibus-gitlab - https://gitlab.com/gitlab
|
||||||
cpe = "cpe:2.3:a:gitlab:gitlab"
|
cpe = "cpe:2.3:a:gitlab:gitlab"
|
||||||
|
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = ">= 11.2.3"
|
yunohost = ">= 11.2.18"
|
||||||
|
helpers_version = "2.1"
|
||||||
architectures = ["amd64", "armhf", "arm64"]
|
architectures = ["amd64", "armhf", "arm64"]
|
||||||
multi_instance = false
|
multi_instance = false
|
||||||
ldap = true
|
ldap = true
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# EXPERIMENTAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Add swap
|
# Add swap
|
||||||
#
|
#
|
||||||
# usage: ynh_add_swap --size=SWAP in Mb
|
# usage: ynh_add_swap --size=SWAP in Mb
|
||||||
|
@ -26,7 +22,7 @@ ynh_add_swap () {
|
||||||
# Swap on SD card only if it's is specified
|
# Swap on SD card only if it's is specified
|
||||||
if ynh_is_main_device_a_sd_card && [ "$SD_CARD_CAN_SWAP" == "0" ]
|
if ynh_is_main_device_a_sd_card && [ "$SD_CARD_CAN_SWAP" == "0" ]
|
||||||
then
|
then
|
||||||
ynh_print_warn --message="The main mountpoint of your system '/' is on an SD card, swap will not be added to prevent some damage of this one, but that can cause troubles for the app $app. If you still want activate the swap, you can relaunch the command preceded by 'SD_CARD_CAN_SWAP=1'"
|
ynh_print_warn "The main mountpoint of your system '/' is on an SD card, swap will not be added to prevent some damage of this one, but that can cause troubles for the app $app. If you still want activate the swap, you can relaunch the command preceded by 'SD_CARD_CAN_SWAP=1'"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,16 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
ynh_print_info "Declaring files to be backed up..."
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Declaring files to be backed up..."
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP GITLAB DATABASE
|
# BACKUP GITLAB DATABASE
|
||||||
|
@ -30,19 +21,19 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
# For the filename: https://docs.gitlab.com/ce/raketasks/backup_restore.html#backup-filename
|
# For the filename: https://docs.gitlab.com/ce/raketasks/backup_restore.html#backup-filename
|
||||||
gitlab-backup create BACKUP=last
|
gitlab-backup create BACKUP=last
|
||||||
|
|
||||||
ynh_backup --src_path="/var/opt/$app/backups/last_gitlab_backup.tar"
|
ynh_backup "/var/opt/$app/backups/last_gitlab_backup.tar"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP CONF FILES
|
# BACKUP CONF FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
config_path=/etc/$app
|
config_path=/etc/$app
|
||||||
ynh_backup --src_path="$config_path/gitlab-secrets.json"
|
ynh_backup "$config_path/gitlab-secrets.json"
|
||||||
ynh_backup --src_path="$config_path/gitlab.rb"
|
ynh_backup "$config_path/gitlab.rb"
|
||||||
ynh_backup --src_path="$config_path/gitlab-persistent.rb"
|
ynh_backup "$config_path/gitlab-persistent.rb"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
|
@ -1,24 +1,16 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC STARTING
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
ynh_script_progression "Updating NGINX web server configuration..."
|
||||||
|
|
||||||
#doc in: https://docs.gitlab.com/omnibus/settings/configuration.html#configure-the-external-url-for-gitlab
|
#doc in: https://docs.gitlab.com/omnibus/settings/configuration.html#configure-the-external-url-for-gitlab
|
||||||
|
|
||||||
ynh_change_url_nginx_config
|
ynh_config_change_url_nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC MODIFICATIONS
|
# SPECIFIC MODIFICATIONS
|
||||||
|
@ -30,7 +22,7 @@ modify_kernel_parameters="true"
|
||||||
|
|
||||||
for value_to_check in "kernel.shmall" "kernel.shmmax" "kernel.sem" "net.core.somaxconn"
|
for value_to_check in "kernel.shmall" "kernel.shmmax" "kernel.sem" "net.core.somaxconn"
|
||||||
do
|
do
|
||||||
if ! ynh_exec_fully_quiet sysctl --write $value_to_check="$(sysctl --value $value_to_check)"; then
|
if ! sysctl --write $value_to_check="$(sysctl --value $value_to_check)"; then
|
||||||
modify_kernel_parameters="false"
|
modify_kernel_parameters="false"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
@ -39,7 +31,7 @@ done
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE GITLAB
|
# CONFIGURE GITLAB
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configure GitLab..." --weight=28
|
ynh_script_progression "Configure GitLab..."
|
||||||
|
|
||||||
config_path=/etc/$app
|
config_path=/etc/$app
|
||||||
mkdir -p $config_path
|
mkdir -p $config_path
|
||||||
|
@ -49,23 +41,23 @@ path="$new_path"
|
||||||
|
|
||||||
generated_external_url="https://$domain${path%/}"
|
generated_external_url="https://$domain${path%/}"
|
||||||
|
|
||||||
ynh_add_config --template="$YNH_APP_BASEDIR/conf/gitlab.rb" --destination="$config_path/gitlab.rb"
|
ynh_config_add --template="$YNH_APP_BASEDIR/conf/gitlab.rb" --destination="$config_path/gitlab.rb"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECONFIGURE GITLAB
|
# RECONFIGURE GITLAB
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_exec_warn_less gitlab-ctl reconfigure
|
ynh_hide_warnings gitlab-ctl reconfigure
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# WAITING GITLAB
|
# WAITING GITLAB
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Waiting for GitLab..." --weight=15
|
ynh_script_progression "Waiting for GitLab..."
|
||||||
|
|
||||||
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
|
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
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Change of URL completed for GitLab" --last
|
ynh_script_progression "Change of URL completed for GitLab"
|
||||||
|
|
|
@ -1,14 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC STARTING
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
ynh_abort_if_errors
|
#REMOVEME? ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
|
@ -28,11 +22,9 @@ set__use_web_account() {
|
||||||
echo "ApplicationSetting.last.update(password_authentication_enabled_for_web: $use_web_account, signup_enabled: $use_web_account)" | gitlab-rails console
|
echo "ApplicationSetting.last.update(password_authentication_enabled_for_web: $use_web_account, signup_enabled: $use_web_account)" | gitlab-rails console
|
||||||
|
|
||||||
# Update the config of the app
|
# Update the config of the app
|
||||||
ynh_app_setting_set --app=$app --key=use_web_account --value=$use_web_account
|
ynh_app_setting_set --key=use_web_account --value=$use_web_account
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_app_config_run $1
|
ynh_app_config_run $1
|
|
@ -1,18 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
ynh_script_progression "Validating installation parameters..."
|
||||||
|
|
||||||
config_path=/etc/$app
|
config_path=/etc/$app
|
||||||
|
|
||||||
|
@ -26,7 +20,7 @@ elif [ -n "$(uname -m | grep 86)" ]; then
|
||||||
elif [ -n "$(uname -m | grep arm)" ]; then
|
elif [ -n "$(uname -m | grep arm)" ]; then
|
||||||
architecture="arm"
|
architecture="arm"
|
||||||
else
|
else
|
||||||
ynh_die --message="Unable to detect your achitecture, please open a bug describing \
|
ynh_die "Unable to detect your achitecture, please open a bug describing \
|
||||||
your hardware and the result of the command \"uname -m\"." 1
|
your hardware and the result of the command \"uname -m\"." 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -36,14 +30,12 @@ client_max_body_size="250m"
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Storing installation settings..." --weight=2
|
ynh_script_progression "Storing installation settings..."
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=architecture --value=$architecture
|
ynh_app_setting_set --key=architecture --value=$architecture
|
||||||
ynh_app_setting_set --app=$app --key=client_max_body_size --value=$client_max_body_size
|
ynh_app_setting_set --key=client_max_body_size --value=$client_max_body_size
|
||||||
ynh_app_setting_set --app=$app --key=overwrite_nginx --value="1"
|
ynh_app_setting_set --key=overwrite_nginx --value="1"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD SWAP IF NEEDED
|
# ADD SWAP IF NEEDED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -58,9 +50,9 @@ if [ $total_ram -lt 4096 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $swap_needed -gt 0 ]; then
|
if [ $swap_needed -gt 0 ]; then
|
||||||
ynh_script_progression --message="Adding $swap_needed Mo to swap..."
|
ynh_script_progression "Adding $swap_needed Mo to swap..."
|
||||||
if ! ynh_add_swap --size=$swap_needed; then
|
if ! ynh_add_swap --size=$swap_needed; then
|
||||||
ynh_print_warn --message="Please add $swap_needed Mo to swap to make GitLab work properly"
|
ynh_print_warn "Please add $swap_needed Mo to swap to make GitLab work properly"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -72,7 +64,7 @@ modify_kernel_parameters="true"
|
||||||
|
|
||||||
for value_to_check in "kernel.shmall" "kernel.shmmax" "kernel.sem" "net.core.somaxconn"
|
for value_to_check in "kernel.shmall" "kernel.shmmax" "kernel.sem" "net.core.somaxconn"
|
||||||
do
|
do
|
||||||
if ! ynh_exec_fully_quiet sysctl --write $value_to_check="$(sysctl --value $value_to_check)"; then
|
if ! sysctl --write $value_to_check="$(sysctl --value $value_to_check)"; then
|
||||||
modify_kernel_parameters="false"
|
modify_kernel_parameters="false"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
@ -81,53 +73,52 @@ done
|
||||||
#=================================================
|
#=================================================
|
||||||
# PRECONFIGURE GITLAB
|
# PRECONFIGURE GITLAB
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Preconfigure GitLab..." --weight=1
|
ynh_script_progression "Preconfigure GitLab..."
|
||||||
|
|
||||||
mkdir -p $config_path
|
mkdir -p $config_path
|
||||||
|
|
||||||
touch "$config_path/gitlab-persistent.rb"
|
touch "$config_path/gitlab-persistent.rb"
|
||||||
chown root:root "$config_path/gitlab-persistent.rb"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown root:root "$config_path/gitlab-persistent.rb"
|
||||||
chmod 640 "$config_path/gitlab-persistent.rb"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 640 "$config_path/gitlab-persistent.rb"
|
||||||
|
|
||||||
ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+")
|
ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+")
|
||||||
|
|
||||||
generated_external_url="https://$domain${path%/}"
|
generated_external_url="https://$domain${path%/}"
|
||||||
|
|
||||||
ynh_add_config --template="$YNH_APP_BASEDIR/conf/gitlab.rb" --destination="$config_path/gitlab.rb"
|
ynh_config_add --template="$YNH_APP_BASEDIR/conf/gitlab.rb" --destination="$config_path/gitlab.rb"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=50
|
ynh_script_progression "Setting up source files..."
|
||||||
|
|
||||||
source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.last.sh
|
source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.last.sh
|
||||||
ynh_add_config --template="$YNH_APP_BASEDIR/conf/$architecture.src.default" --destination="$YNH_APP_BASEDIR/conf/$architecture.src"
|
ynh_config_add --template="$YNH_APP_BASEDIR/conf/$architecture.src.default" --destination="$YNH_APP_BASEDIR/conf/$architecture.src"
|
||||||
|
|
||||||
tempdir="$(mktemp -d)"
|
tempdir="$(mktemp -d)"
|
||||||
|
|
||||||
ynh_setup_source --dest_dir=$tempdir --source_id=$architecture
|
ynh_setup_source --dest_dir=$tempdir --source_id=$architecture
|
||||||
|
|
||||||
chmod 755 $install_dir
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 755 $install_dir
|
||||||
|
|
||||||
# https://docs.gitlab.com/omnibus/settings/configuration.html#specify-the-external-url-at-the-time-of-installation
|
# https://docs.gitlab.com/omnibus/settings/configuration.html#specify-the-external-url-at-the-time-of-installation
|
||||||
EXTERNAL_URL="$generated_external_url" ynh_exec_warn_less dpkg -i $tempdir/$gitlab_filename
|
EXTERNAL_URL="$generated_external_url" ynh_hide_warnings dpkg -i $tempdir/$gitlab_filename
|
||||||
|
|
||||||
ynh_secure_remove --file="$tempdir"
|
ynh_safe_rm "$tempdir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
ynh_script_progression "Configuring NGINX web server..."
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config client_max_body_size
|
ynh_config_add_nginx client_max_body_size
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD USER AND CONFIGURE SIGN IN SYSTEM
|
# ADD USER AND CONFIGURE SIGN IN SYSTEM
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating an administrator user..." --weight=13
|
ynh_script_progression "Creating an administrator user..."
|
||||||
|
|
||||||
mailAdmin=$(ynh_user_get_info --username=$admin --key=mail)
|
mailAdmin=$(ynh_user_get_info --username=$admin --key=mail)
|
||||||
fullnameAdmin=$(ynh_user_get_info --username=$admin --key=fullname)
|
fullnameAdmin=$(ynh_user_get_info --username=$admin --key=fullname)
|
||||||
|
@ -141,15 +132,13 @@ gitlab-rails runner "newuser = User.new(username: \"$admin\", email: \"$mailAdmi
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECONFIGURE TO TAKE INTO ACCOUNT CHANGES
|
# RECONFIGURE TO TAKE INTO ACCOUNT CHANGES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reconfigure GitLab..." --weight=13
|
ynh_script_progression "Reconfigure GitLab..."
|
||||||
|
|
||||||
ynh_exec_warn_less gitlab-ctl reconfigure
|
ynh_hide_warnings gitlab-ctl reconfigure
|
||||||
|
|
||||||
# Allow ssh for git
|
# Allow ssh for git
|
||||||
usermod -a -G "ssh.app" "git"
|
usermod -a -G "ssh.app" "git"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -160,17 +149,17 @@ yunohost service add "gitlab-runsvdir" --log "/var/log/$app/gitlab-rails/applica
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
ynh_systemctl --action=reload --service=nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTART GITLAB
|
# RESTART GITLAB
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restarting GitLab..." --weight=15
|
ynh_script_progression "Restarting GitLab..."
|
||||||
|
|
||||||
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
|
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
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of GitLab completed" --last
|
ynh_script_progression "Installation of GitLab completed"
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -16,22 +10,22 @@ source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
if yunohost service status "gitlab-runsvdir" >/dev/null 2>&1
|
if yunohost service status "gitlab-runsvdir" >/dev/null 2>&1
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app service" --weight=1
|
ynh_script_progression "Removing $app service"
|
||||||
yunohost service remove "gitlab-runsvdir"
|
yunohost service remove "gitlab-runsvdir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP GITLAB
|
# STOP GITLAB
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping GitLab" --weight=8
|
ynh_script_progression "Stopping GitLab"
|
||||||
|
|
||||||
# I use gitlab-ctl and not ynh_systemd_action or systemctl to stop the service to avoid this error: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/common_installation_problems/README.md#reconfigure-freezes-at-ruby_blocksupervise_redis_sleep-action-run during the reinstall of the app
|
# I use gitlab-ctl and not ynh_systemctl or systemctl to stop the service to avoid this error: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/common_installation_problems/README.md#reconfigure-freezes-at-ruby_blocksupervise_redis_sleep-action-run during the reinstall of the app
|
||||||
gitlab-ctl stop
|
gitlab-ctl stop
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE GITLAB
|
# REMOVE GITLAB
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing GitLab" --weight=4
|
ynh_script_progression "Removing GitLab"
|
||||||
|
|
||||||
dpkg --remove gitlab-ce
|
dpkg --remove gitlab-ce
|
||||||
|
|
||||||
|
@ -41,15 +35,15 @@ dpkg --remove gitlab-ce
|
||||||
|
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
config_path=/etc/$app
|
config_path=/etc/$app
|
||||||
ynh_secure_remove --file="$config_path"
|
ynh_safe_rm "$config_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing NGINX web server configuration" --weight=1
|
ynh_script_progression "Removing NGINX web server configuration"
|
||||||
|
|
||||||
# Remove the dedicated NGINX config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_nginx_config
|
ynh_config_remove_nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC REMOVE
|
# SPECIFIC REMOVE
|
||||||
|
@ -57,7 +51,7 @@ ynh_remove_nginx_config
|
||||||
# REMOVE GITLAB FILES
|
# REMOVE GITLAB FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_secure_remove --file="/var/opt/$app"
|
ynh_safe_rm "/var/opt/$app"
|
||||||
|
|
||||||
# Remove swap
|
# Remove swap
|
||||||
ynh_del_swap
|
ynh_del_swap
|
||||||
|
@ -66,4 +60,4 @@ ynh_del_swap
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Removal of GitLab completed" --last
|
ynh_script_progression "Removal of GitLab completed"
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
@ -16,7 +10,7 @@ source /usr/share/yunohost/helpers
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD SWAP IF NEEDED
|
# ADD SWAP IF NEEDED
|
||||||
|
@ -32,40 +26,39 @@ if [ $total_ram -lt 4096 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $swap_needed -gt 0 ]; then
|
if [ $swap_needed -gt 0 ]; then
|
||||||
ynh_script_progression --message="Adding $swap_needed Mo to swap..."
|
ynh_script_progression "Adding $swap_needed Mo to swap..."
|
||||||
if ! ynh_add_swap --size=$swap_needed; then
|
if ! ynh_add_swap --size=$swap_needed; then
|
||||||
ynh_print_warn --message="Please add $swap_needed Mo to swap to make GitLab work properly"
|
ynh_print_warn "Please add $swap_needed Mo to swap to make GitLab work properly"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE CONF FILES
|
# RESTORE CONF FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring configuration files of GitLab..." --weight=1
|
ynh_script_progression "Restoring configuration files of GitLab..."
|
||||||
|
|
||||||
config_path=/etc/$app
|
config_path=/etc/$app
|
||||||
chmod 755 $install_dir
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 755 $install_dir
|
||||||
|
ynh_restore "$config_path/gitlab-secrets.json"
|
||||||
ynh_restore_file --origin_path="$config_path/gitlab-secrets.json"
|
ynh_restore "$config_path/gitlab.rb"
|
||||||
ynh_restore_file --origin_path="$config_path/gitlab.rb"
|
ynh_restore "$config_path/gitlab-persistent.rb"
|
||||||
ynh_restore_file --origin_path="$config_path/gitlab-persistent.rb"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reinstalling GitLab..." --weight=50
|
ynh_script_progression "Reinstalling GitLab..."
|
||||||
|
|
||||||
source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.last.sh
|
source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.last.sh
|
||||||
ynh_add_config --template="$YNH_APP_BASEDIR/conf/$architecture.src.default" --destination="$YNH_APP_BASEDIR/conf/$architecture.src"
|
ynh_config_add --template="$YNH_APP_BASEDIR/conf/$architecture.src.default" --destination="$YNH_APP_BASEDIR/conf/$architecture.src"
|
||||||
|
|
||||||
tempdir="$(mktemp -d)"
|
tempdir="$(mktemp -d)"
|
||||||
|
|
||||||
ynh_setup_source --dest_dir=$tempdir --source_id=$architecture
|
ynh_setup_source --dest_dir=$tempdir --source_id=$architecture
|
||||||
|
|
||||||
if ! ynh_exec_warn_less dpkg -i $tempdir/$gitlab_filename ;
|
if ! ynh_hide_warnings dpkg -i $tempdir/$gitlab_filename ;
|
||||||
then # This command will fail in lxc env
|
then # This command will fail in lxc env
|
||||||
package_check_action # defined in upgrade.d/upgrade.last.sh
|
package_check_action # defined in upgrade.d/upgrade.last.sh
|
||||||
ynh_exec_warn_less dpkg --configure gitlab-ce
|
ynh_hide_warnings dpkg --configure gitlab-ce
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -73,9 +66,9 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE GITLAB DATABASE
|
# RESTORE GITLAB DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring GitLab..." --weight=35
|
ynh_script_progression "Restoring GitLab..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/var/opt/$app/backups/last_gitlab_backup.tar"
|
ynh_restore "/var/opt/$app/backups/last_gitlab_backup.tar"
|
||||||
|
|
||||||
last_backup="last"
|
last_backup="last"
|
||||||
|
|
||||||
|
@ -84,15 +77,13 @@ gitlab-ctl stop sidekiq
|
||||||
|
|
||||||
# Use gitlab-rake to backup
|
# Use gitlab-rake to backup
|
||||||
# Doc: https://docs.gitlab.com/ce/raketasks/backup_restore.html#restore-for-omnibus-gitlab-installations
|
# Doc: https://docs.gitlab.com/ce/raketasks/backup_restore.html#restore-for-omnibus-gitlab-installations
|
||||||
ynh_exec_warn_less gitlab-backup restore force=yes BACKUP=$last_backup
|
ynh_hide_warnings gitlab-backup restore force=yes BACKUP=$last_backup
|
||||||
|
|
||||||
# https://docs.gitlab.com/ce/raketasks/backup_restore.html#container-registry-push-failures-after-restoring-from-a-backup
|
# https://docs.gitlab.com/ce/raketasks/backup_restore.html#container-registry-push-failures-after-restoring-from-a-backup
|
||||||
if ynh_system_user_exists --username="registry" && [ -d "/var/opt/gitlab/gitlab-rails/shared/registry/docker" ]; then
|
if ynh_system_user_exists --username="registry" && [ -d "/var/opt/gitlab/gitlab-rails/shared/registry/docker" ]; then
|
||||||
chown -R registry:registry /var/opt/gitlab/gitlab-rails/shared/registry/docker
|
chown -R registry:registry /var/opt/gitlab/gitlab-rails/shared/registry/docker
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -102,9 +93,9 @@ yunohost service add "gitlab-runsvdir" --log "/var/log/$app/gitlab-rails/applica
|
||||||
#=================================================
|
#=================================================
|
||||||
# WAITING GITLAB
|
# WAITING GITLAB
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Waiting for GitLab..." --weight=14
|
ynh_script_progression "Waiting for GitLab..."
|
||||||
|
|
||||||
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
|
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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK THE RESTORED DATA
|
# CHECK THE RESTORED DATA
|
||||||
|
@ -118,12 +109,12 @@ usermod -a -G "ssh.app" "git"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
ynh_script_progression "Reloading NGINX web server..."
|
||||||
|
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
ynh_systemctl --action=reload --service=nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Restoration completed for GitLab" --last
|
ynh_script_progression "Restoration completed for GitLab"
|
||||||
|
|
104
scripts/upgrade
104
scripts/upgrade
|
@ -1,46 +1,33 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK VERSION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ -n $(ynh_app_setting_get --app=$app --key=web_port) ]
|
if [ -n $(ynh_app_setting_get --key=web_port) ]
|
||||||
then
|
then
|
||||||
ynh_app_setting_set --app=$app --key=port --value=$(ynh_app_setting_get --app=$app --key=web_port)
|
ynh_app_setting_set --key=port --value=$(ynh_app_setting_get --key=web_port)
|
||||||
ynh_app_setting_delete --app=$app --key=web_port
|
ynh_app_setting_delete --key=web_port
|
||||||
fi
|
fi
|
||||||
|
|
||||||
config_path=/etc/$app
|
config_path=/etc/$app
|
||||||
chmod 755 $install_dir
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 755 $install_dir
|
||||||
|
if [ -n $(ynh_app_setting_get --key=puma_worker_processes) ]
|
||||||
if [ -n $(ynh_app_setting_get --app=$app --key=puma_worker_processes) ]
|
|
||||||
then
|
then
|
||||||
ynh_app_setting_delete --app=$app --key=puma_worker_processes
|
ynh_app_setting_delete --key=puma_worker_processes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n $(ynh_app_setting_get --app=$app --key=puma_max_threads) ]
|
if [ -n $(ynh_app_setting_get --key=puma_max_threads) ]
|
||||||
then
|
then
|
||||||
ynh_app_setting_delete --app=$app --key=puma_max_threads
|
ynh_app_setting_delete --key=puma_max_threads
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n $(ynh_app_setting_get --app=$app --key=puma_min_threads) ]
|
if [ -n $(ynh_app_setting_get --key=puma_min_threads) ]
|
||||||
then
|
then
|
||||||
ynh_app_setting_delete --app=$app --key=puma_min_threads
|
ynh_app_setting_delete --key=puma_min_threads
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If architecture doesn't exist, create it
|
# If architecture doesn't exist, create it
|
||||||
|
@ -54,25 +41,23 @@ if [ -z "$architecture" ]; then
|
||||||
elif [ -n "$(uname -m | grep arm)" ]; then
|
elif [ -n "$(uname -m | grep arm)" ]; then
|
||||||
architecture="arm"
|
architecture="arm"
|
||||||
else
|
else
|
||||||
ynh_die --message="Unable to detect your achitecture, please open a bug describing \
|
ynh_die "Unable to detect your achitecture, please open a bug describing \
|
||||||
your hardware and the result of the command \"uname -m\"." 1
|
your hardware and the result of the command \"uname -m\"." 1
|
||||||
fi
|
fi
|
||||||
ynh_app_setting_set --app=$app --key=architecture --value=$architecture
|
ynh_app_setting_set --key=architecture --value=$architecture
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If client_max_body_size doesn't exist, create it
|
# If client_max_body_size doesn't exist, create it
|
||||||
if [ -z "$client_max_body_size" ]; then
|
if [ -z "$client_max_body_size" ]; then
|
||||||
client_max_body_size="250m"
|
client_max_body_size="250m"
|
||||||
ynh_app_setting_set --app=$app --key=client_max_body_size --value=$client_max_body_size
|
ynh_app_setting_set --key=client_max_body_size --value=$client_max_body_size
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if this source file exist, remove it
|
# if this source file exist, remove it
|
||||||
if [ -e "/etc/apt/sources.list.d/gitlab-ce.list" ]; then
|
if [ -e "/etc/apt/sources.list.d/gitlab-ce.list" ]; then
|
||||||
ynh_secure_remove --file="/etc/apt/sources.list.d/gitlab-ce.list"
|
ynh_safe_rm "/etc/apt/sources.list.d/gitlab-ce.list"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD UPGRADE STEPS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD SWAP IF NEEDED
|
# ADD SWAP IF NEEDED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -87,9 +72,9 @@ if [ $total_ram -lt 4096 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $swap_needed -gt 0 ]; then
|
if [ $swap_needed -gt 0 ]; then
|
||||||
ynh_script_progression --message="Adding $swap_needed Mo to swap..."
|
ynh_script_progression "Adding $swap_needed Mo to swap..."
|
||||||
if ! ynh_add_swap --size=$swap_needed; then
|
if ! ynh_add_swap --size=$swap_needed; then
|
||||||
ynh_print_warn --message="Please add $swap_needed Mo to swap to make GitLab work properly"
|
ynh_print_warn "Please add $swap_needed Mo to swap to make GitLab work properly"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -101,7 +86,7 @@ modify_kernel_parameters="true"
|
||||||
|
|
||||||
for value_to_check in "kernel.shmall" "kernel.shmmax" "kernel.sem" "net.core.somaxconn"
|
for value_to_check in "kernel.shmall" "kernel.shmmax" "kernel.sem" "net.core.somaxconn"
|
||||||
do
|
do
|
||||||
if ! ynh_exec_fully_quiet sysctl --write $value_to_check="$(sysctl --value $value_to_check)"; then
|
if ! sysctl --write $value_to_check="$(sysctl --value $value_to_check)"; then
|
||||||
modify_kernel_parameters="false"
|
modify_kernel_parameters="false"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
@ -118,9 +103,10 @@ generated_external_url="https://$domain${path%/}"
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed
|
||||||
|
if ynh_app_upstream_version_changed
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=50
|
ynh_script_progression "Setting up source files..."
|
||||||
|
|
||||||
# To avoid the automatic backup, already performed by YunoHost: https://docs.gitlab.com/omnibus/update/#updating-methods
|
# To avoid the automatic backup, already performed by YunoHost: https://docs.gitlab.com/omnibus/update/#updating-methods
|
||||||
touch $config_path/skip-auto-backup
|
touch $config_path/skip-auto-backup
|
||||||
|
@ -172,6 +158,7 @@ then
|
||||||
}
|
}
|
||||||
|
|
||||||
# To upgrade GitLab from a major version A to a major version B,
|
# To upgrade GitLab from a major version A to a major version B,
|
||||||
|
|
||||||
# we need to follow a specific path described here https://gitlab-com.gitlab.io/support/toolbox/upgrade-path/
|
# we need to follow a specific path described here https://gitlab-com.gitlab.io/support/toolbox/upgrade-path/
|
||||||
# A.last -> B.first -> -> B.X -> B.Y -> B.last
|
# A.last -> B.first -> -> B.X -> B.Y -> B.last
|
||||||
|
|
||||||
|
@ -193,7 +180,7 @@ then
|
||||||
counter=$((counter + 1))
|
counter=$((counter + 1))
|
||||||
if [ $counter -gt 1200 ]
|
if [ $counter -gt 1200 ]
|
||||||
then
|
then
|
||||||
ynh_print_warn --message="Timeout: a background migration runs for at least 20min !"
|
ynh_print_warn "Timeout: a background migration runs for at least 20min !"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -206,7 +193,7 @@ then
|
||||||
then
|
then
|
||||||
checkBatchedBackgroundMigration=0
|
checkBatchedBackgroundMigration=0
|
||||||
fi
|
fi
|
||||||
ynh_print_info --message="Wait for the migration in the background to finish"
|
ynh_print_info "Wait for the migration in the background to finish"
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -214,20 +201,20 @@ then
|
||||||
|
|
||||||
source_next_version
|
source_next_version
|
||||||
|
|
||||||
ynh_print_info --message="Upgrade from ${current_version} to ${gitlab_version}"
|
ynh_print_info "Upgrade from ${current_version} to ${gitlab_version}"
|
||||||
|
|
||||||
ynh_add_config --template="$YNH_APP_BASEDIR/conf/$architecture.src.default" --destination="$YNH_APP_BASEDIR/conf/$architecture.src"
|
ynh_config_add --template="$YNH_APP_BASEDIR/conf/$architecture.src.default" --destination="$YNH_APP_BASEDIR/conf/$architecture.src"
|
||||||
|
|
||||||
tempdir="$(mktemp -d)"
|
tempdir="$(mktemp -d)"
|
||||||
|
|
||||||
ynh_setup_source --dest_dir=$tempdir --source_id=$architecture
|
ynh_setup_source --dest_dir=$tempdir --source_id=$architecture
|
||||||
|
|
||||||
if ! ynh_exec_warn_less dpkg -i $tempdir/$gitlab_filename; then # This command will fail in lxc env
|
if ! ynh_hide_warnings dpkg -i $tempdir/$gitlab_filename; then # This command will fail in lxc env
|
||||||
package_check_action # defined in upgrade.d/upgrade.X.sh
|
package_check_action # defined in upgrade.d/upgrade.X.sh
|
||||||
ynh_exec_warn_less dpkg --configure gitlab-ce
|
ynh_hide_warnings dpkg --configure gitlab-ce
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_secure_remove --file="$tempdir"
|
ynh_safe_rm "$tempdir"
|
||||||
|
|
||||||
current_version=$(grep gitlab-ce /opt/gitlab/version-manifest.txt | cut -d' ' -f2)
|
current_version=$(grep gitlab-ce /opt/gitlab/version-manifest.txt | cut -d' ' -f2)
|
||||||
|
|
||||||
|
@ -237,16 +224,16 @@ then
|
||||||
source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.$current_major_version.last.sh
|
source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.$current_major_version.last.sh
|
||||||
fi
|
fi
|
||||||
if dpkg --compare-versions "$gitlab_version" "ge" "$current_version"; then
|
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"
|
ynh_config_add --template="$YNH_APP_BASEDIR/conf/gitlab.$current_major_version.rb" --destination="$config_path/gitlab.rb"
|
||||||
|
|
||||||
touch "$config_path/gitlab-persistent.rb"
|
touch "$config_path/gitlab-persistent.rb"
|
||||||
chown root:root "$config_path/gitlab-persistent.rb"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown root:root "$config_path/gitlab-persistent.rb"
|
||||||
chmod 640 "$config_path/gitlab-persistent.rb"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 640 "$config_path/gitlab-persistent.rb"
|
||||||
|
|
||||||
# During large migrations, the logs are too big to be sent to paste.yunohost.org
|
# During large migrations, the logs are too big to be sent to paste.yunohost.org
|
||||||
# Send the reconfigure logs in a file, and if the process succeeds, just delete it.
|
# Send the reconfigure logs in a file, and if the process succeeds, just delete it.
|
||||||
gitlab-ctl reconfigure > "/tmp/gitlab_upgrade_$current_version.log"
|
gitlab-ctl reconfigure > "/tmp/gitlab_upgrade_$current_version.log"
|
||||||
ynh_secure_remove --file="/tmp/gitlab_upgrade_$current_version.log"
|
ynh_safe_rm "/tmp/gitlab_upgrade_$current_version.log"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -255,15 +242,15 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECONFIGURE GITLAB
|
# RECONFIGURE GITLAB
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reconfigure GitLab..." --weight=13
|
ynh_script_progression "Reconfigure GitLab..."
|
||||||
|
|
||||||
ynh_add_config --template="$YNH_APP_BASEDIR/conf/gitlab.rb" --destination="$config_path/gitlab.rb"
|
ynh_config_add --template="$YNH_APP_BASEDIR/conf/gitlab.rb" --destination="$config_path/gitlab.rb"
|
||||||
|
|
||||||
touch "$config_path/gitlab-persistent.rb"
|
touch "$config_path/gitlab-persistent.rb"
|
||||||
chown root:root "$config_path/gitlab-persistent.rb"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown root:root "$config_path/gitlab-persistent.rb"
|
||||||
chmod 640 "$config_path/gitlab-persistent.rb"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 640 "$config_path/gitlab-persistent.rb"
|
||||||
|
|
||||||
ynh_exec_warn_less gitlab-ctl reconfigure
|
ynh_hide_warnings gitlab-ctl reconfigure
|
||||||
|
|
||||||
# Allow ssh for git
|
# Allow ssh for git
|
||||||
usermod -a -G "ssh.app" "git"
|
usermod -a -G "ssh.app" "git"
|
||||||
|
@ -275,13 +262,11 @@ usermod -a -G "ssh.app" "git"
|
||||||
# Overwrite the nginx configuration only if it's allowed
|
# Overwrite the nginx configuration only if it's allowed
|
||||||
if [ $overwrite_nginx -eq 1 ]
|
if [ $overwrite_nginx -eq 1 ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
ynh_script_progression "Configuring NGINX web server..."
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config client_max_body_size
|
ynh_config_add_nginx client_max_body_size
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -292,21 +277,22 @@ yunohost service add "gitlab-runsvdir" --log "/var/log/$app/gitlab-rails/applica
|
||||||
# WAITING GITLAB
|
# WAITING GITLAB
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed
|
||||||
|
if ynh_app_upstream_version_changed
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Restarting GitLab..." --weight=15
|
ynh_script_progression "Restarting GitLab..."
|
||||||
|
|
||||||
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
|
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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
ynh_systemctl --action=reload --service=nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrade of GitLab completed" --last
|
ynh_script_progression "Upgrade of GitLab completed"
|
||||||
|
|
Loading…
Reference in a new issue