From 7314135cba5080639951f55a57c2bc292c43daed Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 24 Jul 2022 13:45:53 +0200 Subject: [PATCH 1/6] Update install --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index fe5f017..24e3053 100644 --- a/scripts/install +++ b/scripts/install @@ -139,8 +139,8 @@ ynh_app_setting_set --app $app --key upstream_version --value $(ynh_app_upstream # Reload services ynh_script_progression --message="Starting gitea services..." --weight=3 -ynh_systemd_action -l "Starting new Web server: tcp:127.0.0.1:" -p "/var/log/$app/gitea.log" -t 10 -sleep 1 + +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/gitea.log" --line_match="Starting new Web server: tcp:127.0.0.1:" # Store the checksum with the 'INTERNAL_TOKEN' value. # Should be removed when the issue https://github.com/go-gitea/gitea/issues/3246 is fixed From eedb856722f1c3b016f545a4d84dec358c013f43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 24 Jul 2022 16:35:00 +0200 Subject: [PATCH 2/6] Fix service start --- scripts/upgrade | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 330bbcc..72d392f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -109,14 +109,13 @@ config_gitea ynh_script_progression --message="Updating systemd units..." ynh_add_systemd_config -# Modify Nginx configuration file and copy it to Nginx conf directory -ynh_script_progression --message="Configuring nginx..." --weight=1 +# Modify Nginx configuration file and copy it to NGINX conf directory +ynh_script_progression --message="Configuring NGINX..." --weight=1 config_nginx #================================================= # DB migration #================================================= - ynh_script_progression --message="Upgrading database and sources..." --weight=6 # Before the version 1.7 the upstream version was not stored @@ -133,7 +132,8 @@ fi restart_gitea() { # Set permissions set_permission - ynh_systemd_action -l "Starting new server: tcp:127.0.0.1:" -p "/var/log/$app/gitea.log" -t 30 + #ynh_systemd_action -l "Starting new server: tcp:127.0.0.1:" -p "/var/log/$app/gitea.log" -t 30 + ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/gitea.log" --line_match="Starting new Web server: tcp:127.0.0.1:" # Leave the time to update the database schema sleep 5 systemctl stop $app @@ -214,8 +214,8 @@ ynh_setup_source $final_path source/$architecture restart_gitea # SETUP FAIL2BAN -ynh_script_progression --message="Configuring fail2ban..." -ynh_add_fail2ban_config --logpath "/var/log/$app/gitea.log" --failregex ".*Failed authentication attempt for .* from " --max_retry 5 +ynh_script_progression --message="Configuring Fail2Ban..." +ynh_add_fail2ban_config --logpath="/var/log/$app/gitea.log" --failregex=".*Failed authentication attempt for .* from " --max_retry 5 #================================================= # GENERIC FINALIZATION @@ -225,15 +225,15 @@ ynh_add_fail2ban_config --logpath "/var/log/$app/gitea.log" --failregex ".*Faile ynh_script_progression --message="Update permission..." if ! ynh_permission_exists --permission admin; then ynh_app_setting_delete --app $app --key unprotected_uris - ynh_permission_create --permission 'admin' --allowed "$admin" + ynh_permission_create --permission="admin" --allowed="$admin" # Update ldap config - ynh_replace_string --match_string "__APP__" --replace_string "$app" --target_file ../conf/login_source.sql + ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../conf/login_source.sql" ynh_mysql_connect_as "$db_user" "$db_password" "$dbname" < ../conf/login_source.sql fi # Add gitea to YunoHost's monitored services -ynh_script_progression --message="Register gitea service..." -yunohost service add "$app" --log "/var/log/$app/gitea.log" +ynh_script_progression --message="Register Gitea service..." +yunohost service add "$app" --log="/var/log/$app/gitea.log" # Add ssh permission for gitea user adduser $app ssh.app @@ -243,23 +243,24 @@ ynh_script_progression --message="Protecting directory" set_permission # Save Version -ynh_app_setting_set --app $app --key upstream_version --value $(ynh_app_upstream_version) +ynh_app_setting_set --app=$app --key=upstream_version --value=$(ynh_app_upstream_version) # Reload services -ynh_script_progression --message="Starting gitea services..." --weight=3 -ynh_systemd_action -l "Starting new Web server: tcp:127.0.0.1:" -p "/var/log/$app/gitea.log" -t 10 -sleep 1 +ynh_script_progression --message="Starting Gitea services..." --weight=3 +#ynh_systemd_action -l "Starting new Web server: tcp:127.0.0.1:" -p "/var/log/$app/gitea.log" -t 10 +#sleep 1 +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/gitea.log" --line_match="Starting new Web server: tcp:127.0.0.1:" # Store the checksum with the 'INTERNAL_TOKEN' value. # Should be removed when the issue https://github.com/go-gitea/gitea/issues/3246 is fixed -ynh_store_file_checksum --file "$final_path/custom/conf/app.ini" +ynh_store_file_checksum --file="$final_path/custom/conf/app.ini" #================================================= # FINISH MIGRATION PROCESS #================================================= if [[ $migration_process -eq 1 ]]; then - echo "gogs has been successfully migrated to Gitea! \ + echo "Gogs has been successfully migrated to Gitea! \ A last scheduled operation will run in a couple of minutes to finish the \ migration in YunoHost side. Do not proceed any application operation while \ you don't see Gogs as installed." >&2 From e0056d1d01be7862ea4ae1becc4dcd3ef58cb4a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 24 Jul 2022 17:38:28 +0200 Subject: [PATCH 3/6] Fix linter --- scripts/install | 4 ++-- scripts/restore | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 24e3053..d748789 100644 --- a/scripts/install +++ b/scripts/install @@ -127,8 +127,8 @@ ynh_script_progression --message="Configuring permissions" ynh_permission_create --permission="admin" --allowed=$admin # Add gitea to YunoHost's monitored services -ynh_script_progression --message="Register gitea service..." -yunohost service add "$app" --log "/var/log/$app/gitea.log" +ynh_script_progression --message="Register Gitea service..." +yunohost service add "$app" --log="/var/log/$app/gitea.log" # Configure logrotate ynh_script_progression --message="Configuring log rotation..." diff --git a/scripts/restore b/scripts/restore index 7ecb82e..a7ae980 100644 --- a/scripts/restore +++ b/scripts/restore @@ -69,8 +69,8 @@ ynh_script_progression --message="Configuring log rotation..." ynh_use_logrotate --logfile "/var/log/$app" # Add gitea to YunoHost's monitored services -ynh_script_progression --message="Register gitea service..." -yunohost service add "$app" --log /var/log/"$app"/gitea.log +ynh_script_progression --message="Register Gitea service..." +yunohost service add "$app" --log=/var/log/$app/gitea.log # Reload services ynh_script_progression --message="Reloading services..." From eda162e41384c42e49279a6f703e8e5126557217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 24 Jul 2022 17:53:10 +0200 Subject: [PATCH 4/6] Remove warnings --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 72d392f..cdcec4e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -133,7 +133,7 @@ restart_gitea() { # Set permissions set_permission #ynh_systemd_action -l "Starting new server: tcp:127.0.0.1:" -p "/var/log/$app/gitea.log" -t 30 - ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/gitea.log" --line_match="Starting new Web server: tcp:127.0.0.1:" + ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/gitea.log" --line_match="Serving 127.0.0.1:" # Leave the time to update the database schema sleep 5 systemctl stop $app From 7d28e30e05c935ebdfad14db78b6e88f64367858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 24 Jul 2022 17:54:31 +0200 Subject: [PATCH 5/6] Check upgrade from previous version --- check_process | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/check_process b/check_process index 7206f2b..ada8464 100644 --- a/check_process +++ b/check_process @@ -1,9 +1,9 @@ ;; General ; Manifest - domain="domain.tld" (DOMAIN) - path="/path" (PATH) - admin="john" (USER) - is_public=1 (PUBLIC|public=1|private=0) + domain="domain.tld" + path="/path" + admin="john" + is_public=1 ; Checks pkg_linter=1 setup_sub_dir=1 @@ -12,6 +12,8 @@ setup_private=1 setup_public=1 upgrade=1 + #1.14.5 + upgrade=1 from_commit=7ea357724f2371aa1173f15ba5a7502609a0a131 upgrade=1 from_commit=349992d4f3921e4e1adb37a0cace4a5a9eb67099 upgrade=1 from_commit=4e078e91129725c8b09ba551ab2a04e0328a45b3 backup_restore=1 @@ -20,6 +22,8 @@ port_already_use=1 (6000) change_url=1 ;;; Upgrade options + ; commit=7ea357724f2371aa1173f15ba5a7502609a0a131 + name=1.14.5 ; commit=349992d4f3921e4e1adb37a0cace4a5a9eb67099 name=First package version ; commit=4e078e91129725c8b09ba551ab2a04e0328a45b3 From cc293f70cdc1c0cb5e8529881a2c4e1a0f1aac93 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 24 Jul 2022 20:41:48 +0200 Subject: [PATCH 6/6] Update upgrade --- scripts/upgrade | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index cdcec4e..2e62897 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -49,7 +49,7 @@ fi [[ $YNH_APP_ID == "gogs" ]] \ && [[ "$(cat "/opt/$app/templates/.VERSION")" != 0.11.79.1211 ]] \ - && ynh_die --message "It look like that you have an old gogs install. You need first upgrade gogs instance (id : $gogs_migrate_id) and after migrate to gitea." + && ynh_die --message "It look like that you have an old Gogs install. You need first upgrade Gogs instance (id: $gogs_migrate_id) and after migrate to Gitea." ynh_handle_app_migration --migration_id=gogs --migration_list=gogs_migrations if [[ $migration_process -eq 1 ]]; then @@ -132,8 +132,7 @@ fi restart_gitea() { # Set permissions set_permission - #ynh_systemd_action -l "Starting new server: tcp:127.0.0.1:" -p "/var/log/$app/gitea.log" -t 30 - ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/gitea.log" --line_match="Serving 127.0.0.1:" + ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/gitea.log" --line_match="Starting new Web server: tcp:127.0.0.1:" # Leave the time to update the database schema sleep 5 systemctl stop $app