diff --git a/check_process b/check_process deleted file mode 100644 index 83f543a..0000000 --- a/check_process +++ /dev/null @@ -1,31 +0,0 @@ -# See here for more informations -# https://github.com/YunoHost/package_check#syntax-check_process-file -;; Test complet - ; Manifest - domain="domain.tld" (DOMAIN) - path="/gitlab" (PATH) - admin="john" (USER) - is_public=1 (PUBLIC|public=1|private=0) - use_web_account=0 - ; Checks - pkg_linter=1 - setup_sub_dir=1 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - upgrade=1 from_commit=2cc84310aeff7055342b445c1aee01d4183d5ae2 - upgrade=1 from_commit=7c352aff3fb13fc425d76716477c28db5d54ac99 - backup_restore=1 - multi_instance=0 - port_already_use=1 (8080) - change_url=1 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=2cc84310aeff7055342b445c1aee01d4183d5ae2 - name=11.6.3 - ; commit=7c352aff3fb13fc425d76716477c28db5d54ac99 - name=12.9.2 diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 30a7dbb..0000000 --- a/manifest.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "GitLab", - "id": "gitlab", - "packaging_format": 1, - "version": "15.9.1~ynh1", - "description": { - "en": "Git-repository manager providing wiki, issue-tracking and CI/CD pipeline features", - "fr": "Gestionnaire de dépôts Git proposant des fonctionnalités de wiki, suivi de bugs et de pipeline CI/CD" - }, - "url": "https://gitlab.com", - "upstream": { - "license": "MIT", - "website": "https://gitlab.com", - "demo": "https://gitlab.com/explore", - "admindoc": "https://docs.gitlab.com/", - "code": "https://gitlab.com/gitlab-org/omnibus-gitlab - https://gitlab.com/gitlab-org/gitlab", - "cpe": "cpe:2.3:a:gitlab:gitlab" - }, - "license": "MIT", - "maintainer": { - "name": "kay0u", - "email": "pierre@kayou.io" - }, - "requirements": { - "yunohost": ">= 4.2.3" - }, - "multi_instance": false, - "services": [ - "nginx" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "default": "/gitlab" - }, - { - "name": "admin", - "type": "user" - }, - { - "name": "is_public", - "type": "boolean", - "help": { - "en": "If your GitLab instance is public, anyone can see your public repositories.", - "fr": "Si votre instance GitLab est publique, tout le monde pourra voir vos dépôts publics." - }, - "default": true - }, - { - "name": "use_web_account", - "type": "boolean", - "ask": { - "en": "Authorize account creation from GitLab web interface", - "fr": "Autoriser la création de compte depuis l'interface web de GitLab ?" - }, - "default": false - } - ] - } -} \ No newline at end of file diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..4098df1 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,72 @@ +packaging_format = 2 + +id = "gitlab" +name = "GitLab" +description.en = "Git-repository manager providing wiki, issue-tracking and CI/CD pipeline features" +description.fr = "Gestionnaire de dépôts Git proposant des fonctionnalités de wiki, suivi de bugs et de pipeline CI/CD" + +version = "15.9.1~ynh1" + +maintainers = ["kay0u"] + +[upstream] +license = "MIT" +website = "https://gitlab.com" +demo = "https://gitlab.com/explore" +admindoc = "https://docs.gitlab.com/" +code = "https://gitlab.com/gitlab-org/omnibus-gitlab - https://gitlab.com/gitlab-org/gitlab" +cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) +fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. + +[integration] +yunohost = ">= 4.2.3" +architectures = ["amd64", "armhf", "arm64"] +multi_instance = false +ldap = true +sso = false +disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... +ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... + +[install] + [install.domain] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "domain" + + [install.path] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "path" + default = "/gitlab" + + [install.admin] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "user" + + [install.init_main_permission] + help.en = "If your GitLab instance is public, anyone can see your public repositories." + help.fr = "Si votre instance GitLab est publique, tout le monde pourra voir vos dépôts publics." + type = "group" + default = "visitors" + + [install.use_web_account] + ask.en = "Authorize account creation from GitLab web interface" + ask.fr = "Autoriser la création de compte depuis l'interface web de GitLab ?" + type = "boolean" + default = false + +[resources] + [resources.system_user] + + [resources.install_dir] + dir = "/opt/__APP__" + + [resources.permissions] + main.url = "/" + + [resources.ports] + main.default = 8080 + puma.default = 8081 + sidekiq.default = 8082 + + [resources.apt] + packages = "openssh-server" diff --git a/scripts/_common.sh b/scripts/_common.sh index 0981cca..db8801d 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# SET ALL CONSTANTS -#================================================= - -pkg_dependencies="openssh-server" - #================================================= # EXPERIMENTAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 3f40d60..b5cae11 100644 --- a/scripts/backup +++ b/scripts/backup @@ -10,27 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. - true -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_print_info --message="Loading installation settings..." - -app=$YNH_APP_INSTANCE_NAME - -config_path=$(ynh_app_setting_get --app=$app --key=config_path) -domain=$(ynh_app_setting_get --app=$app --key=domain) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= @@ -57,6 +36,7 @@ ynh_backup --src_path="/var/opt/$app/backups/last_gitlab_backup.tar" # BACKUP CONF FILES #================================================= +config_path=/etc/$app ynh_backup --src_path="$config_path/gitlab-secrets.json" ynh_backup --src_path="$config_path/gitlab.rb" ynh_backup --src_path="$config_path/gitlab-persistent.rb" diff --git a/scripts/change_url b/scripts/change_url index 7d17bec..1bdcb33 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -8,48 +8,6 @@ source _common.sh source /usr/share/yunohost/helpers -ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH - -new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -# Needed for helper "ynh_add_nginx_config" -config_path=$(ynh_app_setting_get --app=$app --key=config_path) -port=$(ynh_app_setting_get --app="$app" --key=web_port) -puma_port=$(ynh_app_setting_get --app="$app" --key=puma_port) -sidekiq_port=$(ynh_app_setting_get --app="$app" --key=sidekiq_port) -puma_worker_processes=$(ynh_app_setting_get --app="$app" --key=puma_workers) -puma_min_threads=$(ynh_app_setting_get --app="$app" --key=puma_min_threads) -puma_max_threads=$(ynh_app_setting_get --app="$app" --key=puma_max_threads) -client_max_body_size=$(ynh_app_setting_get --app="$app" --key=client_max_body_size) - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -change_domain=0 -if [ "$old_domain" != "$new_domain" ]; then - change_domain=1 -fi - -change_path=0 -if [ "$old_path" != "$new_path" ]; then - change_path=1 -fi #================================================= # STANDARD MODIFICATIONS @@ -58,35 +16,12 @@ fi #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 -nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf +#doc in: https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab -if [ $change_path -eq 1 ]; then - ynh_script_progression --message="Changing path..." --weight=4 +gitlab-ctl stop puma +gitlab-ctl stop sidekiq - #doc in: https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab - - gitlab-ctl stop puma - gitlab-ctl stop sidekiq - - # Make a backup of the original nginx config file if modified - ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for nginx helper - domain="$old_domain" - path_url="$new_path" - # Create a dedicated nginx config - ynh_add_nginx_config client_max_body_size -fi - -# Change the domain for nginx -if [ $change_domain -eq 1 ]; then - ynh_script_progression --message="Changing domain..." --weight=4 - - # Delete file checksum for the old conf file location - ynh_delete_file_checksum --file="$nginx_conf_path" - mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location - ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi +ynh_change_url_nginx_config #================================================= # SPECIFIC MODIFICATIONS @@ -111,11 +46,10 @@ ynh_script_progression --message="Configure GitLab..." --weight=28 mkdir -p $config_path ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+") - domain="$new_domain" -path_url="$new_path" +path="$new_path" -generated_external_url="https://$domain${path_url%/}" +generated_external_url="https://$domain${path%/}" ynh_add_config --template="$YNH_APP_BASEDIR/conf/gitlab.rb" --destination="$config_path/gitlab.rb" @@ -132,15 +66,6 @@ ynh_script_progression --message="Waiting for GitLab..." --weight=15 ynh_systemd_action --action=restart --service_name="gitlab-runsvdir" --log_path="/var/log/$app/puma/current" --line_match="Listening on http://127.0.0.1:$puma_port" --timeout=300 -#================================================= -# GENERIC FINALISATION -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --action=reload --service_name=nginx - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index 5b09460..e9ed661 100644 --- a/scripts/install +++ b/scripts/install @@ -9,38 +9,12 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - ynh_exec_warn_less ynh_secure_remove --file="$tempdir" - - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH -is_public=$YNH_APP_ARG_IS_PUBLIC -use_web_account=$YNH_APP_ARG_USE_WEB_ACCOUNT -admin=$YNH_APP_ARG_ADMIN - -app=$YNH_APP_INSTANCE_NAME - #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= ynh_script_progression --message="Validating installation parameters..." --weight=1 config_path=/etc/$app -final_path=/opt/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Detect the system architecture if [ -n "$(uname -m | grep arm64)" ] || [ -n "$(uname -m | grep aarch64)" ]; then @@ -59,47 +33,17 @@ fi # Could be an option? client_max_body_size="250m" -# Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= ynh_script_progression --message="Storing installation settings..." --weight=2 -ynh_app_setting_set --app=$app --key=admin --value=$admin -ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=use_web_account --value=$use_web_account -ynh_app_setting_set --app=$app --key=final_path --value=$final_path -ynh_app_setting_set --app=$app --key=config_path --value=$config_path ynh_app_setting_set --app=$app --key=architecture --value=$architecture ynh_app_setting_set --app=$app --key=client_max_body_size --value=$client_max_body_size - ynh_app_setting_set --app=$app --key=overwrite_nginx --value="1" #================================================= # STANDARD MODIFICATIONS -#================================================= -# FIND A PORT -#================================================= -ynh_script_progression --message="Find internal port..." --weight=1 - -# Find free ports -port=$(ynh_find_port --port=8080) -puma_port=$(ynh_find_port --port=$(($port + 1))) -sidekiq_port=$(ynh_find_port --port=$(($puma_port + 1))) - -ynh_app_setting_set --app=$app --key=web_port --value=$port -ynh_app_setting_set --app=$app --key=puma_port --value=$puma_port -ynh_app_setting_set --app=$app --key=sidekiq_port --value=$sidekiq_port - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." --weight=5 - -ynh_install_app_dependencies $pkg_dependencies - #================================================= # DEFINE THE NUMBER OF WORKERS USED #================================================= @@ -174,7 +118,7 @@ chmod 640 "$config_path/gitlab-persistent.rb" ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+") -generated_external_url="https://$domain${path_url%/}" +generated_external_url="https://$domain${path%/}" ynh_add_config --template="$YNH_APP_BASEDIR/conf/gitlab.rb" --destination="$config_path/gitlab.rb" @@ -235,20 +179,9 @@ usermod -a -G "ssh.app" "git" yunohost service add "gitlab-runsvdir" --log "/var/log/$app/gitlab-rails/application.log" "/var/log/$app/gitlab-rails/api_json.log" "/var/log/$app/gitlab-rails/production.log" "/var/log/$app/gitlab-rails/production_json.log" "/var/log/$app/gitlab-rails/sidekiq.log" "/var/log/$app/puma/puma_stderr.log" "/var/log/$app/puma/current" "/var/log/$app/alertmanager/current" "/var/log/$app/gitaly/current" "/var/log/$app/gitlab-monitor/current" "/var/log/$app/gitlab-shell/gitlab-shell.log" "/var/log/$app/gitlab-workhorse/current" "/var/log/$app/logrotate/current" "/var/log/$app/nginx/current" "/var/log/$app/nginx/access.log" "/var/log/$app/nginx/error.log" "/var/log/$app/nginx/gitlab_access.log" "/var/log/$app/nginx/gitlab_error.log" "/var/log/$app/node-exporter/current" "/var/log/$app/postgres-exporter/current" "/var/log/$app/postgresql/current" "/var/log/$app/prometheus/current" "/var/log/$app/redis/current" "/var/log/$app/redis-exporter/current" -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Configuring SSOwat..." --weight=1 - -# Make app public if necessary -if [ $is_public -eq 1 ]; then - ynh_permission_update --permission="main" --add="visitors" -fi - #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --action=reload --service_name=nginx diff --git a/scripts/remove b/scripts/remove index 9f5c60b..85c9d04 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,22 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=2 - -app=$YNH_APP_INSTANCE_NAME - -port=$(ynh_app_setting_get --app="$app" --key=web_port) -portPuma=$(ynh_app_setting_get --app="$app" --key=puma_port) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -config_path=$(ynh_app_setting_get --app=$app --key=config_path) - -# Used by ynh_remove_nginx_config -domain=$(ynh_app_setting_get --app="$app" --key=domain) - -#================================================= # STANDARD REMOVE #================================================= # REMOVE SERVICE FROM ADMIN PANEL @@ -51,21 +35,12 @@ ynh_script_progression --message="Removing GitLab" --weight=4 dpkg --remove gitlab-ce -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies" --weight=3 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory" --weight=1 # Remove the app directory securely -ynh_secure_remove --file="$final_path" +config_path=/etc/$app ynh_secure_remove --file="$config_path" #================================================= @@ -103,7 +78,6 @@ ynh_secure_remove --file="/var/opt/$app" ynh_secure_remove --file="/var/log/$app" # Remove swap - ynh_del_swap #================================================= diff --git a/scripts/restore b/scripts/restore index 799759b..877a895 100644 --- a/scripts/restore +++ b/scripts/restore @@ -10,39 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - ynh_exec_warn_less ynh_secure_remove --file="$tempdir" - - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading settings..." --weight=1 - -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -config_path=$(ynh_app_setting_get --app=$app --key=config_path) -puma_port=$(ynh_app_setting_get --app="$app" --key=puma_port) -architecture=$(ynh_app_setting_get --app="$app" --key=architecture) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=1 - -test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " - #================================================= # STANDARD RESTORATION STEPS #================================================= @@ -51,14 +18,6 @@ test ! -d $final_path || ynh_die --message="There is already a directory: $final ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=5 - -# Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies - #================================================= # ADD SWAP IF NEEDED #================================================= @@ -84,6 +43,7 @@ fi #================================================= ynh_script_progression --message="Restoring configuration files of GitLab..." --weight=1 +config_path=/etc/$app ynh_restore_file --origin_path="$config_path/gitlab-secrets.json" ynh_restore_file --origin_path="$config_path/gitlab.rb" ynh_restore_file --origin_path="$config_path/gitlab-persistent.rb" diff --git a/scripts/upgrade b/scripts/upgrade index 73e86da..8a0df5b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,27 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= - -app=$YNH_APP_INSTANCE_NAME - -# Retrieve app settings -domain=$(ynh_app_setting_get --app="$app" --key=domain) -path_url=$(ynh_app_setting_get --app="$app" --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -config_path=$(ynh_app_setting_get --app=$app --key=config_path) -port=$(ynh_app_setting_get --app="$app" --key=web_port) -puma_port=$(ynh_app_setting_get --app="$app" --key=puma_port) -sidekiq_port=$(ynh_app_setting_get --app="$app" --key=sidekiq_port) -architecture=$(ynh_app_setting_get --app="$app" --key=architecture) -puma_worker_processes=$(ynh_app_setting_get --app="$app" --key=puma_workers) -puma_min_threads=$(ynh_app_setting_get --app="$app" --key=puma_min_threads) -puma_max_threads=$(ynh_app_setting_get --app="$app" --key=puma_max_threads) -client_max_body_size=$(ynh_app_setting_get --app="$app" --key=client_max_body_size) -overwrite_nginx=$(ynh_app_setting_get --app="$app" --key=overwrite_nginx) - #================================================= # CHECK VERSION #================================================= @@ -40,17 +19,7 @@ upgrade_type=$(ynh_check_app_version_changed) # ENSURE DOWNWARD COMPATIBILITY #================================================= -# If final_path doesn't exist, create it -if [ -z "$final_path" ]; then - final_path=/opt/$app - ynh_app_setting_set --app=$app --key=final_path --value=$final_path -fi - -# If config_path doesn't exist, create it -if [ -z "$config_path" ]; then - config_path=/etc/$app - ynh_app_setting_set --app=$app --key=config_path --value=$config_path -fi +config_path=/etc/$app if [ -z "$puma_max_threads" ] || [ -z "$puma_min_threads" ]; then # If the server has less than 2GB of RAM @@ -91,82 +60,13 @@ if [ -z "$client_max_body_size" ]; then ynh_app_setting_set --app=$app --key=client_max_body_size --value=$client_max_body_size fi -# If overwrite_nginx doesn't exist, create it -if [ -z "$overwrite_nginx" ]; then - overwrite_nginx=1 - ynh_app_setting_set --app=$app --key=overwrite_nginx --value=$overwrite_nginx -fi - -# If domain doesn't exist, retrieve it -if [ -z "$domain" ]; then - domain=$(grep "external_url" "/etc/gitlab/gitlab.rb" | cut -d'/' -f3) # retrieve $domain from conf file - if [ ${domain: -1} == "'" ]; then # if the last char of $domain is ' remove it - domain=${domain:0:-1} - fi - ynh_app_setting_set --app=$app --key=domain --value=$domain -fi - -# If path_url doesn't exist, retrieve it -if [ -z "$path_url" ]; then - path_url=$(grep "location" "/etc/nginx/conf.d/${domain}.d/gitlab.conf" | cut -d' ' -f2) - path_url=$(ynh_normalize_url_path $path_url) - ynh_app_setting_set --app=$app --key=path --value=path_url -fi - -# If port doesn't exist, retrieve it -if [ -z "$port" ]; then - port=$(grep -F "nginx['listen_port']" "/etc/gitlab/gitlab.rb" | cut -d' ' -f3) - ynh_app_setting_set --app=$app --key=web_port --value=$port -fi - -# If port doesn't exist, retrieve it -if [ -z "$puma_port" ]; then - if [ -z "$(ynh_app_setting_get --app="$app" --key=unicorn_port)" ]; then - puma_port=$(grep -F "unicorn['port']" "/etc/gitlab/gitlab.rb" | cut -d' ' -f3) - else - puma_port=$(ynh_app_setting_get --app="$app" --key=unicorn_port) - fi - ynh_app_setting_set --app=$app --key=puma_port --value=$puma_port - ynh_app_setting_delete --app=$app --key=unicorn_port -fi - -if [ -z "$sidekiq_port" ]; then - sidekiq_port=$(ynh_find_port $(($puma_port + 1))) - ynh_app_setting_set --app=$app --key=sidekiq_port --value=$sidekiq_port -fi - # if this source file exist, remove it if [ -e "/etc/apt/sources.list.d/gitlab-ce.list" ]; then ynh_secure_remove --file="/etc/apt/sources.list.d/gitlab-ce.list" fi -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=10 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - ynh_exec_warn_less ynh_secure_remove --file="$tempdir" - - ynh_clean_check_starting - - # restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - #================================================= # STANDARD UPGRADE STEPS -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." --weight=5 - -ynh_install_app_dependencies $pkg_dependencies - #================================================= # DEFINE THE NUMBER OF WORKERS USED #================================================= @@ -222,7 +122,7 @@ done mkdir -p $config_path ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+") -generated_external_url="https://$domain${path_url%/}" +generated_external_url="https://$domain${path%/}" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -415,7 +315,6 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --action=reload --service_name=nginx diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..4935608 --- /dev/null +++ b/tests.toml @@ -0,0 +1,8 @@ +test_format = 1.0 + +[default] + # ------------------------------- + # Commits to test upgrade from + # ------------------------------- + + test_upgrade_from.7c352aff3fb13fc425d76716477c28db5d54ac99.name = "Upgrade from 12.9.2" \ No newline at end of file