1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gitlab_ynh.git synced 2024-09-03 18:36:35 +02:00

Merge pull request #38 from YunoHost-Apps/testing

Merge Testing
This commit is contained in:
Kayou 2019-03-28 00:20:35 +01:00 committed by GitHub
commit 9fd0156415
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 94 additions and 83 deletions

View file

@ -10,7 +10,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to
GitLab is a web-based Git-repository manager providing wiki, issue-tracking and CI/CD pipeline features, using an open-source license, developed by GitLab Inc. GitLab is a web-based Git-repository manager providing wiki, issue-tracking and CI/CD pipeline features, using an open-source license, developed by GitLab Inc.
**Shipped version:** 11.9.0 **Shipped version:** 11.9.1
## Screenshots ## Screenshots

View file

@ -23,6 +23,7 @@ nginx['listen_addresses'] = ["0.0.0.0", "[::]"] # listen on all IPv4 and IPv6 ad
unicorn['port'] = __PORTUNICORN__ unicorn['port'] = __PORTUNICORN__
unicorn['worker_processes'] = 2 # https://docs.gitlab.com/ee/install/requirements.html#unicorn-workers
unicorn['worker_processes'] = __UNICORN_WORKER_PROCESSES__
sidekiq['concurrency'] = 5 # base: 25 sidekiq['concurrency'] = 5 # base: 25

View file

