From d1bb42cad72d699e02e99831a5f9a04e0a04294a Mon Sep 17 00:00:00 2001 From: kay0u Date: Sun, 18 Aug 2019 16:07:18 +0200 Subject: [PATCH 01/13] Backup strategy --- config_panel.json | 101 ++++++++++++++++++++++++++++++++++++++++++++-- scripts/backup | 46 ++++++++++++++++++++- scripts/config | 66 ++++++++++++++++++++++++++++++ scripts/install | 29 +++++++++++++ scripts/upgrade | 50 +++++++++++++++++++++++ 5 files changed, 288 insertions(+), 4 deletions(-) diff --git a/config_panel.json b/config_panel.json index 4b7ccf8..d2d2442 100644 --- a/config_panel.json +++ b/config_panel.json @@ -11,7 +11,10 @@ "id": "is_public", "options": [ { - "name": "Is it a public app ?", + "name": "Public app", + "ask": { + "en": "Is it a public app ?" + }, "id": "is_public", "type": "bool", "default": true @@ -23,7 +26,10 @@ "id": "overwrite_files", "options": [ { - "name": "Overwrite the nginx config file ?", + "name": "Overwrite the nginx config file", + "ask": { + "en": "Overwrite the nginx config file ?" + }, "help": "If the file is overwritten, a backup will be created.", "id": "overwrite_nginx", "type": "bool", @@ -36,13 +42,102 @@ "id": "users", "options": [ { - "name": "Authorized external user creation ?", + "name": "Authorized external user creation", + "ask": { + "en": "Authorized external user creation ?" + }, "help": "Allow user to be created without yunohost account.", "id": "use_web_account", "type": "bool", "default": true } ] + }, + { + "name": "Backup strategy", + "id": "backup_strategy", + "options": [ + { + "name": "Backup db", + "ask": { + "en": "Should gitlab backup the database ?" + }, + "help": "https://docs.gitlab.com/ce/raketasks/backup_restore.html#excluding-specific-directories-from-the-backup", + "id": "backup_db", + "type": "bool", + "default": true + }, + { + "name": "Backup uploads", + "ask": { + "en": "Should gitlab backup attachments ?" + }, + "help": "https://docs.gitlab.com/ce/raketasks/backup_restore.html#excluding-specific-directories-from-the-backup", + "id": "backup_uploads", + "type": "bool", + "default": true + }, + { + "name": "Backup repositories", + "ask": { + "en": "Should gitlab backup git repositories data ?" + }, + "help": "https://docs.gitlab.com/ce/raketasks/backup_restore.html#excluding-specific-directories-from-the-backup", + "id": "backup_repositories", + "type": "bool", + "default": true + }, + { + "name": "Backup builds", + "ask": { + "en": "Should gitlab backup CI job output logs ?" + }, + "help": "https://docs.gitlab.com/ce/raketasks/backup_restore.html#excluding-specific-directories-from-the-backup", + "id": "backup_builds", + "type": "bool", + "default": true + }, + { + "name": "Backup artifacts", + "ask": { + "en": "Should gitlab backup CI job artifacts ?" + }, + "help": "https://docs.gitlab.com/ce/raketasks/backup_restore.html#excluding-specific-directories-from-the-backup", + "id": "backup_artifacts", + "type": "bool", + "default": true + }, + { + "name": "Backup lfs", + "ask": { + "en": "Should gitlab backup LFS objects ?" + }, + "help": "https://docs.gitlab.com/ce/raketasks/backup_restore.html#excluding-specific-directories-from-the-backup", + "id": "backup_lfs", + "type": "bool", + "default": true + }, + { + "name": "Backup registry", + "ask": { + "en": "Should gitlab backup container registry images ?" + }, + "help": "https://docs.gitlab.com/ce/raketasks/backup_restore.html#excluding-specific-directories-from-the-backup", + "id": "backup_registry", + "type": "bool", + "default": true + }, + { + "name": "Backup pages", + "ask": { + "en": "Should gitlab backup pages content ?" + }, + "help": "https://docs.gitlab.com/ce/raketasks/backup_restore.html#excluding-specific-directories-from-the-backup", + "id": "backup_pages", + "type": "bool", + "default": true + } + ] } ] } diff --git a/scripts/backup b/scripts/backup index e25ab0b..66ae3fd 100644 --- a/scripts/backup +++ b/scripts/backup @@ -32,6 +32,15 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) config_path=$(ynh_app_setting_get --app=$app --key=config_path) domain=$(ynh_app_setting_get --app=$app --key=domain) +backup_db=$(ynh_app_setting_get --app="$app" --key=backup_db) +backup_uploads=$(ynh_app_setting_get --app="$app" --key=backup_uploads) +backup_repositories=$(ynh_app_setting_get --app="$app" --key=backup_repositories) +backup_builds=$(ynh_app_setting_get --app="$app" --key=backup_builds) +backup_artifacts=$(ynh_app_setting_get --app="$app" --key=backup_artifacts) +backup_lfs=$(ynh_app_setting_get --app="$app" --key=backup_lfs) +backup_registry=$(ynh_app_setting_get --app="$app" --key=backup_registry) +backup_pages=$(ynh_app_setting_get --app="$app" --key=backup_pages) + #================================================= # STANDARD BACKUP STEPS #================================================= @@ -46,10 +55,45 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_script_progression --message="Backuping of Gitlab..." --weight=9 +to_skip="" + +if [ $backup_db -eq 1 ]; then + to_skip="db,"$to_skip +fi + +if [ $backup_uploads -eq 1 ]; then + to_skip="uploads,"$to_skip +fi + +if [ $backup_repositories -eq 1 ]; then + to_skip="repositories,"$to_skip +fi + +if [ $backup_builds -eq 1 ]; then + to_skip="builds,"$to_skip +fi + +if [ $backup_artifacts -eq 1 ]; then + to_skip="artifacts,"$to_skip +fi + +if [ $backup_lfs -eq 1 ]; then + to_skip="lfs,"$to_skip +fi + +if [ $backup_registry -eq 1 ]; then + to_skip="registry,"$to_skip +fi + +if [ $backup_pages -eq 1 ]; then + to_skip="pages,"$to_skip +fi + # Use gitlab-rake to backup # For the complete doc: https://docs.gitlab.com/ce/raketasks/backup_restore.html # For the filename: https://docs.gitlab.com/ce/raketasks/backup_restore.html#backup-filename -gitlab-rake gitlab:backup:create BACKUP=last +# For the backup strategy: https://docs.gitlab.com/ce/raketasks/backup_restore.html#excluding-specific-directories-from-the-backup +gitlab-rake gitlab:backup:create BACKUP=last SKIP=$to_skip ynh_backup --src_path="/var/opt/$app/backups/last_gitlab_backup.tar" diff --git a/scripts/config b/scripts/config index f66658d..800d7d8 100644 --- a/scripts/config +++ b/scripts/config @@ -40,6 +40,39 @@ 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) use_web_account="${YNH_CONFIG_MAIN_USERS_USE_WEB_ACCOUNT:-$old_use_web_account}" +# backup_strategy +old_backup_db="$(ynh_app_setting_get --app=$app --key=backup_db)" +old_backup_db=$(bool_to_true_false $old_backup_db) +backup_db="${YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_DB:-$old_backup_db}" + +old_backup_uploads="$(ynh_app_setting_get --app=$app --key=backup_uploads)" +old_backup_uploads=$(bool_to_true_false $old_backup_uploads) +backup_uploads="${YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_UPLOADS:-$old_backup_uploads}" + +old_backup_repositories="$(ynh_app_setting_get --app=$app --key=backup_repositories)" +old_backup_repositories=$(bool_to_true_false $old_backup_repositories) +backup_repositories="${YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_REPOSITORIES:-$old_backup_repositories}" + +old_backup_builds="$(ynh_app_setting_get --app=$app --key=backup_builds)" +old_backup_builds=$(bool_to_true_false $old_backup_builds) +backup_builds="${YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_BUILDS:-$old_backup_builds}" + +old_backup_artifacts="$(ynh_app_setting_get --app=$app --key=backup_artifacts)" +old_backup_artifacts=$(bool_to_true_false $old_backup_artifacts) +backup_artifacts="${YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_ARTIFACTS:-$old_backup_artifacts}" + +old_backup_lfs="$(ynh_app_setting_get --app=$app --key=backup_lfs)" +old_backup_lfs=$(bool_to_true_false $old_backup_lfs) +backup_lfs="${YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_LFS:-$old_backup_lfs}" + +old_backup_registry="$(ynh_app_setting_get --app=$app --key=backup_registry)" +old_backup_registry=$(bool_to_true_false $old_backup_registry) +backup_registry="${YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_REGISTRY:-$old_backup_registry}" + +old_backup_pages="$(ynh_app_setting_get --app=$app --key=backup_pages)" +old_backup_pages=$(bool_to_true_false $old_backup_pages) +backup_pages="${YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_PAGES:-$old_backup_pages}" + #================================================= # SHOW_CONFIG FUNCTION FOR 'SHOW' COMMAND #================================================= @@ -53,6 +86,22 @@ show_config() { echo "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX=$overwrite_nginx" echo "YNH_CONFIG_MAIN_USERS_USE_WEB_ACCOUNT=$use_web_account" + + echo "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_DB=$backup_db" + + echo "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_UPLOADS=$backup_uploads" + + echo "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_REPOSITORIES=$backup_repositories" + + echo "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_BUILDS=$backup_builds" + + echo "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_ARTIFACTS=$backup_artifacts" + + echo "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_LFS=$backup_lfs" + + echo "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_REGISTRY=$backup_registry" + + echo "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_PAGES=$backup_pages" } #================================================= @@ -78,6 +127,23 @@ apply_config() { # Set overwrite_nginx ynh_app_setting_set --app=$app --key=overwrite_nginx --value="$overwrite_nginx" + + # Set backup_db + ynh_app_setting_set --app=$app --key=backup_db --value="$(bool_to_01 $backup_db)" + # Set backup_uploads + ynh_app_setting_set --app=$app --key=backup_uploads --value="$(bool_to_01 $backup_uploads)" + # Set backup_repositories + ynh_app_setting_set --app=$app --key=backup_repositories --value="$(bool_to_01 $backup_repositories)" + # Set backup_builds + ynh_app_setting_set --app=$app --key=backup_builds --value="$(bool_to_01 $backup_builds)" + # Set backup_artifacts + ynh_app_setting_set --app=$app --key=backup_artifacts --value="$(bool_to_01 $backup_artifacts)" + # Set backup_lfs + ynh_app_setting_set --app=$app --key=backup_lfs --value="$(bool_to_01 $backup_lfs)" + # Set backup_registry + ynh_app_setting_set --app=$app --key=backup_registry --value="$(bool_to_01 $backup_registry)" + # Set backup_pages + ynh_app_setting_set --app=$app --key=backup_pages --value="$(bool_to_01 $backup_pages)" } #================================================= diff --git a/scripts/install b/scripts/install index 99402e0..4c9aa9e 100644 --- a/scripts/install +++ b/scripts/install @@ -216,6 +216,35 @@ newuser.confirmation_token = nil newuser.save ApplicationSetting.last.update_attributes(password_authentication_enabled_for_web: $use_web_account, signup_enabled: $use_web_account)" | gitlab-rails console + +#================================================= +# DEFINE THE BACKUP STRATEGY: https://docs.gitlab.com/ce/raketasks/backup_restore.html#excluding-specific-directories-from-the-backup +#================================================= + +backup_db=1 +ynh_app_setting_set --app=$app --key=backup_db --value=$backup_db + +backup_uploads=1 +ynh_app_setting_set --app=$app --key=backup_uploads --value=$backup_uploads + +backup_repositories=1 +ynh_app_setting_set --app=$app --key=backup_repositories --value=$backup_repositories + +backup_builds=1 +ynh_app_setting_set --app=$app --key=backup_builds --value=$backup_builds + +backup_artifacts=1 +ynh_app_setting_set --app=$app --key=backup_artifacts --value=$backup_artifacts + +backup_lfs=1 +ynh_app_setting_set --app=$app --key=backup_lfs --value=$backup_lfs + +backup_registry=1 +ynh_app_setting_set --app=$app --key=backup_registry --value=$backup_registry + +backup_pages=1 +ynh_app_setting_set --app=$app --key=backup_pages --value=$backup_pages + #================================================= # RECONFIGURE TO TAKE INTO ACCOUNT CHANGES #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 6b0baed..26decfa 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -33,6 +33,15 @@ unicorn_worker_processes=$(ynh_app_setting_get --app="$app" --key=unicorn_worker 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) +backup_db=$(ynh_app_setting_get --app="$app" --key=backup_db) +backup_uploads=$(ynh_app_setting_get --app="$app" --key=backup_uploads) +backup_repositories=$(ynh_app_setting_get --app="$app" --key=backup_repositories) +backup_builds=$(ynh_app_setting_get --app="$app" --key=backup_builds) +backup_artifacts=$(ynh_app_setting_get --app="$app" --key=backup_artifacts) +backup_lfs=$(ynh_app_setting_get --app="$app" --key=backup_lfs) +backup_registry=$(ynh_app_setting_get --app="$app" --key=backup_registry) +backup_pages=$(ynh_app_setting_get --app="$app" --key=backup_pages) + #================================================= # CHECK VERSION #================================================= @@ -146,6 +155,47 @@ if [ -e "/etc/apt/sources.list.d/gitlab-ce.list" ]; then ynh_secure_remove --file="/etc/apt/sources.list.d/gitlab-ce.list" fi +# Define the backup strategy: https://docs.gitlab.com/ce/raketasks/backup_restore.html#excluding-specific-directories-from-the-backup +if [ -z "$backup_db" ]; then + backup_db=1 + ynh_app_setting_set --app=$app --key=backup_db --value=$backup_db +fi + +if [ -z "$backup_uploads" ]; then + backup_uploads=1 + ynh_app_setting_set --app=$app --key=backup_uploads --value=$backup_uploads +fi + +if [ -z "$backup_repositories" ]; then + backup_repositories=1 + ynh_app_setting_set --app=$app --key=backup_repositories --value=$backup_repositories +fi + +if [ -z "$backup_builds" ]; then + backup_builds=1 + ynh_app_setting_set --app=$app --key=backup_builds --value=$backup_builds +fi + +if [ -z "$backup_artifacts" ]; then + backup_artifacts=1 + ynh_app_setting_set --app=$app --key=backup_artifacts --value=$backup_artifacts +fi + +if [ -z "$backup_lfs" ]; then + backup_lfs=1 + ynh_app_setting_set --app=$app --key=backup_lfs --value=$backup_lfs +fi + +if [ -z "$backup_registry" ]; then + backup_registry=1 + ynh_app_setting_set --app=$app --key=backup_registry --value=$backup_registry +fi + +if [ -z "$backup_pages" ]; then + backup_pages=1 + ynh_app_setting_set --app=$app --key=backup_pages --value=$backup_pages +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= From ef937d372b25c93687ab1e9d7ab23588944e1d63 Mon Sep 17 00:00:00 2001 From: kay0u Date: Sun, 18 Aug 2019 19:52:02 +0200 Subject: [PATCH 02/13] Fix config panel --- config_panel.json | 55 +++++++++++++++++++---------------------------- manifest.json | 2 +- scripts/config | 22 +++++++++---------- 3 files changed, 34 insertions(+), 45 deletions(-) diff --git a/config_panel.json b/config_panel.json index d2d2442..b07912f 100644 --- a/config_panel.json +++ b/config_panel.json @@ -11,12 +11,11 @@ "id": "is_public", "options": [ { - "name": "Public app", + "name": "is_public", "ask": { "en": "Is it a public app ?" }, - "id": "is_public", - "type": "bool", + "type": "boolean", "default": true } ] @@ -26,13 +25,12 @@ "id": "overwrite_files", "options": [ { - "name": "Overwrite the nginx config file", + "name": "overwrite_nginx", "ask": { "en": "Overwrite the nginx config file ?" }, "help": "If the file is overwritten, a backup will be created.", - "id": "overwrite_nginx", - "type": "bool", + "type": "boolean", "default": true } ] @@ -42,13 +40,12 @@ "id": "users", "options": [ { - "name": "Authorized external user creation", + "name": "use_web_account", "ask": { "en": "Authorized external user creation ?" }, "help": "Allow user to be created without yunohost account.", - "id": "use_web_account", - "type": "bool", + "type": "boolean", "default": true } ] @@ -58,83 +55,75 @@ "id": "backup_strategy", "options": [ { - "name": "Backup db", + "name": "backup_db", "ask": { "en": "Should gitlab backup the database ?" }, "help": "https://docs.gitlab.com/ce/raketasks/backup_restore.html#excluding-specific-directories-from-the-backup", - "id": "backup_db", - "type": "bool", + "type": "boolean", "default": true }, { - "name": "Backup uploads", + "name": "backup_uploads", "ask": { "en": "Should gitlab backup attachments ?" }, "help": "https://docs.gitlab.com/ce/raketasks/backup_restore.html#excluding-specific-directories-from-the-backup", - "id": "backup_uploads", - "type": "bool", + "type": "boolean", "default": true }, { - "name": "Backup repositories", + "name": "backup_repositories", "ask": { "en": "Should gitlab backup git repositories data ?" }, "help": "https://docs.gitlab.com/ce/raketasks/backup_restore.html#excluding-specific-directories-from-the-backup", - "id": "backup_repositories", - "type": "bool", + "type": "boolean", "default": true }, { - "name": "Backup builds", + "name": "backup_builds", "ask": { "en": "Should gitlab backup CI job output logs ?" }, "help": "https://docs.gitlab.com/ce/raketasks/backup_restore.html#excluding-specific-directories-from-the-backup", - "id": "backup_builds", - "type": "bool", + "type": "boolean", "default": true }, { - "name": "Backup artifacts", + "name": "backup_artifacts", "ask": { "en": "Should gitlab backup CI job artifacts ?" }, "help": "https://docs.gitlab.com/ce/raketasks/backup_restore.html#excluding-specific-directories-from-the-backup", - "id": "backup_artifacts", - "type": "bool", + "type": "boolean", "default": true }, { - "name": "Backup lfs", + "name": "backup_lfs", "ask": { "en": "Should gitlab backup LFS objects ?" }, "help": "https://docs.gitlab.com/ce/raketasks/backup_restore.html#excluding-specific-directories-from-the-backup", - "id": "backup_lfs", - "type": "bool", + "type": "boolean", "default": true }, { - "name": "Backup registry", + "name": "backup_registry", "ask": { "en": "Should gitlab backup container registry images ?" }, "help": "https://docs.gitlab.com/ce/raketasks/backup_restore.html#excluding-specific-directories-from-the-backup", - "id": "backup_registry", - "type": "bool", + "type": "boolean", "default": true }, { - "name": "Backup pages", + "name": "backup_pages", "ask": { "en": "Should gitlab backup pages content ?" }, "help": "https://docs.gitlab.com/ce/raketasks/backup_restore.html#excluding-specific-directories-from-the-backup", - "id": "backup_pages", - "type": "bool", + "type": "boolean", "default": true } ] diff --git a/manifest.json b/manifest.json index d9daf42..936b4fd 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "pierre@kayou.io" }, "requirements": { - "yunohost": ">= 3.5.0" + "yunohost": ">= 3.6.0" }, "multi_instance": false, "services": [ diff --git a/scripts/config b/scripts/config index 800d7d8..508a153 100644 --- a/scripts/config +++ b/scripts/config @@ -81,27 +81,27 @@ show_config() { # here you are supposed to read some config file/database/other then print the values # echo "YNH_CONFIG_${PANEL_ID}_${SECTION_ID}_${OPTION_ID}=value" - echo "YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC=$is_public" + ynh_return "YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC=$is_public" - echo "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX=$overwrite_nginx" + ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX=$overwrite_nginx" - echo "YNH_CONFIG_MAIN_USERS_USE_WEB_ACCOUNT=$use_web_account" + ynh_return "YNH_CONFIG_MAIN_USERS_USE_WEB_ACCOUNT=$use_web_account" - echo "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_DB=$backup_db" + ynh_return "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_DB=$backup_db" - echo "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_UPLOADS=$backup_uploads" + ynh_return "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_UPLOADS=$backup_uploads" - echo "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_REPOSITORIES=$backup_repositories" + ynh_return "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_REPOSITORIES=$backup_repositories" - echo "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_BUILDS=$backup_builds" + ynh_return "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_BUILDS=$backup_builds" - echo "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_ARTIFACTS=$backup_artifacts" + ynh_return "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_ARTIFACTS=$backup_artifacts" - echo "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_LFS=$backup_lfs" + ynh_return "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_LFS=$backup_lfs" - echo "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_REGISTRY=$backup_registry" + ynh_return "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_REGISTRY=$backup_registry" - echo "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_PAGES=$backup_pages" + ynh_return "YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_PAGES=$backup_pages" } #================================================= From d7a0032438482ebc0d30fff7e10adb6d883037a4 Mon Sep 17 00:00:00 2001 From: kay0u Date: Sun, 18 Aug 2019 19:54:06 +0200 Subject: [PATCH 03/13] SKIP if bool eq 0 --- scripts/backup | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/backup b/scripts/backup index 66ae3fd..c20f755 100644 --- a/scripts/backup +++ b/scripts/backup @@ -57,35 +57,35 @@ ynh_script_progression --message="Backuping of Gitlab..." --weight=9 to_skip="" -if [ $backup_db -eq 1 ]; then +if [ $backup_db -eq 0 ]; then to_skip="db,"$to_skip fi -if [ $backup_uploads -eq 1 ]; then +if [ $backup_uploads -eq 0 ]; then to_skip="uploads,"$to_skip fi -if [ $backup_repositories -eq 1 ]; then +if [ $backup_repositories -eq 0 ]; then to_skip="repositories,"$to_skip fi -if [ $backup_builds -eq 1 ]; then +if [ $backup_builds -eq 0 ]; then to_skip="builds,"$to_skip fi -if [ $backup_artifacts -eq 1 ]; then +if [ $backup_artifacts -eq 0 ]; then to_skip="artifacts,"$to_skip fi -if [ $backup_lfs -eq 1 ]; then +if [ $backup_lfs -eq 0 ]; then to_skip="lfs,"$to_skip fi -if [ $backup_registry -eq 1 ]; then +if [ $backup_registry -eq 0 ]; then to_skip="registry,"$to_skip fi -if [ $backup_pages -eq 1 ]; then +if [ $backup_pages -eq 0 ]; then to_skip="pages,"$to_skip fi From 686afe32acaa224e9383547cffa7cba0f7da71ad Mon Sep 17 00:00:00 2001 From: kay0u Date: Sun, 18 Aug 2019 20:27:59 +0200 Subject: [PATCH 04/13] use 1 or 0 not true or false --- scripts/_common.sh | 18 ------------------ scripts/config | 41 ++++++++++------------------------------- 2 files changed, 10 insertions(+), 49 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 1caa856..3bf74f9 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,24 +6,6 @@ pkg_dependencies="openssh-server" -#================================================= -# BOOLEAN CONVERTER -#================================================= - -bool_to_01 () { - local var="$1" - [ "$var" = "true" ] && var=1 - [ "$var" = "false" ] && var=0 - echo "$var" -} - -bool_to_true_false () { - local var="$1" - [ "$var" = "1" ] && var=true - [ "$var" = "0" ] && var=false - echo "$var" -} - #================================================= # EXPERIMENTAL HELPERS #================================================= diff --git a/scripts/config b/scripts/config index 508a153..efaa386 100644 --- a/scripts/config +++ b/scripts/config @@ -27,50 +27,39 @@ app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID} # is_public old_is_public="$(ynh_app_setting_get --app=$app --key=is_public)" -old_is_public=$(bool_to_true_false $old_is_public) is_public="${YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC:-$old_is_public}" # Overwrite nginx configuration old_overwrite_nginx="$(ynh_app_setting_get --app=$app --key=overwrite_nginx)" -old_overwrite_nginx=$(bool_to_true_false $old_overwrite_nginx) overwrite_nginx="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX:-$old_overwrite_nginx}" # 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) use_web_account="${YNH_CONFIG_MAIN_USERS_USE_WEB_ACCOUNT:-$old_use_web_account}" # backup_strategy old_backup_db="$(ynh_app_setting_get --app=$app --key=backup_db)" -old_backup_db=$(bool_to_true_false $old_backup_db) backup_db="${YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_DB:-$old_backup_db}" old_backup_uploads="$(ynh_app_setting_get --app=$app --key=backup_uploads)" -old_backup_uploads=$(bool_to_true_false $old_backup_uploads) backup_uploads="${YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_UPLOADS:-$old_backup_uploads}" old_backup_repositories="$(ynh_app_setting_get --app=$app --key=backup_repositories)" -old_backup_repositories=$(bool_to_true_false $old_backup_repositories) backup_repositories="${YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_REPOSITORIES:-$old_backup_repositories}" old_backup_builds="$(ynh_app_setting_get --app=$app --key=backup_builds)" -old_backup_builds=$(bool_to_true_false $old_backup_builds) backup_builds="${YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_BUILDS:-$old_backup_builds}" old_backup_artifacts="$(ynh_app_setting_get --app=$app --key=backup_artifacts)" -old_backup_artifacts=$(bool_to_true_false $old_backup_artifacts) backup_artifacts="${YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_ARTIFACTS:-$old_backup_artifacts}" old_backup_lfs="$(ynh_app_setting_get --app=$app --key=backup_lfs)" -old_backup_lfs=$(bool_to_true_false $old_backup_lfs) backup_lfs="${YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_LFS:-$old_backup_lfs}" old_backup_registry="$(ynh_app_setting_get --app=$app --key=backup_registry)" -old_backup_registry=$(bool_to_true_false $old_backup_registry) backup_registry="${YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_REGISTRY:-$old_backup_registry}" old_backup_pages="$(ynh_app_setting_get --app=$app --key=backup_pages)" -old_backup_pages=$(bool_to_true_false $old_backup_pages) backup_pages="${YNH_CONFIG_MAIN_BACKUP_STRATEGY_BACKUP_PAGES:-$old_backup_pages}" #================================================= @@ -110,40 +99,30 @@ show_config() { apply_config() { # Change public accessibility - if [ "$is_public" = "true" ] - then - yunohost app action run $app public_private --args is_public=1 - else - yunohost app action run $app public_private --args is_public=0 - fi + yunohost app action run $app public_private --args is_public=$is_public # Change use_web_account - if [ "$use_web_account" = "true" ] - then - yunohost app action run $app web_account --args use_web_account=1 - else - yunohost app action run $app web_account --args use_web_account=0 - fi + yunohost app action run $app web_account --args use_web_account=$use_web_account # Set overwrite_nginx ynh_app_setting_set --app=$app --key=overwrite_nginx --value="$overwrite_nginx" # Set backup_db - ynh_app_setting_set --app=$app --key=backup_db --value="$(bool_to_01 $backup_db)" + ynh_app_setting_set --app=$app --key=backup_db --value="$backup_db" # Set backup_uploads - ynh_app_setting_set --app=$app --key=backup_uploads --value="$(bool_to_01 $backup_uploads)" + ynh_app_setting_set --app=$app --key=backup_uploads --value="$backup_uploads" # Set backup_repositories - ynh_app_setting_set --app=$app --key=backup_repositories --value="$(bool_to_01 $backup_repositories)" + ynh_app_setting_set --app=$app --key=backup_repositories --value="$backup_repositories" # Set backup_builds - ynh_app_setting_set --app=$app --key=backup_builds --value="$(bool_to_01 $backup_builds)" + ynh_app_setting_set --app=$app --key=backup_builds --value="$backup_builds" # Set backup_artifacts - ynh_app_setting_set --app=$app --key=backup_artifacts --value="$(bool_to_01 $backup_artifacts)" + ynh_app_setting_set --app=$app --key=backup_artifacts --value="$backup_artifacts" # Set backup_lfs - ynh_app_setting_set --app=$app --key=backup_lfs --value="$(bool_to_01 $backup_lfs)" + ynh_app_setting_set --app=$app --key=backup_lfs --value="$backup_lfs" # Set backup_registry - ynh_app_setting_set --app=$app --key=backup_registry --value="$(bool_to_01 $backup_registry)" + ynh_app_setting_set --app=$app --key=backup_registry --value="$backup_registry" # Set backup_pages - ynh_app_setting_set --app=$app --key=backup_pages --value="$(bool_to_01 $backup_pages)" + ynh_app_setting_set --app=$app --key=backup_pages --value="$backup_pages" } #================================================= From 8348a929b442a57c0151fab1b2e06d0b276633c4 Mon Sep 17 00:00:00 2001 From: kay0u Date: Fri, 23 Aug 2019 21:44:38 +0200 Subject: [PATCH 05/13] Upgrade to 12.2.0 --- README.md | 2 +- conf/gitlab.rb | 71 +++++++++++++++++++++++++------ manifest.json | 2 +- scripts/backup | 2 +- scripts/install | 6 +-- scripts/restore | 7 ++- scripts/upgrade | 4 +- scripts/upgrade.d/upgrade.last.sh | 6 +-- 8 files changed, 75 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 5a7fd5f..548098e 100644 --- a/README.md +++ b/README.md @@ -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. -**Shipped version:** 12.1.6 +**Shipped version:** 12.2.0 ## Screenshots diff --git a/conf/gitlab.rb b/conf/gitlab.rb index a45339c..3d28a80 100644 --- a/conf/gitlab.rb +++ b/conf/gitlab.rb @@ -109,7 +109,7 @@ external_url '__GENERATED_EXTERNAL_URL__' ###! https://docs.gitlab.com/ce/ci/yaml/README.html#artifacts:expire_in # gitlab_rails['stuck_ci_jobs_worker_cron'] = "0 0 * * *" # gitlab_rails['expire_build_artifacts_worker_cron'] = "50 * * * *" -# gitlab_rails['pipeline_schedule_worker_cron'] = "41 * * * *" +# gitlab_rails['pipeline_schedule_worker_cron'] = "19 * * * *" # gitlab_rails['ci_archive_traces_cron_worker_cron'] = "17 * * * *" # gitlab_rails['repository_check_worker_cron'] = "20 * * * *" # gitlab_rails['admin_email_worker_cron'] = "0 0 * * 0" @@ -131,6 +131,34 @@ external_url '__GENERATED_EXTERNAL_URL__' ###! will appear signed in from that address.** # gitlab_rails['trusted_proxies'] = [] +### Content Security Policy +####! Customize if you want to enable the Content-Security-Policy header, which +####! can help thwart JavaScript cross-site scripting (XSS) attacks. +####! See: https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP +# gitlab_rails['content_security_policy'] = { +# 'enabled' => false, +# 'report_only' => false, +# # Each directive is a String (e.g. "'self'"). +# 'directives' => { +# 'base_uri' => nil, +# 'child_src' => nil, +# 'connect_src' => nil, +# 'default_src' => nil, +# 'font_src' => nil, +# 'form_action' => nil, +# 'frame_ancestors' => nil, +# 'frame_src' => nil, +# 'img_src' => nil, +# 'manifest_src' => nil, +# 'media_src' => nil, +# 'object_src' => nil, +# 'script_src' => nil, +# 'style_src' => nil, +# 'worker_src' => nil, +# 'report_uri' => nil, +# } +# } + ### Monitoring settings ###! IP whitelist controlling access to monitoring endpoints # gitlab_rails['monitoring_whitelist'] = ['127.0.0.0/8', '::1/128'] @@ -438,7 +466,7 @@ gitlab_rails['gitlab_shell_ssh_port'] = __SSH_PORT__ #### Set path to an initial license to be used while bootstrapping GitLab. ####! **Only applicable on initial setup, future license updations need to be done via UI. ####! Updating the file specified in this path won't yield any change after the first reconfigure run. -# gitlab_rails['iniitial_license_file'] = '/etc/gitlab/company.gitlab-license' +# gitlab_rails['initial_license_file'] = '/etc/gitlab/company.gitlab-license' #### Enable or disable automatic database migrations # gitlab_rails['auto_migrate'] = true @@ -527,7 +555,7 @@ gitlab_rails['gitlab_shell_ssh_port'] = __SSH_PORT__ ##! Docs: https://docs.gitlab.com/ce/administration/container_registry.html ################################################################################ -# registry_external_url 'https://registry.gitlab.example.com' +# registry_external_url 'https://registry.example.com' ### Settings used by GitLab application # gitlab_rails['registry_enabled'] = true @@ -570,6 +598,7 @@ gitlab_rails['gitlab_shell_ssh_port'] = __SSH_PORT__ # 's3' => { # 'accesskey' => 'AKIAKIAKI', # 'secretkey' => 'secret123', +# 'region' => 'us-east-1', # 'bucket' => 'gitlab-registry-bucket-AKIAKIAKI' # } # } @@ -894,6 +923,9 @@ sidekiq['listen_port'] = __SIDEKIQ_PORT__ # See https://www.postgresql.org/docs/9.6/static/auth-pg-hba-conf.html for an explanation # of the values +### Version settings +# Set this if you have disabled the bundled PostgreSQL but still want to use the backup rake tasks +# postgresql['version'] = 10 ################################################################################ ## GitLab Redis @@ -918,6 +950,16 @@ sidekiq['listen_port'] = __SIDEKIQ_PORT__ # redis['uid'] = nil # redis['gid'] = nil +### Disable or obfuscate unnecessary redis command names +### Uncomment and edit this block to add or remove entries. +### See https://docs.gitlab.com/omnibus/settings/redis.html#renamed-commands +### for detailed usage +### +# redis['rename_commands'] = { +# 'KEYS': '' +#} +# + ###! **To enable only Redis service in this machine, uncomment ###! one of the lines below (choose master or slave instance types).** ###! Docs: https://docs.gitlab.com/omnibus/settings/redis.html @@ -1003,12 +1045,12 @@ nginx['client_max_body_size'] = '__CLIENT_MAX_BODY_SIZE__' # nginx['ssl_certificate'] = "/etc/gitlab/ssl/#{node['fqdn']}.crt" # nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/#{node['fqdn']}.key" -# nginx['ssl_ciphers'] = "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256" +# nginx['ssl_ciphers'] = "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256" # nginx['ssl_prefer_server_ciphers'] = "on" ##! **Recommended by: https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html ##! https://cipherli.st/** -# nginx['ssl_protocols'] = "TLSv1.2" +# nginx['ssl_protocols'] = "TLSv1.2 TLSv1.3" ##! **Recommended in: https://nginx.org/en/docs/http/ngx_http_ssl_module.html** # nginx['ssl_session_cache'] = "builtin:1000 shared:SSL:10m" @@ -1266,6 +1308,9 @@ nginx['listen_https'] = false # gitlab_pages['gitlab_server'] = nil # Defaults to external_url # gitlab_pages['auth_secret'] = nil # Generated if not present +##! Define custom gitlab-pages HTTP headers for the whole instance +# gitlab_pages['headers'] = [] + ################################################################################ ## GitLab Pages NGINX ################################################################################ @@ -1440,9 +1485,9 @@ nginx['listen_https'] = false ### Custom Prometheus flags # # prometheus['flags'] = { -# 'storage.tsdb.path' => "#{node['gitlab']['prometheus']['home']}/data", +# 'storage.tsdb.path' => "/var/opt/gitlab/prometheus/data", # 'storage.tsdb.retention.time' => "15d", -# 'config.file' => "#{node['gitlab']['prometheus']['home']}/prometheus.yml" +# 'config.file' => "/var/opt/gitlab/prometheus/prometheus.yml" # } ##! Advanced settings. Should be changed only if absolutely needed. @@ -1457,9 +1502,9 @@ nginx['listen_https'] = false # alertmanager['log_directory'] = '/var/log/gitlab/alertmanager' # alertmanager['admin_email'] = 'admin@example.com' # alertmanager['flags'] = { -# 'web.listen-address' => "#{node['gitlab']['alertmanager']['listen_address']}" -# 'storage.path' => "#{node['gitlab']['alertmanager']['home']}/data" -# 'config.file' => "#{node['gitlab']['alertmanager']['home']}/alertmanager.yml" +# 'web.listen-address' => "localhost:9093" +# 'storage.path' => "/var/opt/gitlab/alertmanager/data" +# 'config.file' => "/var/opt/gitlab/alertmanager/alertmanager.yml" # } # alertmanager['env_directory'] = '/opt/gitlab/etc/alertmanager/env' # alertmanager['env'] = { @@ -1478,7 +1523,7 @@ nginx['listen_https'] = false # node_exporter['home'] = '/var/opt/gitlab/node-exporter' # node_exporter['log_directory'] = '/var/log/gitlab/node-exporter' # node_exporter['flags'] = { -# 'collector.textfile.directory' => "#{node['gitlab']['node-exporter']['home']}/textfile_collector" +# 'collector.textfile.directory' => "/var/opt/gitlab/node-exporter/textfile_collector" # } # node_exporter['env_directory'] = '/opt/gitlab/etc/node-exporter/env' # node_exporter['env'] = { @@ -1496,7 +1541,7 @@ nginx['listen_https'] = false # redis_exporter['enable'] = true # redis_exporter['log_directory'] = '/var/log/gitlab/redis-exporter' # redis_exporter['flags'] = { -# 'redis.addr' => "unix://#{node['gitlab']['gitlab-rails']['redis_socket']}", +# 'redis.addr' => "unix:///var/opt/gitlab/redis/redis.socket", # } # redis_exporter['env_directory'] = '/opt/gitlab/etc/redis-exporter/env' # redis_exporter['env'] = { @@ -1565,6 +1610,8 @@ grafana['enable'] = false # grafana['home'] = '/var/opt/gitlab/grafana' # grafana['admin_password'] = 'admin' # grafana['allow_user_sign_up'] = false +# grafana['basic_auth_enabled'] = false +# grafana['disable_login_form'] = true # grafana['gitlab_application_id'] = 'GITLAB_APPLICATION_ID' # grafana['gitlab_secret'] = 'GITLAB_SECRET' # grafana['env_directory'] = '/opt/gitlab/etc/grafana/env' diff --git a/manifest.json b/manifest.json index d9daf42..4b60bc6 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name": "Gitlab", "id": "gitlab", "packaging_format": 1, - "version": "12.1.6~ynh1", + "version": "12.2.0~ynh1", "description": { "en": "GitLab is a Git-repository manager.", "fr": "GitLab est un gestionnaire de dépôts Git." diff --git a/scripts/backup b/scripts/backup index e25ab0b..895d95e 100644 --- a/scripts/backup +++ b/scripts/backup @@ -49,7 +49,7 @@ ynh_script_progression --message="Backuping of Gitlab..." --weight=9 # Use gitlab-rake to backup # For the complete doc: https://docs.gitlab.com/ce/raketasks/backup_restore.html # For the filename: https://docs.gitlab.com/ce/raketasks/backup_restore.html#backup-filename -gitlab-rake gitlab:backup:create BACKUP=last +gitlab-backup create BACKUP=last ynh_backup --src_path="/var/opt/$app/backups/last_gitlab_backup.tar" diff --git a/scripts/install b/scripts/install index 99402e0..d6d9c68 100644 --- a/scripts/install +++ b/scripts/install @@ -54,8 +54,8 @@ else your hardware and the result of the command \"uname -m\"." 1 fi -# https://docs.gitlab.com/ee/install/requirements.html#unicorn-workers -unicorn_worker_processes=$(($(nproc) + 1 )) +# https://docs.gitlab.com/ce/install/requirements.html#unicorn-workers +unicorn_worker_processes=$(python -c "print(int($(nproc) * 1.5 + 1))") # If the server has at least 2GB of RAM if [ $(ynh_check_ram --no_swap) -ge 2000 ]; then @@ -120,7 +120,7 @@ total_memory=$(ynh_check_ram) total_swap=$(ynh_check_ram --only_swap) swap_needed=0 -# https://docs.gitlab.com/ee/install/requirements.html#memory +# https://docs.gitlab.com/ce/install/requirements.html#memory if [ $total_memory -lt 8192 ]; then # Need a minimum of 8Go of memory swap_needed=$((8192 - $total_memory)) diff --git a/scripts/restore b/scripts/restore index 1aed979..be424b5 100644 --- a/scripts/restore +++ b/scripts/restore @@ -71,7 +71,7 @@ total_memory=$(ynh_check_ram) total_swap=$(ynh_check_ram --only_swap) swap_needed=0 -# https://docs.gitlab.com/ee/install/requirements.html#memory +# https://docs.gitlab.com/ce/install/requirements.html#memory if [ $total_memory -lt 8192 ]; then # Need a minimum of 8Go of memory swap_needed=$((8192 - $total_memory)) @@ -141,7 +141,10 @@ gitlab-ctl stop sidekiq # Use gitlab-rake to backup # Doc: https://docs.gitlab.com/ce/raketasks/backup_restore.html#restore-for-omnibus-gitlab-installations -ynh_exec_warn_less gitlab-rake gitlab:backup:restore force=yes BACKUP=$last_backup +ynh_exec_warn_less gitlab-backup restore force=yes BACKUP=$last_backup + +# https://docs.gitlab.com/ce/raketasks/backup_restore.html#container-registry-push-failures-after-restoring-from-a-backup +chown -R registry:registry /var/opt/gitlab/gitlab-rails/shared/registry/docker #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 6b0baed..13b05ea 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -65,7 +65,7 @@ if [ -z "$config_path" ]; then fi if [ -z "$unicorn_worker_processes" ]; then - # https://docs.gitlab.com/ee/install/requirements.html#unicorn-workers + # https://docs.gitlab.com/ce/install/requirements.html#unicorn-workers unicorn_worker_processes=$(($(nproc) + 1 )) # If the server has at least 2GB of RAM @@ -188,7 +188,7 @@ total_memory=$(ynh_check_ram) total_swap=$(ynh_check_ram --only_swap) swap_needed=0 -# https://docs.gitlab.com/ee/install/requirements.html#memory +# https://docs.gitlab.com/ce/install/requirements.html#memory if [ $total_memory -lt 8192 ]; then # Need a minimum of 8Go of memory swap_needed=$((8192 - $total_memory)) diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index c0ea22f..b549b79 100644 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,8 +1,8 @@ -gitlab_version="12.1.6" +gitlab_version="12.2.0" -gitlab_x86_64_source_sha256="af4251dd4d0c5ff42f69e6ac09d4767e8be41314b63993a5959790ac78657c91" +gitlab_x86_64_source_sha256="c483581545891e65eafcc15b6cf2f620b8f5df34e4e26fb12da984556196ebeb" -gitlab_arm_source_sha256="adfa0120282fcc84e9dca85196dcc28dc2763d072581857fc592ef35ab3821ab" +gitlab_arm_source_sha256="231d115b3c0a459b9ee3cc47f432755cfacf2925190c996a59923c061eddf6cb" gitlab_filename="gitlab-ce-${gitlab_version}.deb" From 4aebe8355f436ceb114d26c49e55be05f55dbaf8 Mon Sep 17 00:00:00 2001 From: kay0u Date: Sat, 24 Aug 2019 19:10:05 +0200 Subject: [PATCH 06/13] 12.2.1 --- README.md | 2 +- conf/gitlab.rb | 5 +++++ manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 6 +++--- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 548098e..9daedf1 100644 --- a/README.md +++ b/README.md @@ -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. -**Shipped version:** 12.2.0 +**Shipped version:** 12.2.1 ## Screenshots diff --git a/conf/gitlab.rb b/conf/gitlab.rb index 3d28a80..39e88c0 100644 --- a/conf/gitlab.rb +++ b/conf/gitlab.rb @@ -71,6 +71,9 @@ external_url '__GENERATED_EXTERNAL_URL__' # gitlab_rails['gitlab_email_display_name'] = 'Example' # gitlab_rails['gitlab_email_reply_to'] = 'noreply@example.com' # gitlab_rails['gitlab_email_subject_suffix'] = '' +# gitlab_rails['gitlab_email_smime_enabled'] = false +# gitlab_rails['gitlab_email_smime_key_file'] = '/etc/gitlab/ssl/gitlab_smime.key' +# gitlab_rails['gitlab_email_smime_cert_file'] = '/etc/gitlab/ssl/gitlab_smime.crt' ### GitLab user privileges # gitlab_rails['gitlab_default_can_create_group'] = true @@ -491,6 +494,8 @@ gitlab_rails['gitlab_shell_ssh_port'] = __SSH_PORT__ # gitlab_rails['db_sslmode'] = nil # gitlab_rails['db_sslcompression'] = 0 # gitlab_rails['db_sslrootcert'] = nil +# gitlab_rails['db_sslcert'] = nil +# gitlab_rails['db_sslkey'] = nil # gitlab_rails['db_prepared_statements'] = false # gitlab_rails['db_statements_limit'] = 1000 diff --git a/manifest.json b/manifest.json index 4b60bc6..f0bee36 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name": "Gitlab", "id": "gitlab", "packaging_format": 1, - "version": "12.2.0~ynh1", + "version": "12.2.1~ynh1", "description": { "en": "GitLab is a Git-repository manager.", "fr": "GitLab est un gestionnaire de dépôts Git." diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index b549b79..67b81ed 100644 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,8 +1,8 @@ -gitlab_version="12.2.0" +gitlab_version="12.2.1" -gitlab_x86_64_source_sha256="c483581545891e65eafcc15b6cf2f620b8f5df34e4e26fb12da984556196ebeb" +gitlab_x86_64_source_sha256="102040c54d112738cddadff9f661f0e010e2bf5172c6f6d8f635ed2f8b9de6f7" -gitlab_arm_source_sha256="231d115b3c0a459b9ee3cc47f432755cfacf2925190c996a59923c061eddf6cb" +gitlab_arm_source_sha256="8418907a9a2a67b703c334d8d83e941c296f68d79e358b49107d52e92909f3df" gitlab_filename="gitlab-ce-${gitlab_version}.deb" From a4af36c402cbeb3cac2424a049fccc56edf77a9a Mon Sep 17 00:00:00 2001 From: Kayou Date: Tue, 27 Aug 2019 00:10:39 +0200 Subject: [PATCH 07/13] Fix restore --- scripts/restore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index be424b5..ddd8ec1 100644 --- a/scripts/restore +++ b/scripts/restore @@ -144,7 +144,9 @@ gitlab-ctl stop sidekiq ynh_exec_warn_less gitlab-backup restore force=yes BACKUP=$last_backup # https://docs.gitlab.com/ce/raketasks/backup_restore.html#container-registry-push-failures-after-restoring-from-a-backup -chown -R registry:registry /var/opt/gitlab/gitlab-rails/shared/registry/docker +if ynh_user_exists --username="registry" && [ -d "/var/opt/gitlab/gitlab-rails/shared/registry/docker" ]; then + chown -R registry:registry /var/opt/gitlab/gitlab-rails/shared/registry/docker +fi #================================================= # GENERIC FINALIZATION From 9470bfd368bd90f862272a73765d6df2bce3bd82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Bourr=C3=A9?= Date: Sun, 1 Sep 2019 03:29:22 +0200 Subject: [PATCH 08/13] 12.2.3 --- README.md | 2 +- conf/gitlab.rb | 5 ----- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 6 +++--- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 9daedf1..bdce8f1 100644 --- a/README.md +++ b/README.md @@ -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. -**Shipped version:** 12.2.1 +**Shipped version:** 12.2.3 ## Screenshots diff --git a/conf/gitlab.rb b/conf/gitlab.rb index 39e88c0..3d28a80 100644 --- a/conf/gitlab.rb +++ b/conf/gitlab.rb @@ -71,9 +71,6 @@ external_url '__GENERATED_EXTERNAL_URL__' # gitlab_rails['gitlab_email_display_name'] = 'Example' # gitlab_rails['gitlab_email_reply_to'] = 'noreply@example.com' # gitlab_rails['gitlab_email_subject_suffix'] = '' -# gitlab_rails['gitlab_email_smime_enabled'] = false -# gitlab_rails['gitlab_email_smime_key_file'] = '/etc/gitlab/ssl/gitlab_smime.key' -# gitlab_rails['gitlab_email_smime_cert_file'] = '/etc/gitlab/ssl/gitlab_smime.crt' ### GitLab user privileges # gitlab_rails['gitlab_default_can_create_group'] = true @@ -494,8 +491,6 @@ gitlab_rails['gitlab_shell_ssh_port'] = __SSH_PORT__ # gitlab_rails['db_sslmode'] = nil # gitlab_rails['db_sslcompression'] = 0 # gitlab_rails['db_sslrootcert'] = nil -# gitlab_rails['db_sslcert'] = nil -# gitlab_rails['db_sslkey'] = nil # gitlab_rails['db_prepared_statements'] = false # gitlab_rails['db_statements_limit'] = 1000 diff --git a/manifest.json b/manifest.json index f0bee36..b95e52e 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name": "Gitlab", "id": "gitlab", "packaging_format": 1, - "version": "12.2.1~ynh1", + "version": "12.2.3~ynh1", "description": { "en": "GitLab is a Git-repository manager.", "fr": "GitLab est un gestionnaire de dépôts Git." diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 67b81ed..101291c 100644 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,8 +1,8 @@ -gitlab_version="12.2.1" +gitlab_version="12.2.3" -gitlab_x86_64_source_sha256="102040c54d112738cddadff9f661f0e010e2bf5172c6f6d8f635ed2f8b9de6f7" +gitlab_x86_64_source_sha256="c7cb22bf7aee5bba4b9ebc2f04add53b68092bca18130a2ab3697a8583687770" -gitlab_arm_source_sha256="8418907a9a2a67b703c334d8d83e941c296f68d79e358b49107d52e92909f3df" +gitlab_arm_source_sha256="2be45cc1bb8a9f785c1ce8469bc11996be323c474b1d0d812b37e75a44bdd4dd" gitlab_filename="gitlab-ce-${gitlab_version}.deb" From fd6af9b07a556ff55f1cb7fe8ffab2394d32423a Mon Sep 17 00:00:00 2001 From: Kay0u Date: Sun, 1 Sep 2019 12:57:53 +0200 Subject: [PATCH 09/13] Change unicorn_worker_processes --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index d6d9c68..f9a132e 100644 --- a/scripts/install +++ b/scripts/install @@ -55,7 +55,7 @@ else fi # https://docs.gitlab.com/ce/install/requirements.html#unicorn-workers -unicorn_worker_processes=$(python -c "print(int($(nproc) * 1.5 + 1))") +unicorn_worker_processes=$(bc <<< "($(nproc) * 1.5 + 1) / 1") # If the server has at least 2GB of RAM if [ $(ynh_check_ram --no_swap) -ge 2000 ]; then diff --git a/scripts/upgrade b/scripts/upgrade index 13b05ea..a366096 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -66,7 +66,7 @@ fi if [ -z "$unicorn_worker_processes" ]; then # https://docs.gitlab.com/ce/install/requirements.html#unicorn-workers - unicorn_worker_processes=$(($(nproc) + 1 )) + unicorn_worker_processes=$(bc <<< "($(nproc) * 1.5 + 1) / 1") # If the server has at least 2GB of RAM if [ $(free -g --si | grep Mem: | awk '{print $2}') -ge 2 ]; then From 54bc6144eef8111d9e317f4a8fce432f2dad8b0b Mon Sep 17 00:00:00 2001 From: kay0u Date: Mon, 2 Sep 2019 12:07:19 +0200 Subject: [PATCH 10/13] Remove unused variable --- scripts/install | 31 ++++++++----------------------- scripts/upgrade | 24 ++++++++---------------- 2 files changed, 16 insertions(+), 39 deletions(-) diff --git a/scripts/install b/scripts/install index 4c9aa9e..36813ba 100644 --- a/scripts/install +++ b/scripts/install @@ -221,29 +221,14 @@ ApplicationSetting.last.update_attributes(password_authentication_enabled_for_we # DEFINE THE BACKUP STRATEGY: https://docs.gitlab.com/ce/raketasks/backup_restore.html#excluding-specific-directories-from-the-backup #================================================= -backup_db=1 -ynh_app_setting_set --app=$app --key=backup_db --value=$backup_db - -backup_uploads=1 -ynh_app_setting_set --app=$app --key=backup_uploads --value=$backup_uploads - -backup_repositories=1 -ynh_app_setting_set --app=$app --key=backup_repositories --value=$backup_repositories - -backup_builds=1 -ynh_app_setting_set --app=$app --key=backup_builds --value=$backup_builds - -backup_artifacts=1 -ynh_app_setting_set --app=$app --key=backup_artifacts --value=$backup_artifacts - -backup_lfs=1 -ynh_app_setting_set --app=$app --key=backup_lfs --value=$backup_lfs - -backup_registry=1 -ynh_app_setting_set --app=$app --key=backup_registry --value=$backup_registry - -backup_pages=1 -ynh_app_setting_set --app=$app --key=backup_pages --value=$backup_pages +ynh_app_setting_set --app=$app --key=backup_db --value=1 +ynh_app_setting_set --app=$app --key=backup_uploads --value=1 +ynh_app_setting_set --app=$app --key=backup_repositories --value=1 +ynh_app_setting_set --app=$app --key=backup_builds --value=1 +ynh_app_setting_set --app=$app --key=backup_artifacts --value=1 +ynh_app_setting_set --app=$app --key=backup_lfs --value=1 +ynh_app_setting_set --app=$app --key=backup_registry --value=1 +ynh_app_setting_set --app=$app --key=backup_pages --value=1 #================================================= # RECONFIGURE TO TAKE INTO ACCOUNT CHANGES diff --git a/scripts/upgrade b/scripts/upgrade index 26decfa..187c1d9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -157,43 +157,35 @@ fi # Define the backup strategy: https://docs.gitlab.com/ce/raketasks/backup_restore.html#excluding-specific-directories-from-the-backup if [ -z "$backup_db" ]; then - backup_db=1 - ynh_app_setting_set --app=$app --key=backup_db --value=$backup_db + ynh_app_setting_set --app=$app --key=backup_db --value=1 fi if [ -z "$backup_uploads" ]; then - backup_uploads=1 - ynh_app_setting_set --app=$app --key=backup_uploads --value=$backup_uploads + ynh_app_setting_set --app=$app --key=backup_uploads --value=1 fi if [ -z "$backup_repositories" ]; then - backup_repositories=1 - ynh_app_setting_set --app=$app --key=backup_repositories --value=$backup_repositories + ynh_app_setting_set --app=$app --key=backup_repositories --value=1 fi if [ -z "$backup_builds" ]; then - backup_builds=1 - ynh_app_setting_set --app=$app --key=backup_builds --value=$backup_builds + ynh_app_setting_set --app=$app --key=backup_builds --value=1 fi if [ -z "$backup_artifacts" ]; then - backup_artifacts=1 - ynh_app_setting_set --app=$app --key=backup_artifacts --value=$backup_artifacts + ynh_app_setting_set --app=$app --key=backup_artifacts --value=1 fi if [ -z "$backup_lfs" ]; then - backup_lfs=1 - ynh_app_setting_set --app=$app --key=backup_lfs --value=$backup_lfs + ynh_app_setting_set --app=$app --key=backup_lfs --value=1 fi if [ -z "$backup_registry" ]; then - backup_registry=1 - ynh_app_setting_set --app=$app --key=backup_registry --value=$backup_registry + ynh_app_setting_set --app=$app --key=backup_registry --value=1 fi if [ -z "$backup_pages" ]; then - backup_pages=1 - ynh_app_setting_set --app=$app --key=backup_pages --value=$backup_pages + ynh_app_setting_set --app=$app --key=backup_pages --value=1 fi #================================================= From 7430635b48f10910e3444108f41a448ac98cd10d Mon Sep 17 00:00:00 2001 From: kay0u Date: Mon, 2 Sep 2019 12:37:31 +0200 Subject: [PATCH 11/13] Add a warning message --- config_panel.json | 1 + 1 file changed, 1 insertion(+) diff --git a/config_panel.json b/config_panel.json index b07912f..965a554 100644 --- a/config_panel.json +++ b/config_panel.json @@ -53,6 +53,7 @@ { "name": "Backup strategy", "id": "backup_strategy", + "help": "WARNING: If you disable one of these backup, it will not be restored in case of error, use this feature at your own risk", "options": [ { "name": "backup_db", From 44ed195e56b358960c8229f38f11ee352b3ea3e3 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Tue, 3 Sep 2019 20:46:46 +0200 Subject: [PATCH 12/13] 12.2.4 --- README.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index bdce8f1..bb73de2 100644 --- a/README.md +++ b/README.md @@ -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. -**Shipped version:** 12.2.3 +**Shipped version:** 12.2.4 ## Screenshots diff --git a/manifest.json b/manifest.json index 2d40e75..df1ac62 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name": "Gitlab", "id": "gitlab", "packaging_format": 1, - "version": "12.2.3~ynh1", + "version": "12.2.4~ynh1", "description": { "en": "GitLab is a Git-repository manager.", "fr": "GitLab est un gestionnaire de dépôts Git." diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 101291c..4d5635b 100644 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,8 +1,8 @@ -gitlab_version="12.2.3" +gitlab_version="12.2.4" -gitlab_x86_64_source_sha256="c7cb22bf7aee5bba4b9ebc2f04add53b68092bca18130a2ab3697a8583687770" +gitlab_x86_64_source_sha256="1b0f1c3629d31e5ff2d2b096428d5ded46d91f9708d66d9e99c785d15bf07095" -gitlab_arm_source_sha256="2be45cc1bb8a9f785c1ce8469bc11996be323c474b1d0d812b37e75a44bdd4dd" +gitlab_arm_source_sha256="8090b16c59ccc7762b1c9737b58667fc3625a223dcd6b5c5855ae88291aa7601" gitlab_filename="gitlab-ce-${gitlab_version}.deb" From f4ba8097c48e8107cfc824d4498ac8af3a9ef3fc Mon Sep 17 00:00:00 2001 From: Kay0u Date: Tue, 3 Sep 2019 21:18:42 +0200 Subject: [PATCH 13/13] Add bc as dependency --- scripts/_common.sh | 2 +- scripts/install | 31 ++++++++++++++++++------------- scripts/upgrade | 2 +- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 3bf74f9..a7ba0f4 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,7 @@ # SET ALL CONSTANTS #================================================= -pkg_dependencies="openssh-server" +pkg_dependencies="openssh-server bc" #================================================= # EXPERIMENTAL HELPERS diff --git a/scripts/install b/scripts/install index ee26355..52657de 100644 --- a/scripts/install +++ b/scripts/install @@ -54,18 +54,6 @@ else your hardware and the result of the command \"uname -m\"." 1 fi -# https://docs.gitlab.com/ce/install/requirements.html#unicorn-workers -unicorn_worker_processes=$(bc <<< "($(nproc) * 1.5 + 1) / 1") - -# If the server has at least 2GB of RAM -if [ $(ynh_check_ram --no_swap) -ge 2000 ]; 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 - # Could be an option? client_max_body_size="250m" @@ -84,7 +72,6 @@ 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=unicorn_worker_processes --value=$unicorn_worker_processes 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" @@ -112,6 +99,24 @@ ynh_script_progression --message="Installing dependencies..." --weight=5 ynh_install_app_dependencies $pkg_dependencies +#================================================= +# DEFINE THE NUMBER OF WORKERS USED +#================================================= + +# https://docs.gitlab.com/ce/install/requirements.html#unicorn-workers +unicorn_worker_processes=$(bc <<< "($(nproc) * 1.5 + 1) / 1") + +# If the server has at least 2GB of RAM +if [ $(ynh_check_ram --no_swap) -ge 2000 ]; 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=$app --key=unicorn_worker_processes --value=$unicorn_worker_processes + #================================================= # ADD SWAP IF NEEDED #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 5128c9d..8568bba 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -75,7 +75,7 @@ fi if [ -z "$unicorn_worker_processes" ]; then # https://docs.gitlab.com/ce/install/requirements.html#unicorn-workers - unicorn_worker_processes=$(bc <<< "($(nproc) * 1.5 + 1) / 1") + 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