mirror of
https://github.com/YunoHost-Apps/gitlab_ynh.git
synced 2024-09-03 18:36:35 +02:00
Normalization from example_ynh
This commit is contained in:
parent
f925a143b9
commit
a9904228e5
10 changed files with 215 additions and 227 deletions
|
@ -14,7 +14,7 @@
|
||||||
"email": "pierre@kayou.io"
|
"email": "pierre@kayou.io"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">> 3.3.0"
|
"yunohost": ">= 3.5.0"
|
||||||
},
|
},
|
||||||
"multi_instance": false,
|
"multi_instance": false,
|
||||||
"services": [
|
"services": [
|
||||||
|
|
|
@ -26,7 +26,7 @@ app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
||||||
# CHECK IF AN ACTION HAS TO BE DONE
|
# CHECK IF AN ACTION HAS TO BE DONE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
is_public_old=$(ynh_app_setting_get $app is_public)
|
is_public_old=$(ynh_app_setting_get --app=$app --key=is_public)
|
||||||
|
|
||||||
if [ $is_public -eq $is_public_old ]
|
if [ $is_public -eq $is_public_old ]
|
||||||
then
|
then
|
||||||
|
@ -43,27 +43,27 @@ if [ $is_public -eq 0 ]; then
|
||||||
else
|
else
|
||||||
public_private="public"
|
public_private="public"
|
||||||
fi
|
fi
|
||||||
ynh_print_info --message="Moving the application to $public_private..."
|
ynh_script_progression --message=--message="Moving the application to $public_private..." --time
|
||||||
|
|
||||||
# Make app public if necessary
|
# Make app public if necessary
|
||||||
if [ $is_public -eq 0 ]; then
|
if [ $is_public -eq 0 ]; then
|
||||||
ynh_app_setting_delete $app unprotected_uris
|
ynh_app_setting_delete $app unprotected_uris
|
||||||
else
|
else
|
||||||
# unprotected_uris allows SSO credentials to be passed anyway.
|
# unprotected_uris allows SSO credentials to be passed anyway.
|
||||||
ynh_app_setting_set $app unprotected_uris "/"
|
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_print_info --message="Reconfiguring SSOwat..."
|
ynh_script_progression --message=--message="Reconfiguring SSOwat..." --time
|
||||||
# Regen ssowat configuration
|
# Regen ssowat configuration
|
||||||
yunohost app ssowatconf
|
yunohost app ssowatconf
|
||||||
|
|
||||||
# Update the config of the app
|
# Update the config of the app
|
||||||
ynh_app_setting_set $app is_public $is_public
|
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Reloading nginx web server..."
|
ynh_script_progression --message=--message="Reloading nginx web server..." --time
|
||||||
|
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
ynh_systemd_action --action=reload --service_name=nginx
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
||||||
# CHECK IF AN ACTION HAS TO BE DONE
|
# CHECK IF AN ACTION HAS TO BE DONE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
use_web_account_old=$(ynh_app_setting_get $app use_web_account)
|
use_web_account_old=$(ynh_app_setting_get --app=$app --key=use_web_account)
|
||||||
|
|
||||||
if [ $use_web_account -eq $use_web_account_old ]
|
if [ $use_web_account -eq $use_web_account_old ]
|
||||||
then
|
then
|
||||||
|
@ -43,12 +43,12 @@ if [ $use_web_account -eq 0 ]; then
|
||||||
else
|
else
|
||||||
web_account="Disable"
|
web_account="Disable"
|
||||||
fi
|
fi
|
||||||
ynh_print_info --message="$web_account web user creation..."
|
ynh_script_progression --message=--message="$web_account web user creation..." --time
|
||||||
|
|
||||||
echo "ApplicationSetting.last.update_attributes(password_authentication_enabled_for_web: $use_web_account, signup_enabled: $use_web_account)" | gitlab-rails console
|
echo "ApplicationSetting.last.update_attributes(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 use_web_account $use_web_account
|
ynh_app_setting_set --app=$app --key=use_web_account --value=$use_web_account
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -24,48 +24,48 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Loading installation settings..."
|
ynh_script_progression --message="Loading installation settings..." --time
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
config_path=$(ynh_app_setting_get $app config_path)
|
config_path=$(ynh_app_setting_get --app=$app --key=config_path)
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD BACKUP STEPS
|
# STANDARD BACKUP STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Backing up nginx web server configuration..."
|
ynh_script_progression --message="Backing up nginx web server configuration..." --time
|
||||||
|
|
||||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP GITLAB DATABASE
|
# BACKUP GITLAB DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Backuping of Gitlab..."
|
ynh_script_progression --message="Backuping of Gitlab..." --time
|
||||||
|
|
||||||
# Use gitlab-rake to backup
|
# Use gitlab-rake to backup
|
||||||
gitlab-rake gitlab:backup:create > backup.log
|
gitlab-rake gitlab:backup:create > backup.log
|
||||||
|
|
||||||
# Searching in backup logs the
|
# Searching in backup logs the name of the backup archive created
|
||||||
last_backup=$(grep _gitlab_backup.tar backup.log | cut -d' ' -f4)
|
last_backup=$(grep _gitlab_backup.tar backup.log | cut -d' ' -f4)
|
||||||
mv "/var/opt/$app/backups/$last_backup" "/var/opt/$app/backups/last_gitlab_backup.tar"
|
mv "/var/opt/$app/backups/$last_backup" "/var/opt/$app/backups/last_gitlab_backup.tar"
|
||||||
|
|
||||||
ynh_backup "/var/opt/$app/backups/last_gitlab_backup.tar"
|
ynh_backup --src_path="/var/opt/$app/backups/last_gitlab_backup.tar"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP CONF FILES
|
# BACKUP CONF FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Backuping configuration files of Gitlab..."
|
ynh_script_progression --message="Backuping configuration files of Gitlab..." --time
|
||||||
|
|
||||||
ynh_backup "$config_path/gitlab-secrets.json"
|
ynh_backup --src_path="$config_path/gitlab-secrets.json"
|
||||||
ynh_backup "$config_path/gitlab.rb"
|
ynh_backup --src_path="$config_path/gitlab.rb"
|
||||||
ynh_backup "$config_path/gitlab-persistent.rb"
|
ynh_backup --src_path="$config_path/gitlab-persistent.rb"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last
|
||||||
|
|
|
@ -24,25 +24,16 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Loading installation settings..."
|
ynh_script_progression --message="Loading installation settings..." --time
|
||||||
|
|
||||||
# Needed for helper "ynh_add_nginx_config"
|
# Needed for helper "ynh_add_nginx_config"
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
config_path=$(ynh_app_setting_get $app config_path)
|
config_path=$(ynh_app_setting_get --app=$app --key=config_path)
|
||||||
port=$(ynh_app_setting_get "$app" web_port)
|
port=$(ynh_app_setting_get --app="$app" --key=web_port)
|
||||||
portUnicorn=$(ynh_app_setting_get "$app" unicorn_port)
|
portUnicorn=$(ynh_app_setting_get --app="$app" --key=unicorn_port)
|
||||||
portSidekiq=$(ynh_app_setting_get "$app" sidekiq_port)
|
portSidekiq=$(ynh_app_setting_get --app="$app" --key=sidekiq_port)
|
||||||
unicorn_worker_processes=$(ynh_app_setting_get "$app" unicorn_worker_processes)
|
unicorn_worker_processes=$(ynh_app_setting_get --app="$app" --key=unicorn_worker_processes)
|
||||||
client_max_body_size=$(ynh_app_setting_get "$app" client_max_body_size)
|
client_max_body_size=$(ynh_app_setting_get --app="$app" --key=client_max_body_size)
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK THE SYNTAX OF THE PATHS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
test -n "$old_path" || old_path="/"
|
|
||||||
test -n "$new_path" || new_path="/"
|
|
||||||
new_path=$(ynh_normalize_url_path $new_path)
|
|
||||||
old_path=$(ynh_normalize_url_path $old_path)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||||
|
@ -63,12 +54,12 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Updating nginx web server configuration..."
|
ynh_script_progression --message="Updating nginx web server configuration..." --time
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
|
|
||||||
if [ $change_path -eq 1 ]; then
|
if [ $change_path -eq 1 ]; then
|
||||||
ynh_print_info "Changing path..."
|
ynh_script_progression --message="Changing path..." --time
|
||||||
|
|
||||||
#doc in: https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
|
#doc in: https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
|
||||||
|
|
||||||
|
@ -76,7 +67,7 @@ if [ $change_path -eq 1 ]; then
|
||||||
gitlab-ctl stop sidekiq
|
gitlab-ctl stop sidekiq
|
||||||
|
|
||||||
# Make a backup of the original nginx config file if modified
|
# Make a backup of the original nginx config file if modified
|
||||||
ynh_backup_if_checksum_is_different "$nginx_conf_path"
|
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||||
# Set global variables for nginx helper
|
# Set global variables for nginx helper
|
||||||
domain="$old_domain"
|
domain="$old_domain"
|
||||||
path_url="$new_path"
|
path_url="$new_path"
|
||||||
|
@ -86,13 +77,13 @@ fi
|
||||||
|
|
||||||
# Change the domain for nginx
|
# Change the domain for nginx
|
||||||
if [ $change_domain -eq 1 ]; then
|
if [ $change_domain -eq 1 ]; then
|
||||||
ynh_print_info "Changing domain..."
|
ynh_script_progression --message="Changing domain..." --time
|
||||||
|
|
||||||
# Delete file checksum for the old conf file location
|
# Delete file checksum for the old conf file location
|
||||||
ynh_delete_file_checksum "$nginx_conf_path"
|
ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||||
# Store file checksum for the new config file location
|
# Store file checksum for the new config file location
|
||||||
ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -100,9 +91,9 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE GITLAB
|
# CONFIGURE GITLAB
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Configure gitlab..."
|
ynh_script_progression --message="Configure gitlab..." --time
|
||||||
|
|
||||||
ynh_backup_if_checksum_is_different "$config_path/gitlab.rb"
|
ynh_backup_if_checksum_is_different --file="$config_path/gitlab.rb"
|
||||||
|
|
||||||
mkdir -p $config_path
|
mkdir -p $config_path
|
||||||
|
|
||||||
|
@ -112,15 +103,15 @@ ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+")
|
||||||
domain="$new_domain"
|
domain="$new_domain"
|
||||||
path_url="$new_path"
|
path_url="$new_path"
|
||||||
|
|
||||||
ynh_replace_string "__GENERATED_EXTERNAL_URL__" "https://$domain${path_url%/}" "$config_path/gitlab.rb"
|
ynh_replace_string --match_string="__GENERATED_EXTERNAL_URL__" --replace_string="https://$domain${path_url%/}" --target_file="$config_path/gitlab.rb"
|
||||||
ynh_replace_string "__PORT__" "$port" "$config_path/gitlab.rb"
|
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config_path/gitlab.rb"
|
||||||
ynh_replace_string "__UNICORN_PORT__" "$portUnicorn" "$config_path/gitlab.rb"
|
ynh_replace_string --match_string="__UNICORN_PORT__" --replace_string="$portUnicorn" --target_file="$config_path/gitlab.rb"
|
||||||
ynh_replace_string "__UNICORN_WORKER_PROCESSES__" "$unicorn_worker_processes" "$config_path/gitlab.rb"
|
ynh_replace_string --match_string="__UNICORN_WORKER_PROCESSES__" --replace_string="$unicorn_worker_processes" --target_file="$config_path/gitlab.rb"
|
||||||
ynh_replace_string "__CLIENT_MAX_BODY_SIZE__" "$client_max_body_size" "$config_path/gitlab.rb"
|
ynh_replace_string --match_string="__CLIENT_MAX_BODY_SIZE__" --replace_string="$client_max_body_size" --target_file="$config_path/gitlab.rb"
|
||||||
ynh_replace_string "__SSH_PORT__" "$ssh_port" "$config_path/gitlab.rb"
|
ynh_replace_string --match_string="__SSH_PORT__" --replace_string="$ssh_port" --target_file="$config_path/gitlab.rb"
|
||||||
ynh_replace_string "__SIDEKIQ_PORT__" "$portSidekiq" "$config_path/gitlab.rb"
|
ynh_replace_string --match_string="__SIDEKIQ_PORT__" --replace_string="$portSidekiq" --target_file="$config_path/gitlab.rb"
|
||||||
|
|
||||||
ynh_store_file_checksum "$config_path/gitlab.rb"
|
ynh_store_file_checksum --file="$config_path/gitlab.rb"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECONFIGURE GITLAB
|
# RECONFIGURE GITLAB
|
||||||
|
@ -136,7 +127,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# WAITING GITLAB
|
# WAITING GITLAB
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Waiting for gitlab..."
|
ynh_script_progression --message="Waiting for gitlab..." --time
|
||||||
|
|
||||||
# Action status to just wait the service
|
# Action status to just wait the service
|
||||||
ynh_systemd_action --action=status --service_name="gitlab-runsvdir" --log_path="/var/log/$app/unicorn/current" --line_match="adopted" --timeout=3600
|
ynh_systemd_action --action=status --service_name="gitlab-runsvdir" --log_path="/var/log/$app/unicorn/current" --line_match="adopted" --timeout=3600
|
||||||
|
@ -146,7 +137,7 @@ ynh_systemd_action --action=status --service_name="gitlab-runsvdir" --log_path="
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Reloading nginx web server..."
|
ynh_script_progression --message="Reloading nginx web server..." --time
|
||||||
|
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
ynh_systemd_action --action=reload --service_name=nginx
|
||||||
|
|
||||||
|
@ -154,4 +145,4 @@ ynh_systemd_action --action=reload --service_name=nginx
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info "Change of URL completed for $app"
|
ynh_script_progression --message="Change of URL completed for $app" --time --last
|
||||||
|
|
|
@ -26,17 +26,17 @@ app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
||||||
# Otherwise, keep the value from the app config.
|
# Otherwise, keep the value from the app config.
|
||||||
|
|
||||||
# is_public
|
# is_public
|
||||||
old_is_public="$(ynh_app_setting_get $app is_public)"
|
old_is_public="$(ynh_app_setting_get --app=$app --key=is_public)"
|
||||||
old_is_public=$(bool_to_true_false $old_is_public)
|
old_is_public=$(bool_to_true_false $old_is_public)
|
||||||
is_public="${YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC:-$old_is_public}"
|
is_public="${YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC:-$old_is_public}"
|
||||||
|
|
||||||
# Overwrite nginx configuration
|
# Overwrite nginx configuration
|
||||||
old_overwrite_nginx="$(ynh_app_setting_get $app overwrite_nginx)"
|
old_overwrite_nginx="$(ynh_app_setting_get --app=$app --key=overwrite_nginx)"
|
||||||
old_overwrite_nginx=$(bool_to_true_false $old_overwrite_nginx)
|
old_overwrite_nginx=$(bool_to_true_false $old_overwrite_nginx)
|
||||||
overwrite_nginx="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX:-$old_overwrite_nginx}"
|
overwrite_nginx="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX:-$old_overwrite_nginx}"
|
||||||
|
|
||||||
# use_web_account
|
# use_web_account
|
||||||
old_use_web_account="$(ynh_app_setting_get $app use_web_account)"
|
old_use_web_account="$(ynh_app_setting_get --app=$app --key=use_web_account)"
|
||||||
old_use_web_account=$(bool_to_true_false $old_use_web_account)
|
old_use_web_account=$(bool_to_true_false $old_use_web_account)
|
||||||
use_web_account="${YNH_CONFIG_MAIN_USERS_USE_WEB_ACCOUNT:-$old_use_web_account}"
|
use_web_account="${YNH_CONFIG_MAIN_USERS_USE_WEB_ACCOUNT:-$old_use_web_account}"
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ apply_config() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set overwrite_nginx
|
# Set overwrite_nginx
|
||||||
ynh_app_setting_set $app overwrite_nginx "$overwrite_nginx"
|
ynh_app_setting_set --app=$app --key=overwrite_nginx --value="$overwrite_nginx"
|
||||||
}
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
106
scripts/install
106
scripts/install
|
@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
ynh_secure_remove "$tempdir" 2>&1
|
ynh_exec_warn_less ynh_secure_remove --file="$tempdir"
|
||||||
|
|
||||||
ynh_clean_check_starting
|
ynh_clean_check_starting
|
||||||
}
|
}
|
||||||
|
@ -36,11 +36,11 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Validating installation parameters..."
|
ynh_script_progression --message="Validating installation parameters..." --time
|
||||||
|
|
||||||
config_path=/etc/$app
|
config_path=/etc/$app
|
||||||
final_path=/opt/$app
|
final_path=/opt/$app
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||||
|
|
||||||
# Detect the system architecture
|
# Detect the system architecture
|
||||||
if [ -n "$(uname -m | grep 64)" ]; then
|
if [ -n "$(uname -m | grep 64)" ]; then
|
||||||
|
@ -50,7 +50,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 "Unable to detect your achitecture, please open a bug describing \
|
ynh_die --message="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
|
||||||
|
|
||||||
|
@ -69,55 +69,53 @@ fi
|
||||||
# Could be an option?
|
# Could be an option?
|
||||||
client_max_body_size="250m"
|
client_max_body_size="250m"
|
||||||
|
|
||||||
path_url=$(ynh_normalize_url_path $path_url)
|
|
||||||
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
ynh_webpath_register $app $domain $path_url
|
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Storing installation settings..."
|
ynh_script_progression --message="Storing installation settings..." --time
|
||||||
|
|
||||||
ynh_app_setting_set $app admin $admin
|
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||||
ynh_app_setting_set $app path_url $path_url
|
ynh_app_setting_set --app=$app --key=path_url --value=$path_url
|
||||||
ynh_app_setting_set $app is_public $is_public
|
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
||||||
ynh_app_setting_set $app use_web_account $use_web_account
|
ynh_app_setting_set --app=$app --key=use_web_account --value=$use_web_account
|
||||||
ynh_app_setting_set $app final_path $final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
ynh_app_setting_set $app config_path $config_path
|
ynh_app_setting_set --app=$app --key=config_path --value=$config_path
|
||||||
ynh_app_setting_set $app architecture $architecture
|
ynh_app_setting_set --app=$app --key=architecture --value=$architecture
|
||||||
ynh_app_setting_set $app unicorn_worker_processes $unicorn_worker_processes
|
ynh_app_setting_set --app=$app --key=unicorn_worker_processes --value=$unicorn_worker_processes
|
||||||
ynh_app_setting_set $app client_max_body_size $client_max_body_size
|
ynh_app_setting_set --app=$app --key=client_max_body_size --value=$client_max_body_size
|
||||||
|
|
||||||
ynh_app_setting_set $app overwrite_nginx "1"
|
ynh_app_setting_set --app=$app --key=overwrite_nginx --value="1"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# FIND A PORT
|
# FIND A PORT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Find internal port..."
|
ynh_script_progression --message="Find internal port..." --time
|
||||||
|
|
||||||
# Find free ports
|
# Find free ports
|
||||||
port=$(ynh_find_port 8080)
|
port=$(ynh_find_port --port=8080)
|
||||||
portUnicorn=$(ynh_find_port $(($port + 1)))
|
portUnicorn=$(ynh_find_port --port=$(($port + 1)))
|
||||||
portSidekiq=$(ynh_find_port $(($portUnicorn + 1)))
|
portSidekiq=$(ynh_find_port --port=$(($portUnicorn + 1)))
|
||||||
|
|
||||||
ynh_app_setting_set $app web_port $port
|
ynh_app_setting_set --app=$app --key=web_port --value=$port
|
||||||
ynh_app_setting_set $app unicorn_port $portUnicorn
|
ynh_app_setting_set --app=$app --key=unicorn_port --value=$portUnicorn
|
||||||
ynh_app_setting_set $app sidekiq_port $portSidekiq
|
ynh_app_setting_set --app=$app --key=sidekiq_port --value=$portSidekiq
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Installing dependencies..."
|
ynh_script_progression --message="Installing dependencies..." --time
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PRECONFIGURE GITLAB
|
# PRECONFIGURE GITLAB
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Preconfigure gitlab..."
|
ynh_script_progression --message="Preconfigure gitlab..." --time
|
||||||
|
|
||||||
mkdir -p $config_path
|
mkdir -p $config_path
|
||||||
|
|
||||||
|
@ -127,35 +125,35 @@ chown admin: "$config_path/gitlab-persistent.rb"
|
||||||
cp -f ../conf/gitlab.rb "$config_path/gitlab.rb"
|
cp -f ../conf/gitlab.rb "$config_path/gitlab.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+")
|
||||||
|
|
||||||
ynh_replace_string "__GENERATED_EXTERNAL_URL__" "https://$domain${path_url%/}" "$config_path/gitlab.rb"
|
ynh_replace_string --match_string="__GENERATED_EXTERNAL_URL__" --replace_string="https://$domain${path_url%/}" --target_file="$config_path/gitlab.rb"
|
||||||
ynh_replace_string "__PORT__" "$port" "$config_path/gitlab.rb"
|
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config_path/gitlab.rb"
|
||||||
ynh_replace_string "__UNICORN_PORT__" "$portUnicorn" "$config_path/gitlab.rb"
|
ynh_replace_string --match_string="__UNICORN_PORT__" --replace_string="$portUnicorn" --target_file="$config_path/gitlab.rb"
|
||||||
ynh_replace_string "__UNICORN_WORKER_PROCESSES__" "$unicorn_worker_processes" "$config_path/gitlab.rb"
|
ynh_replace_string --match_string="__UNICORN_WORKER_PROCESSES__" --replace_string="$unicorn_worker_processes" --target_file="$config_path/gitlab.rb"
|
||||||
ynh_replace_string "__CLIENT_MAX_BODY_SIZE__" "$client_max_body_size" "$config_path/gitlab.rb"
|
ynh_replace_string --match_string="__CLIENT_MAX_BODY_SIZE__" --replace_string="$client_max_body_size" --target_file="$config_path/gitlab.rb"
|
||||||
ynh_replace_string "__SSH_PORT__" "$ssh_port" "$config_path/gitlab.rb"
|
ynh_replace_string --match_string="__SSH_PORT__" --replace_string="$ssh_port" --target_file="$config_path/gitlab.rb"
|
||||||
ynh_replace_string "__SIDEKIQ_PORT__" "$portSidekiq" "$config_path/gitlab.rb"
|
ynh_replace_string --match_string="__SIDEKIQ_PORT__" --replace_string="$portSidekiq" --target_file="$config_path/gitlab.rb"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
# STORE THE CONFIG FILE CHECKSUM
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_store_file_checksum "$config_path/gitlab.rb"
|
ynh_store_file_checksum --file="$config_path/gitlab.rb"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Setting up source files..."
|
ynh_script_progression --message="Setting up source files..." --time
|
||||||
|
|
||||||
update_src_version() {
|
update_src_version() {
|
||||||
source ./upgrade.d/upgrade.last.sh
|
source ./upgrade.d/upgrade.last.sh
|
||||||
cp ../conf/$architecture.src.default ../conf/$architecture.src
|
cp ../conf/$architecture.src.default ../conf/$architecture.src
|
||||||
ynh_replace_string "__VERSION__" "$gitlab_version" "../conf/$architecture.src"
|
ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_version" --target_file="../conf/$architecture.src"
|
||||||
ynh_replace_string "__SOURCE_FILENAME__" "$gitlab_filename" "../conf/$architecture.src"
|
ynh_replace_string --match_string="__SOURCE_FILENAME__" --replace_string="$gitlab_filename" --target_file="../conf/$architecture.src"
|
||||||
|
|
||||||
if [ $architecture = "x86-64" ]; then
|
if [ $architecture = "x86-64" ]; then
|
||||||
ynh_replace_string "__SHA256_SUM__" "$gitlab_x86_64_source_sha256" "../conf/$architecture.src"
|
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_x86_64_source_sha256" --target_file="../conf/$architecture.src"
|
||||||
elif [ $architecture = "arm" ]; then
|
elif [ $architecture = "arm" ]; then
|
||||||
ynh_replace_string "__SHA256_SUM__" "$gitlab_arm_source_sha256" "../conf/$architecture.src"
|
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_arm_source_sha256" --target_file="../conf/$architecture.src"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,21 +161,21 @@ update_src_version
|
||||||
|
|
||||||
tempdir="$(mktemp -d)"
|
tempdir="$(mktemp -d)"
|
||||||
|
|
||||||
ynh_setup_source $tempdir $architecture
|
ynh_setup_source --dest_dir=$tempdir --source_id=$architecture
|
||||||
|
|
||||||
if IS_PACKAGE_CHECK; then
|
if IS_PACKAGE_CHECK; then
|
||||||
if ! dpkg -i $tempdir/$gitlab_filename ; then # This command will fail in lxc env
|
if ! ynh_exec_warn_less dpkg -i $tempdir/$gitlab_filename ; then # This command will fail in lxc env
|
||||||
ynh_replace_string "command \"cat \/etc\/sysctl.conf \/etc\/sysctl.d\/\*.conf | sysctl -e -p -\"" "command \"cat \/etc\/sysctl.conf\"" "$final_path/embedded/cookbooks/package/resources/sysctl.rb"
|
ynh_replace_string --match_string="command \"cat \/etc\/sysctl.conf \/etc\/sysctl.d\/\*.conf | sysctl -e -p -\"" --replace_string="command \"cat \/etc\/sysctl.conf\"" --target_file="$final_path/embedded/cookbooks/package/resources/sysctl.rb"
|
||||||
dpkg --configure gitlab-ce
|
ynh_exec_warn_less dpkg --configure gitlab-ce
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
dpkg -i $tempdir/$gitlab_filename
|
ynh_exec_warn_less dpkg -i $tempdir/$gitlab_filename
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Configuring nginx web server..."
|
ynh_script_progression --message="Configuring nginx web server..." --time
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config client_max_body_size
|
ynh_add_nginx_config client_max_body_size
|
||||||
|
@ -187,10 +185,10 @@ ynh_add_nginx_config client_max_body_size
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD USER AND CONFIGURE SIGN IN SYSTEM
|
# ADD USER AND CONFIGURE SIGN IN SYSTEM
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Creating an administrator user..."
|
ynh_script_progression --message="Creating an administrator user..." --time
|
||||||
|
|
||||||
mailadmin=$(ynh_user_get_info $admin mail)
|
mailadmin=$(ynh_user_get_info --username=$admin --key=mail)
|
||||||
rdmPass=$(ynh_string_random 30)
|
rdmPass=$(ynh_string_random --length=30)
|
||||||
|
|
||||||
echo "newuser = User.new({ \"email\"=>'$mailadmin', \"username\"=>'$admin', \"name\"=>'$admin', \"password\"=>'$rdmPass'})
|
echo "newuser = User.new({ \"email\"=>'$mailadmin', \"username\"=>'$admin', \"name\"=>'$admin', \"password\"=>'$rdmPass'})
|
||||||
newuser.admin = true
|
newuser.admin = true
|
||||||
|
@ -202,7 +200,7 @@ ApplicationSetting.last.update_attributes(password_authentication_enabled_for_we
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECONFIGURE TO TAKE INTO ACCOUNT CHANGES
|
# RECONFIGURE TO TAKE INTO ACCOUNT CHANGES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Reconfigure gitlab..."
|
ynh_script_progression --message="Reconfigure gitlab..." --time
|
||||||
|
|
||||||
gitlab-ctl reconfigure
|
gitlab-ctl reconfigure
|
||||||
|
|
||||||
|
@ -217,18 +215,18 @@ yunohost service add "gitlab-runsvdir" --log "/var/log/$app/gitlab-rails/applica
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Configuring SSOwat..."
|
ynh_script_progression --message="Configuring SSOwat..." --time
|
||||||
|
|
||||||
# Make app public if necessary
|
# Make app public if necessary
|
||||||
if [ $is_public -eq 1 ]; then
|
if [ $is_public -eq 1 ]; then
|
||||||
# unprotected_uris allows SSO credentials to be passed anyway.
|
# unprotected_uris allows SSO credentials to be passed anyway.
|
||||||
ynh_app_setting_set $app unprotected_uris "/"
|
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Reloading nginx web server..."
|
ynh_script_progression --message="Reloading nginx web server..." --time
|
||||||
|
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
ynh_systemd_action --action=reload --service_name=nginx
|
||||||
|
|
||||||
|
@ -236,4 +234,4 @@ ynh_systemd_action --action=reload --service_name=nginx
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info "Installation of $app completed"
|
ynh_script_progression --message="Installation of $app completed" --time --last
|
||||||
|
|
|
@ -12,15 +12,15 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Loading installation settings..."
|
ynh_script_progression --message="Loading installation settings..." --time
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||||
port=$(ynh_app_setting_get "$app" web_port)
|
port=$(ynh_app_setting_get --app="$app" --key=web_port)
|
||||||
portUnicorn=$(ynh_app_setting_get "$app" unicorn_port)
|
portUnicorn=$(ynh_app_setting_get --app="$app" --key=unicorn_port)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
config_path=$(ynh_app_setting_get $app config_path)
|
config_path=$(ynh_app_setting_get --app=$app --key=config_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
|
@ -30,28 +30,28 @@ config_path=$(ynh_app_setting_get $app config_path)
|
||||||
|
|
||||||
if yunohost service status "gitlab-runsvdir" >/dev/null 2>&1
|
if yunohost service status "gitlab-runsvdir" >/dev/null 2>&1
|
||||||
then
|
then
|
||||||
ynh_print_info "Removing $app service"
|
ynh_script_progression --message="Removing $app service" --time
|
||||||
yunohost service remove "gitlab-runsvdir"
|
yunohost service remove "gitlab-runsvdir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP GITLAB
|
# STOP GITLAB
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Stopping gitlab"
|
ynh_script_progression --message="Stopping gitlab" --time
|
||||||
|
|
||||||
gitlab-ctl stop
|
gitlab-ctl stop
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE GITLAB
|
# REMOVE GITLAB
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Removing Gitlab"
|
ynh_script_progression --message="Removing Gitlab" --time
|
||||||
|
|
||||||
dpkg --remove gitlab-ce
|
dpkg --remove gitlab-ce
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Removing dependencies"
|
ynh_script_progression --message="Removing dependencies" --time
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
@ -59,16 +59,16 @@ ynh_remove_app_dependencies
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Removing app main directory"
|
ynh_script_progression --message="Removing app main directory" --time
|
||||||
|
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_secure_remove "$final_path"
|
ynh_secure_remove --file="$final_path"
|
||||||
ynh_secure_remove "$config_path"
|
ynh_secure_remove --file="$config_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Removing nginx web server configuration"
|
ynh_script_progression --message="Removing nginx web server configuration" --time
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated nginx config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
@ -79,12 +79,12 @@ ynh_remove_nginx_config
|
||||||
|
|
||||||
# These ports are no longer open but were in previous versions
|
# These ports are no longer open but were in previous versions
|
||||||
if yunohost firewall list | grep -q "\- $port$"; then
|
if yunohost firewall list | grep -q "\- $port$"; then
|
||||||
ynh_print_info "Closing port $port"
|
ynh_script_progression --message="Closing port $port" --time
|
||||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if yunohost firewall list | grep -q "\- $portUnicorn$"; then
|
if yunohost firewall list | grep -q "\- $portUnicorn$"; then
|
||||||
ynh_print_info "Closing port $portUnicorn"
|
ynh_script_progression --message="Closing port $portUnicorn" --time
|
||||||
ynh_exec_warn_less yunohost firewall disallow TCP $portUnicorn
|
ynh_exec_warn_less yunohost firewall disallow TCP $portUnicorn
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -94,13 +94,13 @@ fi
|
||||||
# REMOVE GITLAB FILES
|
# REMOVE GITLAB FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_secure_remove "/var/opt/$app"
|
ynh_secure_remove --file="/var/opt/$app"
|
||||||
|
|
||||||
# Remove the log files
|
# Remove the log files
|
||||||
ynh_secure_remove "/var/log/$app"
|
ynh_secure_remove --file="/var/log/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info "Removal of $app completed"
|
ynh_script_progression --message="Removal of $app completed" --time --last
|
||||||
|
|
|
@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
ynh_secure_remove "$tempdir" 2>&1
|
ynh_exec_warn_less ynh_secure_remove --file="$tempdir"
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
@ -23,27 +23,27 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Loading settings..."
|
ynh_script_progression --message="Loading settings..." --time
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
config_path=$(ynh_app_setting_get $app config_path)
|
config_path=$(ynh_app_setting_get --app=$app --key=config_path)
|
||||||
port=$(ynh_app_setting_get "$app" web_port)
|
port=$(ynh_app_setting_get --app="$app" --key=web_port)
|
||||||
portUnicorn=$(ynh_app_setting_get "$app" unicorn_port)
|
portUnicorn=$(ynh_app_setting_get --app="$app" --key=unicorn_port)
|
||||||
architecture=$(ynh_app_setting_get "$app" architecture)
|
architecture=$(ynh_app_setting_get --app="$app" --key=architecture)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Validating restoration parameters..."
|
ynh_script_progression --message="Validating restoration parameters..." --time
|
||||||
|
|
||||||
ynh_webpath_available $domain $path_url \
|
ynh_webpath_available --domain=$domain --path_url=$path_url \
|
||||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
|| ynh_die --message="Path not available: ${domain}${path_url}"
|
||||||
test ! -d $final_path \
|
test ! -d $final_path \
|
||||||
|| ynh_die "There is already a directory: $final_path "
|
|| ynh_die --message="There is already a directory: $final_path "
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# STANDARD RESTORATION STEPS
|
||||||
|
@ -51,12 +51,12 @@ test ! -d $final_path \
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Reinstalling dependencies..."
|
ynh_script_progression --message="Reinstalling dependencies..." --time
|
||||||
|
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
@ -64,28 +64,28 @@ ynh_install_app_dependencies $pkg_dependencies
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE CONF FILES
|
# RESTORE CONF FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Restoring configuration files of Gitlab..."
|
ynh_script_progression --message="Restoring configuration files of Gitlab..." --time
|
||||||
|
|
||||||
ynh_restore_file "$config_path/gitlab-secrets.json"
|
ynh_restore_file --origin_path="$config_path/gitlab-secrets.json"
|
||||||
ynh_restore_file "$config_path/gitlab.rb"
|
ynh_restore_file --origin_path="$config_path/gitlab.rb"
|
||||||
ynh_restore_file "$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_print_info "Reinstalling gitlab..."
|
ynh_script_progression --message="Reinstalling gitlab..." --time
|
||||||
|
|
||||||
update_src_version() {
|
update_src_version() {
|
||||||
source ../settings/scripts/upgrade.d/upgrade.last.sh
|
source ../settings/scripts/upgrade.d/upgrade.last.sh
|
||||||
mkdir -p ../conf/
|
mkdir -p ../conf/
|
||||||
cp ../settings/conf/$architecture.src.default ../conf/$architecture.src
|
cp ../settings/conf/$architecture.src.default ../conf/$architecture.src
|
||||||
ynh_replace_string "__VERSION__" "$gitlab_version" "../conf/$architecture.src"
|
ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_version" --target_file="../conf/$architecture.src"
|
||||||
ynh_replace_string "__SOURCE_FILENAME__" "$gitlab_filename" "../conf/$architecture.src"
|
ynh_replace_string --match_string="__SOURCE_FILENAME__" --replace_string="$gitlab_filename" --target_file="../conf/$architecture.src"
|
||||||
|
|
||||||
if [ $architecture = "x86-64" ]; then
|
if [ $architecture = "x86-64" ]; then
|
||||||
ynh_replace_string "__SHA256_SUM__" "$gitlab_x86_64_source_sha256" "../conf/$architecture.src"
|
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_x86_64_source_sha256" --target_file="../conf/$architecture.src"
|
||||||
elif [ $architecture = "arm" ]; then
|
elif [ $architecture = "arm" ]; then
|
||||||
ynh_replace_string "__SHA256_SUM__" "$gitlab_arm_source_sha256" "../conf/$architecture.src"
|
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_arm_source_sha256" --target_file="../conf/$architecture.src"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,15 +93,15 @@ update_src_version
|
||||||
|
|
||||||
tempdir="$(mktemp -d)"
|
tempdir="$(mktemp -d)"
|
||||||
|
|
||||||
ynh_setup_source $tempdir $architecture
|
ynh_setup_source --dest_dir=$tempdir --source_id=$architecture
|
||||||
|
|
||||||
if IS_PACKAGE_CHECK; then
|
if IS_PACKAGE_CHECK; then
|
||||||
if ! dpkg -i $tempdir/$gitlab_filename ; then # This command will fail in lxc env
|
if ! ynh_exec_warn_less dpkg -i $tempdir/$gitlab_filename ; then # This command will fail in lxc env
|
||||||
ynh_replace_string "command \"cat \/etc\/sysctl.conf \/etc\/sysctl.d\/\*.conf | sysctl -e -p -\"" "command \"cat \/etc\/sysctl.conf\"" "$final_path/embedded/cookbooks/package/resources/sysctl.rb"
|
ynh_replace_string --match_string="command \"cat \/etc\/sysctl.conf \/etc\/sysctl.d\/\*.conf | sysctl -e -p -\"" --replace_string="command \"cat \/etc\/sysctl.conf\"" --target_file="$final_path/embedded/cookbooks/package/resources/sysctl.rb"
|
||||||
dpkg --configure gitlab-ce
|
ynh_exec_warn_less dpkg --configure gitlab-ce
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
dpkg -i $tempdir/$gitlab_filename
|
ynh_exec_warn_less dpkg -i $tempdir/$gitlab_filename
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -109,9 +109,9 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE GITLAB DATABASE
|
# RESTORE GITLAB DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Restoring Gitlab..."
|
ynh_script_progression --message="Restoring Gitlab..." --time
|
||||||
|
|
||||||
ynh_restore_file "/var/opt/$app/backups/last_gitlab_backup.tar"
|
ynh_restore_file --origin_path="/var/opt/$app/backups/last_gitlab_backup.tar"
|
||||||
|
|
||||||
last_backup="last"
|
last_backup="last"
|
||||||
|
|
||||||
|
@ -134,14 +134,14 @@ yunohost service add "gitlab-runsvdir" --log "/var/log/$app/gitlab-rails/applica
|
||||||
#=================================================
|
#=================================================
|
||||||
# WAITING GITLAB
|
# WAITING GITLAB
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Waiting for gitlab..."
|
ynh_script_progression --message="Waiting for gitlab..." --time
|
||||||
|
|
||||||
ynh_systemd_action --action=restart --service_name="gitlab-runsvdir" --log_path="/var/log/$app/unicorn/current" --line_match="adopted" --timeout=3600
|
ynh_systemd_action --action=restart --service_name="gitlab-runsvdir" --log_path="/var/log/$app/unicorn/current" --line_match="adopted" --timeout=3600
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Reloading nginx web server..."
|
ynh_script_progression --message="Reloading nginx web server..." --time
|
||||||
|
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
ynh_systemd_action --action=reload --service_name=nginx
|
||||||
|
|
||||||
|
@ -149,4 +149,4 @@ ynh_systemd_action --action=reload --service_name=nginx
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info "Restoration completed for $app"
|
ynh_script_progression --message="Restoration completed for $app" --time --last
|
||||||
|
|
111
scripts/upgrade
111
scripts/upgrade
|
@ -19,19 +19,19 @@ source ./_common.sh
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Retrieve app settings
|
# Retrieve app settings
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||||
path_url=$(ynh_app_setting_get "$app" path_url)
|
path_url=$(ynh_app_setting_get --app="$app" --key=path_url)
|
||||||
admin=$(ynh_app_setting_get "$app" admin)
|
admin=$(ynh_app_setting_get --app="$app" --key=admin)
|
||||||
is_public=$(ynh_app_setting_get "$app" is_public)
|
is_public=$(ynh_app_setting_get --app="$app" --key=is_public)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
config_path=$(ynh_app_setting_get $app config_path)
|
config_path=$(ynh_app_setting_get --app=$app --key=config_path)
|
||||||
port=$(ynh_app_setting_get "$app" web_port)
|
port=$(ynh_app_setting_get --app="$app" --key=web_port)
|
||||||
portUnicorn=$(ynh_app_setting_get "$app" unicorn_port)
|
portUnicorn=$(ynh_app_setting_get --app="$app" --key=unicorn_port)
|
||||||
portSidekiq=$(ynh_app_setting_get "$app" sidekiq_port)
|
portSidekiq=$(ynh_app_setting_get --app="$app" --key=sidekiq_port)
|
||||||
architecture=$(ynh_app_setting_get "$app" architecture)
|
architecture=$(ynh_app_setting_get --app="$app" --key=architecture)
|
||||||
unicorn_worker_processes=$(ynh_app_setting_get "$app" unicorn_worker_processes)
|
unicorn_worker_processes=$(ynh_app_setting_get --app="$app" --key=unicorn_worker_processes)
|
||||||
client_max_body_size=$(ynh_app_setting_get "$app" client_max_body_size)
|
client_max_body_size=$(ynh_app_setting_get --app="$app" --key=client_max_body_size)
|
||||||
overwrite_nginx=$(ynh_app_setting_get "$app" overwrite_nginx)
|
overwrite_nginx=$(ynh_app_setting_get --app="$app" --key=overwrite_nginx)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
|
@ -39,23 +39,23 @@ overwrite_nginx=$(ynh_app_setting_get "$app" overwrite_nginx)
|
||||||
|
|
||||||
# Fix is_public as a boolean value
|
# Fix is_public as a boolean value
|
||||||
if [ "$is_public" = "Yes" ]; then
|
if [ "$is_public" = "Yes" ]; then
|
||||||
ynh_app_setting_set $app is_public 1
|
ynh_app_setting_set --app=$app --key=is_public --value=1
|
||||||
is_public=1
|
is_public=1
|
||||||
elif [ "$is_public" = "No" ]; then
|
elif [ "$is_public" = "No" ]; then
|
||||||
ynh_app_setting_set $app is_public 0
|
ynh_app_setting_set --app=$app --key=is_public --value=0
|
||||||
is_public=0
|
is_public=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If final_path doesn't exist, create it
|
# If final_path doesn't exist, create it
|
||||||
if [ -z "$final_path" ]; then
|
if [ -z "$final_path" ]; then
|
||||||
final_path=/opt/$app
|
final_path=/opt/$app
|
||||||
ynh_app_setting_set $app final_path $final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If config_path doesn't exist, create it
|
# If config_path doesn't exist, create it
|
||||||
if [ -z "$config_path" ]; then
|
if [ -z "$config_path" ]; then
|
||||||
config_path=/etc/$app
|
config_path=/etc/$app
|
||||||
ynh_app_setting_set $app config_path $config_path
|
ynh_app_setting_set --app=$app --key=config_path --value=$config_path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$unicorn_worker_processes" ]; then
|
if [ -z "$unicorn_worker_processes" ]; then
|
||||||
|
@ -70,13 +70,13 @@ if [ -z "$unicorn_worker_processes" ]; then
|
||||||
# 2 worker processes
|
# 2 worker processes
|
||||||
unicorn_worker_processes=2
|
unicorn_worker_processes=2
|
||||||
fi
|
fi
|
||||||
ynh_app_setting_set $app unicorn_worker_processes $unicorn_worker_processes
|
ynh_app_setting_set --app=$app --key=unicorn_worker_processes --value=$unicorn_worker_processes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$portSidekiq" ]; then
|
if [ -z "$portSidekiq" ]; then
|
||||||
portSidekiq=$(ynh_find_port $(($portUnicorn + 1)))
|
portSidekiq=$(ynh_find_port $(($portUnicorn + 1)))
|
||||||
|
|
||||||
ynh_app_setting_set $app sidekiq_port $portSidekiq
|
ynh_app_setting_set --app=$app --key=sidekiq_port --value=$portSidekiq
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If architecture doesn't exist, create it
|
# If architecture doesn't exist, create it
|
||||||
|
@ -89,10 +89,10 @@ 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 "Unable to detect your achitecture, please open a bug describing \
|
ynh_die --message="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 architecture $architecture
|
ynh_app_setting_set --app=$app --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
|
||||||
|
@ -103,7 +103,7 @@ fi
|
||||||
# If overwrite_nginx doesn't exist, create it
|
# If overwrite_nginx doesn't exist, create it
|
||||||
if [ -z "$overwrite_nginx" ]; then
|
if [ -z "$overwrite_nginx" ]; then
|
||||||
overwrite_nginx=1
|
overwrite_nginx=1
|
||||||
ynh_app_setting_set $app overwrite_nginx $overwrite_nginx
|
ynh_app_setting_set --app=$app --key=overwrite_nginx --value=$overwrite_nginx
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If domain doesn't exist, retrieve it
|
# If domain doesn't exist, retrieve it
|
||||||
|
@ -112,42 +112,42 @@ if [ -z "$domain" ]; then
|
||||||
if [ ${domain: -1} == "'" ]; then # if the last char of $domain is ' remove it
|
if [ ${domain: -1} == "'" ]; then # if the last char of $domain is ' remove it
|
||||||
domain=${domain:0:-1}
|
domain=${domain:0:-1}
|
||||||
fi
|
fi
|
||||||
ynh_app_setting_set $app domain $domain
|
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If path_url doesn't exist, retrieve it
|
# If path_url doesn't exist, retrieve it
|
||||||
if [ -z "$path_url" ]; then
|
if [ -z "$path_url" ]; then
|
||||||
path_url=$(grep "location" "/etc/nginx/conf.d/${domain}.d/gitlab.conf" | cut -d' ' -f2)
|
path_url=$(grep "location" "/etc/nginx/conf.d/${domain}.d/gitlab.conf" | cut -d' ' -f2)
|
||||||
path_url=$(ynh_normalize_url_path $path_url)
|
path_url=$(ynh_normalize_url_path $path_url)
|
||||||
ynh_app_setting_set $app path_url path_url
|
ynh_app_setting_set --app=$app --key=path_url --value=path_url
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If port doesn't exist, retrieve it
|
# If port doesn't exist, retrieve it
|
||||||
if [ -z "$port" ]; then
|
if [ -z "$port" ]; then
|
||||||
port=$(grep -F "nginx['listen_port']" "/etc/gitlab/gitlab.rb" | cut -d' ' -f3)
|
port=$(grep -F "nginx['listen_port']" "/etc/gitlab/gitlab.rb" | cut -d' ' -f3)
|
||||||
ynh_app_setting_set $app web_port $port
|
ynh_app_setting_set --app=$app --key=web_port --value=$port
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If port doesn't exist, retrieve it
|
# If port doesn't exist, retrieve it
|
||||||
if [ -z "$portUnicorn" ]; then
|
if [ -z "$portUnicorn" ]; then
|
||||||
portUnicorn=$(grep -F "unicorn['port']" "/etc/gitlab/gitlab.rb" | cut -d' ' -f3)
|
portUnicorn=$(grep -F "unicorn['port']" "/etc/gitlab/gitlab.rb" | cut -d' ' -f3)
|
||||||
ynh_app_setting_set $app unicorn_port $portUnicorn
|
ynh_app_setting_set --app=$app --key=unicorn_port --value=$portUnicorn
|
||||||
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 "/etc/apt/sources.list.d/gitlab-ce.list"
|
ynh_secure_remove --file="/etc/apt/sources.list.d/gitlab-ce.list"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Backing up the app before upgrading (may take a while)..."
|
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --time
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
ynh_secure_remove "$tempdir" 2>&1
|
ynh_exec_warn_less ynh_secure_remove --file="$tempdir"
|
||||||
|
|
||||||
ynh_clean_check_starting
|
ynh_clean_check_starting
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ path_url=$(ynh_normalize_url_path $path_url)
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Installing dependencies..."
|
ynh_script_progression --message="Installing dependencies..." --time
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
@ -177,24 +177,24 @@ ynh_install_app_dependencies $pkg_dependencies
|
||||||
# PRECONFIGURE GITLAB
|
# PRECONFIGURE GITLAB
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info "Preconfigure gitlab..."
|
ynh_script_progression --message="Preconfigure gitlab..." --time
|
||||||
|
|
||||||
ynh_backup_if_checksum_is_different "$config_path/gitlab.rb"
|
ynh_backup_if_checksum_is_different --file="$config_path/gitlab.rb"
|
||||||
|
|
||||||
mkdir -p $config_path
|
mkdir -p $config_path
|
||||||
|
|
||||||
cp -f ../conf/gitlab.rb "$config_path/gitlab.rb"
|
cp -f ../conf/gitlab.rb "$config_path/gitlab.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+")
|
||||||
|
|
||||||
ynh_replace_string "__GENERATED_EXTERNAL_URL__" "https://$domain${path_url%/}" "$config_path/gitlab.rb"
|
ynh_replace_string --match_string="__GENERATED_EXTERNAL_URL__" --replace_string="https://$domain${path_url%/}" --target_file="$config_path/gitlab.rb"
|
||||||
ynh_replace_string "__PORT__" "$port" "$config_path/gitlab.rb"
|
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config_path/gitlab.rb"
|
||||||
ynh_replace_string "__UNICORN_PORT__" "$portUnicorn" "$config_path/gitlab.rb"
|
ynh_replace_string --match_string="__UNICORN_PORT__" --replace_string="$portUnicorn" --target_file="$config_path/gitlab.rb"
|
||||||
ynh_replace_string "__UNICORN_WORKER_PROCESSES__" "$unicorn_worker_processes" "$config_path/gitlab.rb"
|
ynh_replace_string --match_string="__UNICORN_WORKER_PROCESSES__" --replace_string="$unicorn_worker_processes" --target_file="$config_path/gitlab.rb"
|
||||||
ynh_replace_string "__CLIENT_MAX_BODY_SIZE__" "$client_max_body_size" "$config_path/gitlab.rb"
|
ynh_replace_string --match_string="__CLIENT_MAX_BODY_SIZE__" --replace_string="$client_max_body_size" --target_file="$config_path/gitlab.rb"
|
||||||
ynh_replace_string "__SSH_PORT__" "$ssh_port" "$config_path/gitlab.rb"
|
ynh_replace_string --match_string="__SSH_PORT__" --replace_string="$ssh_port" --target_file="$config_path/gitlab.rb"
|
||||||
ynh_replace_string "__SIDEKIQ_PORT__" "$portSidekiq" "$config_path/gitlab.rb"
|
ynh_replace_string --match_string="__SIDEKIQ_PORT__" --replace_string="$portSidekiq" --target_file="$config_path/gitlab.rb"
|
||||||
|
|
||||||
ynh_store_file_checksum "$config_path/gitlab.rb"
|
ynh_store_file_checksum --file="$config_path/gitlab.rb"
|
||||||
|
|
||||||
touch "$config_path/gitlab-persistent.rb"
|
touch "$config_path/gitlab-persistent.rb"
|
||||||
chown admin: "$config_path/gitlab-persistent.rb"
|
chown admin: "$config_path/gitlab-persistent.rb"
|
||||||
|
@ -202,18 +202,18 @@ chown admin: "$config_path/gitlab-persistent.rb"
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Setting up source files..."
|
ynh_script_progression --message="Setting up source files..." --time
|
||||||
|
|
||||||
update_src_version() {
|
update_src_version() {
|
||||||
source ./upgrade.d/upgrade.last.sh
|
source ./upgrade.d/upgrade.last.sh
|
||||||
cp ../conf/$architecture.src.default ../conf/$architecture.src
|
cp ../conf/$architecture.src.default ../conf/$architecture.src
|
||||||
ynh_replace_string "__VERSION__" "$gitlab_version" "../conf/$architecture.src"
|
ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_version" --target_file="../conf/$architecture.src"
|
||||||
ynh_replace_string "__SOURCE_FILENAME__" "$gitlab_filename" "../conf/$architecture.src"
|
ynh_replace_string --match_string="__SOURCE_FILENAME__" --replace_string="$gitlab_filename" --target_file="../conf/$architecture.src"
|
||||||
|
|
||||||
if [ $architecture = "x86-64" ]; then
|
if [ $architecture = "x86-64" ]; then
|
||||||
ynh_replace_string "__SHA256_SUM__" "$gitlab_x86_64_source_sha256" "../conf/$architecture.src"
|
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_x86_64_source_sha256" --target_file="../conf/$architecture.src"
|
||||||
elif [ $architecture = "arm" ]; then
|
elif [ $architecture = "arm" ]; then
|
||||||
ynh_replace_string "__SHA256_SUM__" "$gitlab_arm_source_sha256" "../conf/$architecture.src"
|
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_arm_source_sha256" --target_file="../conf/$architecture.src"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,15 +221,15 @@ update_src_version
|
||||||
|
|
||||||
tempdir="$(mktemp -d)"
|
tempdir="$(mktemp -d)"
|
||||||
|
|
||||||
ynh_setup_source $tempdir $architecture
|
ynh_setup_source --dest_dir=$tempdir --source_id=$architecture
|
||||||
|
|
||||||
if IS_PACKAGE_CHECK; then
|
if IS_PACKAGE_CHECK; then
|
||||||
if ! dpkg -i $tempdir/$gitlab_filename ; then # This command will fail in lxc env
|
if ! ynh_exec_warn_less dpkg -i $tempdir/$gitlab_filename ; then # This command will fail in lxc env
|
||||||
ynh_replace_string "command \"cat \/etc\/sysctl.conf \/etc\/sysctl.d\/\*.conf | sysctl -e -p -\"" "command \"cat \/etc\/sysctl.conf\"" "$final_path/embedded/cookbooks/package/resources/sysctl.rb"
|
ynh_replace_string --match_string="command \"cat \/etc\/sysctl.conf \/etc\/sysctl.d\/\*.conf | sysctl -e -p -\"" --replace_string="command \"cat \/etc\/sysctl.conf\"" --target_file="$final_path/embedded/cookbooks/package/resources/sysctl.rb"
|
||||||
dpkg --configure gitlab-ce
|
ynh_exec_warn_less dpkg --configure gitlab-ce
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
dpkg -i $tempdir/$gitlab_filename
|
ynh_exec_warn_less dpkg -i $tempdir/$gitlab_filename
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -239,7 +239,7 @@ fi
|
||||||
# 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_print_info "Configuring nginx web server..."
|
ynh_script_progression --message="Configuring nginx web server..." --time
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config client_max_body_size
|
ynh_add_nginx_config client_max_body_size
|
||||||
fi
|
fi
|
||||||
|
@ -259,13 +259,13 @@ yunohost service add "gitlab-runsvdir" --log "/var/log/$app/gitlab-rails/applica
|
||||||
# If app is public, add url to SSOWat conf as skipped_uris
|
# If app is public, add url to SSOWat conf as skipped_uris
|
||||||
if [ $is_public -eq 1 ]; then
|
if [ $is_public -eq 1 ]; then
|
||||||
# See install script
|
# See install script
|
||||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
ynh_app_setting_set --app="$app" --key=unprotected_uris --value="/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# WAITING GITLAB
|
# WAITING GITLAB
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Waiting for gitlab..."
|
ynh_script_progression --message="Waiting for gitlab..." --time
|
||||||
|
|
||||||
# Action status to just wait the service
|
# Action status to just wait the service
|
||||||
ynh_systemd_action --action=status --service_name="gitlab-runsvdir" --log_path="/var/log/$app/unicorn/current" --line_match="adopted" --timeout=3600
|
ynh_systemd_action --action=status --service_name="gitlab-runsvdir" --log_path="/var/log/$app/unicorn/current" --line_match="adopted" --timeout=3600
|
||||||
|
@ -273,7 +273,7 @@ ynh_systemd_action --action=status --service_name="gitlab-runsvdir" --log_path="
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Reloading nginx web server..."
|
ynh_script_progression --message="Reloading nginx web server..." --time
|
||||||
|
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
ynh_systemd_action --action=reload --service_name=nginx
|
||||||
|
|
||||||
|
@ -281,5 +281,4 @@ ynh_systemd_action --action=reload --service_name=nginx
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info "Upgrade of $app completed"
|
ynh_script_progression --message="Upgrade of $app completed" --time --last
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue