diff --git a/manifest.toml b/manifest.toml index e3d266b..bbac867 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,14 +5,15 @@ name = "Forgejo" description.en = "Lightweight software forge" description.fr = "Forge logiciel légère" -version = "1.18.5-0~ynh3" +version = "1.19.3-0~ynh1" maintainers = ["Emmanuel Averty"] [upstream] license = "MIT" website = "https://forgejo.org" -admindoc = "https://docs.gitea.io/" +admindoc = "https://forgejo.org/docs/latest/admin/" +userdoc = "https://forgejo.org/docs/latest/user/" code = "https://codeberg.org/forgejo/forgejo" [integration] @@ -20,10 +21,10 @@ yunohost = ">= 11.1.17" architectures = ["amd64", "arm64", "armhf"] multi_instance = true ldap = true -sso = false -disk = "50M" +sso = true +disk = "150M" ram.build = "50M" -ram.runtime = "50M" +ram.runtime = "2G" [install] [install.domain] @@ -43,23 +44,27 @@ ram.runtime = "50M" default = "visitors" [resources] - [resources.sources.main] - arm64.url = "https://codeberg.org/attachments/64d9189e-edb5-4d8e-9886-6d7b733fb146" - arm64.sha256 = "a463f0c160a3769d27a1b1e5cff8fbb75d0d04fd6fda481bcd9e083c8fd8d175" - amd64.url = "https://codeberg.org/attachments/415526b5-e483-45b6-9d46-a7078dcea461" - amd64.sha256 = "3157da621960c32b6284aa55e9d3c3c0d3e7ff534e832e712a2eb7d92952aab8" - armhf.url = "https://codeberg.org/attachments/14e7bdbb-a2e7-4065-885f-c5fd26d00940" - armhf.sha256 = "1eb64795db5fd2fc94a1d8ea640f20cdf43d2667512c6f96a665605666d17d38" - rename = "forgejo" + [resources.sources.main] + amd64.url = "https://codeberg.org/attachments/8dc303a9-8a4e-416c-8d6c-62e0d3e289e8" + amd64.sha256 = "84ad6db129c491c9e4b935cdb6ad7003a804d27fb70e9bc3c653d931cf62d92d" + arm64.url = "https://codeberg.org/attachments/dc0a8d51-e2f9-4395-a286-e5f6cbbc20bc" + arm64.sha256 = "e1514b0075223aef8d7992cef0b30cb9869171d4fbec4651693305ad724a530d" + armhf.url = "https://codeberg.org/attachments/b1643658-7394-45c8-9fad-9d286ec29c7d" + armhf.sha256 = "b8265436d3af7a46ffbf306917aacbe5ee00fd74dc1eee79f1d4b4cba97ec395" + format = "xz" + extract = false # will be extracted during install script + rename = "forgejo.xz" [resources.system_user] + allow_ssh = true [resources.ports] + main.default = 6000 [resources.install_dir] [resources.data_dir] - subdirs = ".ssh" + subdirs = ['.ssh'] [resources.permissions] main.url = "/" diff --git a/scripts/change_url b/scripts/change_url index 17cd4bb..b834b48 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -29,11 +29,8 @@ ynh_change_url_nginx_config # SPECIFIC MODIFICATIONS #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -#REMOVEME? -domain=$new_domain -path=$new_path -ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+") +ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+") ynh_exec_warn_less ynh_add_config --template="../conf/app.ini" --destination="$install_dir/custom/conf/app.ini" chmod 640 "$install_dir/custom/conf/app.ini" diff --git a/scripts/install b/scripts/install index 072b91d..9f34306 100644 --- a/scripts/install +++ b/scripts/install @@ -10,22 +10,19 @@ source ./_common.sh # IMPORT GENERIC HELPERS source /usr/share/yunohost/helpers - -# Create a system user -ynh_system_user_create --username=$app --home_dir=$data_dir --groups ssh.app --use_shell - #================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE +# Create install and data subdirs #================================================= -ynh_script_progression --message="Installing sources files..." --weight=10 - -ynh_setup_source --dest_dir=$install_dir +ynh_setup_source --dest_dir="$install_dir" +xz -d "$install_dir/forgejo.xz" +chmod +x "$install_dir/forgejo" mkdir -p "$install_dir/custom/conf" -chmod -R o-rwx "$install_dir" -chown -R $app:$app "$install_dir" -chmod +x "$install_dir/forgejo" +chmod -R o-rwx "$install_dir/custom" +chown -R $app:$app "$install_dir/custom" + +chmod 700 $data_dir/.ssh #================================================= # KEYS GENERATION @@ -38,13 +35,6 @@ ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key ynh_app_setting_set --app=$app --key=lfs_jwt_secret --value=$lfs_jwt_secret ynh_app_setting_set --app=$app --key=internal_token --value=$internal_token -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=2 - -ynh_add_nginx_config - #================================================= # ADD A CONFIGURATION #================================================= @@ -59,10 +49,17 @@ chown $app:$app "$install_dir/custom/conf/app.ini" #================================================= # SETUP SYSTEMD #================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 +ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 ynh_add_systemd_config +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 + +ynh_add_nginx_config + #================================================= # GENERIC FINALIZATION #================================================= @@ -70,24 +67,25 @@ ynh_add_systemd_config #================================================= ynh_script_progression --message="Configuring log rotation..." --weight=1 -# Configure logrotate -ynh_use_logrotate --logfile "/var/log/$app/forgejo.log" +# Use logrotate to manage application logfile(s) +ynh_use_logrotate --logfile "/var/log/$app" --nonappend -chown $app:$app /var/log/$app +chown -R $app:$app "/var/log/$app" chmod u=rwX,g=rX,o= "/var/log/$app" #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 +ynh_script_progression --message="Integrating service in YunoHost..." --weight=2 -yunohost service add "$app" --description="Forgejo" --log="/var/log/$app/forgejo.log" +yunohost service add $app --description="Forgejo" --log="/var/log/$app/forgejo.log" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=3 +# Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/forgejo.log" --line_match="Starting new Web server: tcp:127.0.0.1:" #================================================= diff --git a/scripts/remove b/scripts/remove index 42a7466..1f56823 100644 --- a/scripts/remove +++ b/scripts/remove @@ -23,57 +23,23 @@ then fi # Remove the dedicated systemd config +ynh_script_progression --message="Removing systemd configuration..." --weight=1 ynh_remove_systemd_config # Remove the app-specific logrotate config +ynh_script_progression --message="Removing logrotate configuration..." --weight=1 ynh_remove_logrotate -#================================================= -# REMOVE THE DATABASE -#================================================= -ynh_script_progression --message="Removing the database..." --weight=2 - -# Remove a database if it exists, along with the associated user -ynh_psql_remove_db --db_user=$db_user --db_name=$db_name - -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - -#================================================= -# REMOVE APP MAIN DIR -#================================================= -ynh_script_progression --message="Removing app main directory..." --weight=3 - -# Remove the app directory securely -ynh_secure_remove --file="$install_dir" - -#================================================= -# REMOVE DATA DIR -#================================================= - -# Remove the app data directory with the command `yunohost app remove forgejo --purge` -if [ "${YNH_APP_PURGE:-0}" -eq 1 ] -then - ynh_script_progression --message="Removing app data directory..." --weight=2 - ynh_secure_remove --file="$data_dir" -fi - -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - # Remove the dedicated NGINX config +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 ynh_remove_nginx_config # Remove the dedicated Fail2Ban config +ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=1 ynh_remove_fail2ban_config +# Remove logs +ynh_script_progression --message="Removing logs..." --weight=2 ynh_secure_remove --file="/var/log/$app" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index b39703f..c313e67 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,7 +21,6 @@ upgrade_type=$(ynh_check_app_version_changed) # STOP SYSTEMD SERVICE #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=2 - ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= @@ -54,6 +53,7 @@ fi ynh_script_progression --message="Setting up source files..." --weight=3 ynh_setup_source --dest_dir=$install_dir +xz -f -d "$install_dir/forgejo.xz" chmod -R o-rwx "$install_dir" chown -R $app:$app "$install_dir" @@ -107,7 +107,7 @@ yunohost service add $app --description="Forgejo" --log="/var/log/$app/forgejo.l #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression --message="Starting a systemd service..." --weight=3 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/forgejo.log" --line_match="Starting new Web server: tcp:127.0.0.1:"