@ -2,7 +2,7 @@
"name": "Gitlab", "name": "Gitlab",
"id": "gitlab", "id": "gitlab",
"packaging_format": 1, "packaging_format": 1,
"version": "11.9.0~ynh1", "version": "11.9.1~ynh1",
"description": { "description": {
"en": "GitLab is a Git-repository manager.", "en": "GitLab is a Git-repository manager.",
"fr": "GitLab est un gestionnaire de dépôts Git." "fr": "GitLab est un gestionnaire de dépôts Git."

View file

@ -17,7 +17,6 @@
- [ ] **Approval (LGTM)** - [ ] **Approval (LGTM)**
*Code review and approval have to be from a member of @YunoHost/apps group* *Code review and approval have to be from a member of @YunoHost/apps group*
- **CI succeeded** : - **CI succeeded** :
[![Build Status](https://ci-apps-hq.yunohost.org/jenkins/job/gitlab_ynh%20-BRANCH-/badge/icon)](https://ci-apps-hq.yunohost.org/jenkins/job/gitlab_ynh%20-BRANCH-/) [![Build Status](https://ci-apps-hq.yunohost.org/jenkins/job/gitlab_ynh%20PR-NUM-/badge/icon)](https://ci-apps-hq.yunohost.org/jenkins/job/gitlab_ynh%20PR-NUM-/)
*Please replace '-BRANCH-' in this link by the name of the branch used.* *Please replace '-NUM-' in this link by the PR number.*
*If the PR is from a forked repository. Please provide public results from package_check.*
When the PR is marked as ready to merge, you have to wait for 3 days before really merging it. When the PR is marked as ready to merge, you have to wait for 3 days before really merging it.

View file

@ -113,62 +113,6 @@ ynh_systemd_action() {
fi fi
} }
# This function is inspired by the ynh_systemd_action function
# Start (or other actions) a service, print a log in case of failure and optionnaly wait until the service is completely started
#
# usage: gitlab_ctl_waiting [ [-t timeout] ]
# | arg: -t, --timeout= - Timeout - The maximum time to wait before ending the watching. Default : 300 seconds.
gitlab_ctl_waiting() {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [t]=timeout= )
local timeout
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
local line_match_new="adopted new unicorn master"
local line_match_existing="adopted existing unicorn master"
local line_match_error="master failed to start"
local log_path="/var/log/gitlab/unicorn/current"
local timeout=${timeout:-300}
# Following the starting of the app in its log
local templog="$(mktemp)"
tail -F -n1 "$log_path" >"$templog" &
# get the PID of the tail command
local pid_tail=$!
if grep --quiet "${line_match_error}" $templog; then # error, so restart gitlab
gitlab-ctl restart
fi
# Start the timeout and try to find line_match_new or line_match_existing
local i=0
for i in $(seq 1 $timeout)
do
if grep --quiet "${line_match_new}" "$templog" || grep --quiet "${line_match_existing}" "$templog"; then
ynh_print_info --message="Gitlab has correctly started."
break
fi
if [ $i -ge 3 ]; then
echo -n "." >&2
fi
sleep 1
done
if [ $i -ge 3 ]; then
echo "" >&2
fi
if [ $i -eq $timeout ]
then
ynh_print_warn --message="Gitlab didn't fully started before the timeout."
ynh_print_warn --message="Please find here an extract of the end of the log of Gitlab:"
test -e "$log_path" && echo "--" >&2 && tail --lines=$length "$log_path" >&2
fi
ynh_clean_check_starting
}
# Clean temporary process and file used by ynh_check_starting # Clean temporary process and file used by ynh_check_starting
# (usually used in ynh_clean_setup scripts) # (usually used in ynh_clean_setup scripts)
# #

View file

@ -31,6 +31,7 @@ final_path=$(ynh_app_setting_get $app final_path)
config_path=$(ynh_app_setting_get $app config_path) config_path=$(ynh_app_setting_get $app config_path)
port=$(ynh_app_setting_get "$app" web_port) port=$(ynh_app_setting_get "$app" web_port)
portUnicorn=$(ynh_app_setting_get "$app" unicorn_port) portUnicorn=$(ynh_app_setting_get "$app" unicorn_port)
unicorn_worker_processes=$(ynh_app_setting_get "$app" unicorn_worker_processes)
#================================================= #=================================================
# CHECK THE SYNTAX OF THE PATHS # CHECK THE SYNTAX OF THE PATHS
@ -111,6 +112,7 @@ path_url="$new_path"
ynh_replace_string "__GENERATED_EXTERNAL_URL__" "https://$domain${path_url%/}" "$config_path/gitlab.rb" ynh_replace_string "__GENERATED_EXTERNAL_URL__" "https://$domain${path_url%/}" "$config_path/gitlab.rb"
ynh_replace_string "__PORT__" "$port" "$config_path/gitlab.rb" ynh_replace_string "__PORT__" "$port" "$config_path/gitlab.rb"
ynh_replace_string "__PORTUNICORN__" "$portUnicorn" "$config_path/gitlab.rb" ynh_replace_string "__PORTUNICORN__" "$portUnicorn" "$config_path/gitlab.rb"
ynh_replace_string "__UNICORN_WORKER_PROCESSES__" "$unicorn_worker_processes" "$config_path/gitlab.rb"
ynh_store_file_checksum "$config_path/gitlab.rb" ynh_store_file_checksum "$config_path/gitlab.rb"
@ -125,9 +127,13 @@ if [ $change_path -eq 1 ]; then
gitlab-ctl restart unicorn gitlab-ctl restart unicorn
fi fi
#=================================================
# WAITING GITLAB
#=================================================
ynh_print_info "Waiting for gitlab..." ynh_print_info "Waiting for gitlab..."
gitlab_ctl_waiting --timeout=3600 # 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
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION

View file

@ -54,6 +54,18 @@ else
your hardware and the result of the command \"uname -m\"." 1 your hardware and the result of the command \"uname -m\"." 1
fi fi
# https://docs.gitlab.com/ee/install/requirements.html#unicorn-workers
unicorn_worker_processes=$(($(nproc) + 1 ))
# If the server has at least 2GB of RAM
if [ $(free -g --si | grep Mem: | awk '{print $2}') -ge 2 ]; then
# Min 3 worker processes
unicorn_worker_processes=$(($unicorn_worker_processes>3?$unicorn_worker_processes:3))
else
# 2 worker processes
unicorn_worker_processes=2
fi
path_url=$(ynh_normalize_url_path $path_url) path_url=$(ynh_normalize_url_path $path_url)
# Register (book) web path # Register (book) web path
@ -71,6 +83,7 @@ ynh_app_setting_set $app use_web_account $use_web_account
ynh_app_setting_set $app final_path $final_path ynh_app_setting_set $app final_path $final_path
ynh_app_setting_set $app config_path $config_path ynh_app_setting_set $app config_path $config_path
ynh_app_setting_set $app architecture $architecture ynh_app_setting_set $app architecture $architecture
ynh_app_setting_set $app unicorn_worker_processes $unicorn_worker_processes
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
@ -108,6 +121,7 @@ cp -f ../conf/gitlab.rb "$config_path/gitlab.rb"
ynh_replace_string "__GENERATED_EXTERNAL_URL__" "https://$domain${path_url%/}" "$config_path/gitlab.rb" ynh_replace_string "__GENERATED_EXTERNAL_URL__" "https://$domain${path_url%/}" "$config_path/gitlab.rb"
ynh_replace_string "__PORT__" "$port" "$config_path/gitlab.rb" ynh_replace_string "__PORT__" "$port" "$config_path/gitlab.rb"
ynh_replace_string "__PORTUNICORN__" "$portUnicorn" "$config_path/gitlab.rb" ynh_replace_string "__PORTUNICORN__" "$portUnicorn" "$config_path/gitlab.rb"
ynh_replace_string "__UNICORN_WORKER_PROCESSES__" "$unicorn_worker_processes" "$config_path/gitlab.rb"
#================================================= #=================================================
# STORE THE CONFIG FILE CHECKSUM # STORE THE CONFIG FILE CHECKSUM
@ -182,6 +196,12 @@ gitlab-ctl reconfigure
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
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/unicorn/unicorn_stderr.log /var/log/$app/unicorn/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 # SETUP SSOWAT
#================================================= #=================================================
@ -193,13 +213,6 @@ if [ $is_public -eq 1 ]; then
ynh_app_setting_set $app unprotected_uris "/" ynh_app_setting_set $app unprotected_uris "/"
fi fi
#=================================================
# RESTART GITLAB
#=================================================
ynh_print_info "Waiting for gitlab..."
gitlab_ctl_waiting --timeout=3600
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================

View file

@ -24,6 +24,16 @@ config_path=$(ynh_app_setting_get $app config_path)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
#=================================================
if yunohost service status "gitlab-runsvdir" >/dev/null 2>&1
then
ynh_print_info "Removing $app service"
yunohost service remove "gitlab-runsvdir"
fi
#================================================= #=================================================
# STOP GITLAB # STOP GITLAB
#================================================= #=================================================
@ -86,7 +96,7 @@ fi
ynh_secure_remove "/var/opt/$app" ynh_secure_remove "/var/opt/$app"
# Remove the log files # Remove the log files
ynh_secure_remove "/var/log/$app/" ynh_secure_remove "/var/log/$app"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -122,14 +122,21 @@ ynh_exec_warn_less gitlab-rake gitlab:backup:restore force=yes BACKUP=$last_back
gitlab-rake gitlab:check SANITIZE=true gitlab-rake gitlab:check SANITIZE=true
gitlab-ctl restart
ynh_print_info "Waiting for gitlab..."
gitlab_ctl_waiting --timeout=3600
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
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/unicorn/unicorn_stderr.log /var/log/$app/unicorn/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"
#=================================================
# WAITING GITLAB
#=================================================
ynh_print_info "Waiting for gitlab..."
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
#================================================= #=================================================

View file

@ -28,6 +28,7 @@ config_path=$(ynh_app_setting_get $app config_path)
port=$(ynh_app_setting_get "$app" web_port) port=$(ynh_app_setting_get "$app" web_port)
portUnicorn=$(ynh_app_setting_get "$app" unicorn_port) portUnicorn=$(ynh_app_setting_get "$app" unicorn_port)
architecture=$(ynh_app_setting_get "$app" architecture) architecture=$(ynh_app_setting_get "$app" architecture)
unicorn_worker_processes=$(ynh_app_setting_get "$app" unicorn_worker_processes)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
@ -54,6 +55,21 @@ if [ -z "$config_path" ]; then
ynh_app_setting_set $app config_path $config_path ynh_app_setting_set $app config_path $config_path
fi fi
if [ -z "$unicorn_worker_processes" ]; then
# https://docs.gitlab.com/ee/install/requirements.html#unicorn-workers
unicorn_worker_processes=$(($(nproc) + 1 ))
# If the server has at least 2GB of RAM
if [ $(free -g --si | grep Mem: | awk '{print $2}') -ge 2 ]; then
# Min 3 worker processes
unicorn_worker_processes=$(($unicorn_worker_processes>3?$unicorn_worker_processes:3))
else
# 2 worker processes
unicorn_worker_processes=2
fi
ynh_app_setting_set $app unicorn_worker_processes $unicorn_worker_processes
fi
# If architecture doesn't exist, create it # If architecture doesn't exist, create it
if [ -z "$architecture" ]; then if [ -z "$architecture" ]; then
# Detect the system architecture # Detect the system architecture
@ -151,6 +167,7 @@ cp -f ../conf/gitlab.rb "$config_path/gitlab.rb"
ynh_replace_string "__GENERATED_EXTERNAL_URL__" "https://$domain${path_url%/}" "$config_path/gitlab.rb" ynh_replace_string "__GENERATED_EXTERNAL_URL__" "https://$domain${path_url%/}" "$config_path/gitlab.rb"
ynh_replace_string "__PORT__" "$port" "$config_path/gitlab.rb" ynh_replace_string "__PORT__" "$port" "$config_path/gitlab.rb"
ynh_replace_string "__PORTUNICORN__" "$portUnicorn" "$config_path/gitlab.rb" ynh_replace_string "__PORTUNICORN__" "$portUnicorn" "$config_path/gitlab.rb"
ynh_replace_string "__UNICORN_WORKER_PROCESSES__" "$unicorn_worker_processes" "$config_path/gitlab.rb"
ynh_store_file_checksum "$config_path/gitlab.rb" ynh_store_file_checksum "$config_path/gitlab.rb"
@ -197,22 +214,29 @@ ynh_add_nginx_config
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
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/unicorn/unicorn_stderr.log /var/log/$app/unicorn/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 # SETUP SSOWAT
#================================================= #=================================================
# 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" unprotected_uris "/"
fi fi
#================================================= #=================================================
# RESTART GITLAB # WAITING GITLAB
#================================================= #=================================================
ynh_print_info "Waiting for gitlab..." ynh_print_info "Waiting for gitlab..."
gitlab_ctl_waiting --timeout=3600 # 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
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX

View file

@ -0,0 +1,7 @@
gitlab_version="11.9.0"
gitlab_x86_64_source_sha256="13dcff613c9f7a915117aec8d788e99ac4742e1ac7be0c7c6a87fc8de8f4275d"
gitlab_arm_source_sha256="2aec5d04f05cc3bb2fa22e52232e4e0841e58fb3f77052f776292db09e2fcf87"
gitlab_filename="gitlab-ce-${gitlab_version}.deb"

View file

@ -1,7 +1,7 @@
gitlab_version="11.9.0" gitlab_version="11.9.1"
gitlab_x86_64_source_sha256="13dcff613c9f7a915117aec8d788e99ac4742e1ac7be0c7c6a87fc8de8f4275d" gitlab_x86_64_source_sha256="9668345176be07f1f8637b3c72ffea6f8fe2e76a8c5b10b74a340b9b6b97788c"
gitlab_arm_source_sha256="2aec5d04f05cc3bb2fa22e52232e4e0841e58fb3f77052f776292db09e2fcf87" gitlab_arm_source_sha256="df1fb5be8ec089a77cfe8276cbaabe0e40b0f3368cafc07de984d7795252ee21"
gitlab_filename="gitlab-ce-${gitlab_version}.deb" gitlab_filename="gitlab-ce-${gitlab_version}.deb"