diff --git a/conf/arm.src.default b/conf/arm.src.default index 9370a8f..09a5abd 100644 --- a/conf/arm.src.default +++ b/conf/arm.src.default @@ -1,6 +1,6 @@ -SOURCE_URL=https://packages.gitlab.com/gitlab/raspberry-pi2/packages/raspbian/__DEBIAN_VERSION__/gitlab-ce___VERSION__-ce.0_armhf.deb/download.deb -SOURCE_SUM=__SHA256_SUM__ +SOURCE_URL=https://packages.gitlab.com/gitlab/raspberry-pi2/packages/raspbian/__GITLAB_DEBIAN_VERSION__/gitlab-ce___GITLAB_VERSION__-ce.0_armhf.deb/download.deb +SOURCE_SUM=__GITLAB_SOURCE_SHA256__ SOURCE_SUM_PRG=sha256sum -SOURCE_FILENAME=__SOURCE_FILENAME__ +SOURCE_FILENAME=__GITLAB_FILENAME__ SOURCE_EXTRACT=false SOURCE_FORMAT=deb diff --git a/conf/arm64.src.default b/conf/arm64.src.default index 89040e9..07782fc 100644 --- a/conf/arm64.src.default +++ b/conf/arm64.src.default @@ -1,6 +1,6 @@ -SOURCE_URL=https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/__DEBIAN_VERSION__/gitlab-ce___VERSION__-ce.0_arm64.deb/download.deb -SOURCE_SUM=__SHA256_SUM__ +SOURCE_URL=https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/__GITLAB_DEBIAN_VERSION__/gitlab-ce___GITLAB_VERSION__-ce.0_arm64.deb/download.deb +SOURCE_SUM=__GITLAB_SOURCE_SHA256__ SOURCE_SUM_PRG=sha256sum -SOURCE_FILENAME=__SOURCE_FILENAME__ +SOURCE_FILENAME=__GITLAB_FILENAME__ SOURCE_EXTRACT=false SOURCE_FORMAT=deb diff --git a/conf/x86-64.src.default b/conf/x86-64.src.default index f8e3b71..1faaa92 100644 --- a/conf/x86-64.src.default +++ b/conf/x86-64.src.default @@ -1,6 +1,6 @@ -SOURCE_URL=https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/__DEBIAN_VERSION__/gitlab-ce___VERSION__-ce.0_amd64.deb/download.deb -SOURCE_SUM=__SHA256_SUM__ +SOURCE_URL=https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/__GITLAB_DEBIAN_VERSION__/gitlab-ce___GITLAB_VERSION__-ce.0_amd64.deb/download.deb +SOURCE_SUM=__GITLAB_SOURCE_SHA256__ SOURCE_SUM_PRG=sha256sum -SOURCE_FILENAME=__SOURCE_FILENAME__ +SOURCE_FILENAME=__GITLAB_FILENAME__ SOURCE_EXTRACT=false SOURCE_FORMAT=deb diff --git a/manifest.json b/manifest.json index bd8c215..922c2a3 100644 --- a/manifest.json +++ b/manifest.json @@ -8,6 +8,14 @@ "fr": "Gestionnaire de dépôts Git." }, "url": "https://gitlab.com", + "upstream": { + "license": "MIT", + "website": "https://gitlab.com", + "demo": "https://gitlab.com/explore", + "admindoc": "https://docs.gitlab.com/", + "userdoc": "https://yunohost.org/fr/app_gitlab", + "code": "https://gitlab.com/gitlab-org/omnibus-gitlab - https://gitlab.com/gitlab-org/gitlab" + }, "license": "MIT", "maintainer": { "name": "kay0u", @@ -25,38 +33,22 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain name for GitLab", - "fr": "Choisissez un nom de domaine pour GitLab" - }, "example": "example.com" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for GitLab", - "fr": "Choisissez un chemin pour GitLab" - }, "example": "/gitlab", "default": "/gitlab" }, { "name": "admin", "type": "user", - "ask": { - "en": "Choose an admin user", - "fr": "Choisissez l’administrateur" - }, "example": "johndoe" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, "default": true }, { diff --git a/scripts/change_url b/scripts/change_url index 1669982..f8f3b4e 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -29,8 +29,8 @@ 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) -portPuma=$(ynh_app_setting_get --app="$app" --key=puma_port) -portSidekiq=$(ynh_app_setting_get --app="$app" --key=sidekiq_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) @@ -118,16 +118,9 @@ ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+") domain="$new_domain" path_url="$new_path" -ynh_replace_string --match_string="__GENERATED_EXTERNAL_URL__" --replace_string="https://$domain${path_url%/}" --target_file="$config_path/gitlab.rb" -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config_path/gitlab.rb" -ynh_replace_string --match_string="__PUMA_PORT__" --replace_string="$portPuma" --target_file="$config_path/gitlab.rb" -ynh_replace_string --match_string="__PUMA_WORKER_PROCESSES__" --replace_string="$puma_worker_processes" --target_file="$config_path/gitlab.rb" -ynh_replace_string --match_string="__PUMA_MIN_THREADS__" --replace_string="$puma_min_threads" --target_file="$config_path/gitlab.rb" -ynh_replace_string --match_string="__PUMA_MAX_THREADS__" --replace_string="$puma_max_threads" --target_file="$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 --match_string="__SSH_PORT__" --replace_string="$ssh_port" --target_file="$config_path/gitlab.rb" -ynh_replace_string --match_string="__SIDEKIQ_PORT__" --replace_string="$portSidekiq" --target_file="$config_path/gitlab.rb" -ynh_replace_string --match_string="__MODIFY_KERNEL_PARAMETERS__" --replace_string="$modify_kernel_parameters" --target_file="$config_path/gitlab.rb" +generated_external_url="https://$domain${path_url%/}" + +ynh_add_config --template="$YNH_APP_BASEDIR/conf/gitlab.rb" --destination="$config_path/gitlab.rb" ynh_store_file_checksum --file="$config_path/gitlab.rb" @@ -142,7 +135,7 @@ gitlab-ctl reconfigure #================================================= 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:$portPuma" --timeout=300 +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 diff --git a/scripts/install b/scripts/install index bd54d05..52f6008 100644 --- a/scripts/install +++ b/scripts/install @@ -86,12 +86,12 @@ ynh_script_progression --message="Find internal port..." --weight=1 # Find free ports port=$(ynh_find_port --port=8080) -portPuma=$(ynh_find_port --port=$(($port + 1))) -portSidekiq=$(ynh_find_port --port=$(($portPuma + 1))) +puma_port=$(ynh_find_port --port=$(($port + 1))) +sidekiq_port=$(ynh_find_port --port=$(($port_puma + 1))) ynh_app_setting_set --app=$app --key=web_port --value=$port -ynh_app_setting_set --app=$app --key=puma_port --value=$portPuma -ynh_app_setting_set --app=$app --key=sidekiq_port --value=$portSidekiq +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 @@ -174,16 +174,9 @@ chown admin: "$config_path/gitlab-persistent.rb" cp -f $YNH_APP_BASEDIR/conf/gitlab.rb "$config_path/gitlab.rb" ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+") -ynh_replace_string --match_string="__GENERATED_EXTERNAL_URL__" --replace_string="https://$domain${path_url%/}" --target_file="$config_path/gitlab.rb" -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config_path/gitlab.rb" -ynh_replace_string --match_string="__PUMA_PORT__" --replace_string="$portPuma" --target_file="$config_path/gitlab.rb" -ynh_replace_string --match_string="__PUMA_WORKER_PROCESSES__" --replace_string="$puma_worker_processes" --target_file="$config_path/gitlab.rb" -ynh_replace_string --match_string="__PUMA_MIN_THREADS__" --replace_string="$puma_min_threads" --target_file="$config_path/gitlab.rb" -ynh_replace_string --match_string="__PUMA_MAX_THREADS__" --replace_string="$puma_max_threads" --target_file="$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 --match_string="__SSH_PORT__" --replace_string="$ssh_port" --target_file="$config_path/gitlab.rb" -ynh_replace_string --match_string="__SIDEKIQ_PORT__" --replace_string="$portSidekiq" --target_file="$config_path/gitlab.rb" -ynh_replace_string --match_string="__MODIFY_KERNEL_PARAMETERS__" --replace_string="$modify_kernel_parameters" --target_file="$config_path/gitlab.rb" +generated_external_url="https://$domain${path_url%/}" + +ynh_add_config --template="$YNH_APP_BASEDIR/conf/gitlab.rb" --destination="$config_path/gitlab.rb" #================================================= # STORE THE CONFIG FILE CHECKSUM @@ -197,11 +190,7 @@ ynh_store_file_checksum --file="$config_path/gitlab.rb" ynh_script_progression --message="Setting up source files..." --weight=50 source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.last.sh -cp $YNH_APP_BASEDIR/conf/$architecture.src.default $YNH_APP_BASEDIR/conf/$architecture.src -ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_version" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src" -ynh_replace_string --match_string="__SOURCE_FILENAME__" --replace_string="$gitlab_filename" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src" -ynh_replace_string --match_string="__DEBIAN_VERSION__" --replace_string="$gitlab_debian_version" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src" -ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_source_sha256" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src" +ynh_add_config --template="$YNH_APP_BASEDIR/conf/$architecture.src.default" --destination="$YNH_APP_BASEDIR/conf/$architecture.src" tempdir="$(mktemp -d)" @@ -274,7 +263,7 @@ ynh_systemd_action --action=reload --service_name=nginx #================================================= ynh_script_progression --message="Restarting 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:$portPuma" --timeout=300 +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 #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 6ebdc2c..d54349d 100644 --- a/scripts/restore +++ b/scripts/restore @@ -33,7 +33,7 @@ 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) -portPuma=$(ynh_app_setting_get --app="$app" --key=puma_port) +puma_port=$(ynh_app_setting_get --app="$app" --key=puma_port) architecture=$(ynh_app_setting_get --app="$app" --key=architecture) #================================================= @@ -97,11 +97,7 @@ ynh_restore_file --origin_path="$config_path/gitlab-persistent.rb" ynh_script_progression --message="Reinstalling GitLab..." --weight=50 source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.last.sh -cp $YNH_APP_BASEDIR/conf/$architecture.src.default $YNH_APP_BASEDIR/conf/$architecture.src -ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_version" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src" -ynh_replace_string --match_string="__SOURCE_FILENAME__" --replace_string="$gitlab_filename" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src" -ynh_replace_string --match_string="__DEBIAN_VERSION__" --replace_string="$gitlab_debian_version" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src" -ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_source_sha256" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src" +ynh_add_config --template="$YNH_APP_BASEDIR/conf/$architecture.src.default" --destination="$YNH_APP_BASEDIR/conf/$architecture.src" tempdir="$(mktemp -d)" @@ -149,7 +145,7 @@ yunohost service add "gitlab-runsvdir" --log "/var/log/$app/gitlab-rails/applica #================================================= ynh_script_progression --message="Waiting for GitLab..." --weight=14 -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:$portPuma" --timeout=300 +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 #================================================= # CHECK THE RESTORED DATA diff --git a/scripts/upgrade b/scripts/upgrade index 9399e24..6992446 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -22,8 +22,8 @@ is_public=$(ynh_app_setting_get --app="$app" --key=is_public) 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) -portPuma=$(ynh_app_setting_get --app="$app" --key=puma_port) -portSidekiq=$(ynh_app_setting_get --app="$app" --key=sidekiq_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) @@ -126,19 +126,19 @@ if [ -z "$port" ]; then fi # If port doesn't exist, retrieve it -if [ -z "$portPuma" ]; then +if [ -z "$puma_port" ]; then if [ -z "$(ynh_app_setting_get --app="$app" --key=unicorn_port)" ]; then - portPuma=$(grep -F "unicorn['port']" "/etc/gitlab/gitlab.rb" | cut -d' ' -f3) + puma_port=$(grep -F "unicorn['port']" "/etc/gitlab/gitlab.rb" | cut -d' ' -f3) else - portPuma=$(ynh_app_setting_get --app="$app" --key=unicorn_port) + puma_port=$(ynh_app_setting_get --app="$app" --key=unicorn_port) fi - ynh_app_setting_set --app=$app --key=puma_port --value=$portPuma + ynh_app_setting_set --app=$app --key=puma_port --value=$puma_port ynh_app_setting_delete --app=$app --key=unicorn_port fi -if [ -z "$portSidekiq" ]; then - portSidekiq=$(ynh_find_port $(($portPuma + 1))) - ynh_app_setting_set --app=$app --key=sidekiq_port --value=$portSidekiq +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 @@ -265,11 +265,7 @@ then fi fi - cp $YNH_APP_BASEDIR/conf/$architecture.src.default $YNH_APP_BASEDIR/conf/$architecture.src - ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_version" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src" - ynh_replace_string --match_string="__SOURCE_FILENAME__" --replace_string="$gitlab_filename" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src" - ynh_replace_string --match_string="__DEBIAN_VERSION__" --replace_string="$gitlab_debian_version" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src" - ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_source_sha256" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src" + ynh_add_config --template="$YNH_APP_BASEDIR/conf/$architecture.src.default" --destination="$YNH_APP_BASEDIR/conf/$architecture.src" tempdir="$(mktemp -d)" @@ -313,16 +309,9 @@ mkdir -p $config_path cp -f $YNH_APP_BASEDIR/conf/gitlab.rb "$config_path/gitlab.rb" ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+") -ynh_replace_string --match_string="__GENERATED_EXTERNAL_URL__" --replace_string="https://$domain${path_url%/}" --target_file="$config_path/gitlab.rb" -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config_path/gitlab.rb" -ynh_replace_string --match_string="__PUMA_PORT__" --replace_string="$portPuma" --target_file="$config_path/gitlab.rb" -ynh_replace_string --match_string="__PUMA_WORKER_PROCESSES__" --replace_string="$puma_worker_processes" --target_file="$config_path/gitlab.rb" -ynh_replace_string --match_string="__PUMA_MIN_THREADS__" --replace_string="$puma_min_threads" --target_file="$config_path/gitlab.rb" -ynh_replace_string --match_string="__PUMA_MAX_THREADS__" --replace_string="$puma_max_threads" --target_file="$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 --match_string="__SSH_PORT__" --replace_string="$ssh_port" --target_file="$config_path/gitlab.rb" -ynh_replace_string --match_string="__SIDEKIQ_PORT__" --replace_string="$portSidekiq" --target_file="$config_path/gitlab.rb" -ynh_replace_string --match_string="__MODIFY_KERNEL_PARAMETERS__" --replace_string="$modify_kernel_parameters" --target_file="$config_path/gitlab.rb" +generated_external_url="https://$domain${path_url%/}" + +ynh_add_config --template="$YNH_APP_BASEDIR/conf/gitlab.rb" --destination="$config_path/gitlab.rb" ynh_store_file_checksum --file="$config_path/gitlab.rb" @@ -362,7 +351,7 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Restarting 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:$portPuma" --timeout=300 + 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 fi #=================================================