From c56aff9ea1283daedae22459edaf193ea2cea65e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 20 Aug 2023 15:36:10 +0200 Subject: [PATCH 01/53] v2 --- conf/cron | 2 +- conf/nginx.conf | 2 +- conf/php-fpm.conf | 2 +- manifest.toml | 58 ++++++++++++++++++++++++++ scripts/_common.sh | 4 +- scripts/backup | 18 ++++---- scripts/change_url | 62 ++++++++++++++-------------- scripts/install | 82 ++++++++++++++++++------------------- scripts/remove | 28 ++++++------- scripts/restore | 50 +++++++++++------------ scripts/upgrade | 100 ++++++++++++++++++++++----------------------- 11 files changed, 234 insertions(+), 174 deletions(-) create mode 100644 manifest.toml diff --git a/conf/cron b/conf/cron index 223dfbf..5a2ddf2 100644 --- a/conf/cron +++ b/conf/cron @@ -1,2 +1,2 @@ # Run poller periodically to update Friendica -*/10 * * * * __APP__ /usr/bin/php__PHPVERSION__ -f __FINALPATH__/bin/worker.php +*/10 * * * * __APP__ /usr/bin/php__PHPVERSION__ -f __INSTALL_DIR__/bin/worker.php diff --git a/conf/nginx.conf b/conf/nginx.conf index 013c29d..5e6ae82 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,7 +1,7 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - alias __FINALPATH__/; + alias __INSTALL_DIR__/; if (!-e $request_filename) { rewrite ^(.*)$ /index.php?pagename=$1; diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index ab1a471..13a53b0 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -358,7 +358,7 @@ request_terminate_timeout = 1d ; Chdir to this directory at the start. ; Note: relative path can be used. ; Default Value: current directory or / when chroot -chdir = __FINALPATH__ +chdir = __INSTALL_DIR__ ; Redirect worker stdout and stderr into main error log. If not set, stdout and ; stderr will be redirected to /dev/null according to FastCGI specs. diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..be1b617 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,58 @@ +packaging_format = 2 + +id = "friendica" +name = "Friendica" +description.en = "Social Communication Server" +description.fr = "Serveur de Communication Social" + +version = "2023.09~ynh1" + +maintainers = ["Anmol Sharma"] + +[upstream] +license = "AGPL-3.0-only" +website = "http://friendi.ca" +demo = "https://dir.friendica.social/servers" +admindoc = "https://github.com/friendica/friendica/wiki" +userdoc = "https://wiki.friendi.ca/" +code = "https://github.com/friendica/friendica" +cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) +fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. + +[integration] +yunohost = ">= 11.2" +architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +multi_instance = true +ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. +sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. +disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... +ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... + +[install] + [install.domain] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "domain" + full_domain = true + + [install.admin] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "user" + + [install.language] + ask.en = "Choose the application language" + ask.fr = "Choisissez la langue de l'application" + type = "string" + choices = ["de", "en", "es", "fr", "it", "pt"] + default = "en" + +[resources] + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] + main.url = "/" + + [resources.database] + type = "mysql" diff --git a/scripts/_common.sh b/scripts/_common.sh index a163a04..e9dbd30 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -10,9 +10,9 @@ version_commit="2dbfb070083ec395bf5d24ec89fe96b282c6a12d" addons_version_commit="f2cc0312ca9a95d99a8330452848180792bf9227" # dependencies used by the app -YNH_PHP_VERSION="7.4" +#REMOVEME? YNH_PHP_VERSION="7.4" -pkg_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-gmp" +#REMOVEME? pkg_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-gmp" #================================================= # EXPERIMENTAL HELPERS diff --git a/scripts/backup b/scripts/backup index 0eba6fa..6a642fd 100644 --- a/scripts/backup +++ b/scripts/backup @@ -14,24 +14,24 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +#REMOVEME? ynh_print_info --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -domain=$(ynh_app_setting_get --app=$app --key=domain) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -42,7 +42,7 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/change_url b/scripts/change_url index 7d347e3..2a4d00b 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -13,53 +13,53 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS #================================================= -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH +#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN +#REMOVEME? old_path=$YNH_APP_OLD_PATH -new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH +#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN +#REMOVEME? new_path=$YNH_APP_NEW_PATH -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -# Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#REMOVEME? # Needed for helper "ynh_add_nginx_config" +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) #================================================= # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 +#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. - ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" # Restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= -change_domain=0 -if [ "$old_domain" != "$new_domain" ] +#REMOVEME? change_domain=0 +#REMOVEME? if [ "$old_domain" != "$new_domain" ] then - change_domain=1 + #REMOVEME? change_domain=1 fi -change_path=0 -if [ "$old_path" != "$new_path" ] +#REMOVEME? change_path=0 +#REMOVEME? if [ "$old_path" != "$new_path" ] then - change_path=1 + #REMOVEME? change_path=1 fi #================================================= @@ -67,36 +67,38 @@ fi #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=3 -nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf +ynh_change_url_nginx_config + +#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf # Change the path in the NGINX config file if [ $change_path -eq 1 ] then # Make a backup of the original NGINX config file if modified - ynh_backup_if_checksum_is_different --file="$nginx_conf_path" +#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" # Set global variables for NGINX helper - domain="$old_domain" - path_url="$new_path" +#REMOVEME? domain="$old_domain" +#REMOVEME? path="$new_path" # Create a dedicated NGINX config - ynh_add_nginx_config +#REMOVEME? ynh_add_nginx_config fi # Change the domain for NGINX if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location - ynh_delete_file_checksum --file="$nginx_conf_path" - mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf +#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" +#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf # Store file checksum for the new config file location - ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 0afa4cd..f21481b 100644 --- a/scripts/install +++ b/scripts/install @@ -13,100 +13,100 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -domain=$YNH_APP_ARG_DOMAIN -path_url='/' -admin=$YNH_APP_ARG_ADMIN +#REMOVEME? domain=$YNH_APP_ARG_DOMAIN +path='/' +#REMOVEME? admin=$YNH_APP_ARG_ADMIN email=$(ynh_user_get_info --username=$admin --key=mail) -language=$YNH_APP_ARG_LANGUAGE +#REMOVEME? language=$YNH_APP_ARG_LANGUAGE timezone=$(cat /etc/timezone) -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 +#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 -final_path=/var/www/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" +#REMOVEME? install_dir=/var/www/$app +#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" # Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=1 -ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=admin --value=$admin +#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain +#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path +#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=email --value=$email ynh_app_setting_set --app=$app --key=language --value=$language #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=6 +#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=6 -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # CREATE A MYSQL DATABASE #================================================= -ynh_script_progression --message="Creating a MySQL database..." --weight=2 +#REMOVEME? ynh_script_progression --message="Creating a MySQL database..." --weight=2 -db_name=$(ynh_sanitize_dbid --db_name=$app) -db_user=$db_name -ynh_app_setting_set --app=$app --key=db_name --value=$db_name -ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name +#REMOVEME? db_name=$(ynh_sanitize_dbid --db_name=$app) +#REMOVEME? db_user=$db_name +#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name +#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=5 -ynh_app_setting_set --app=$app --key=final_path --value=$final_path +#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir # 1 - Clone stable repo -git clone --quiet https://github.com/friendica/friendica.git -b stable "$final_path" +git clone --quiet https://github.com/friendica/friendica.git -b stable "$install_dir" # Reset branch to the level of update we needed -pushd "$final_path" +pushd "$install_dir" git reset --hard --quiet $version_commit popd # Copy .htaccess-dist to ..htaccess -cp -f "$final_path/.htaccess-dist" "$final_path/.htaccess" +cp -f "$install_dir/.htaccess-dist" "$install_dir/.htaccess" # 2 - Clone addons repo -git clone --quiet https://github.com/friendica/friendica-addons.git -b stable "$final_path/addon" +git clone --quiet https://github.com/friendica/friendica-addons.git -b stable "$install_dir/addon" # Reset addons branch to the level of update we needed -pushd "$final_path/addon" +pushd "$install_dir/addon" git reset --hard --quiet $addons_version_commit popd -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # NGINX CONFIGURATION @@ -122,7 +122,7 @@ ynh_add_nginx_config ynh_script_progression --message="Adding the LDAP Auth addon configuration file..." --weight=1 # LDAP addon config -ynh_add_config --template="../conf/addon.config.php" --destination="$final_path/config/addon.config.php" +ynh_add_config --template="../conf/addon.config.php" --destination="$install_dir/config/addon.config.php" #================================================= # PHP-FPM CONFIGURATION @@ -131,11 +131,11 @@ ynh_script_progression --message="Configuring PHP_FPM..." --weight=4 # Create a dedicated PHP-FPM configy ynh_add_fpm_config -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) # 3 - some extra folders -mkdir -p "$final_path/view/smarty3" -chmod -R 775 "$final_path/view/smarty3" +mkdir -p "$install_dir/view/smarty3" +chmod -R 775 "$install_dir/view/smarty3" #================================================= # SETUP A CRON @@ -151,14 +151,14 @@ chmod 644 "/etc/cron.d/$app" #================================================= ynh_script_progression --message="Install Friendica..." --weight=1 -pushd "$final_path" +pushd "$install_dir" # Import Composer dependencies ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet # Install application ynh_exec_as "$app" php$phpversion bin/console.php autoinstall\ --dbhost "localhost" --dbdata "$db_name" --dbuser "$db_user" --dbpass "$db_pwd"\ - --admin "$email" --tz "$timezone" --lang "$language" --url "https://$domain$path_url" + --admin "$email" --tz "$timezone" --lang "$language" --url "https://$domain$path" # Enable LDAP Auth addon ynh_exec_as "$app" php$phpversion bin/console.php addon enable ldapauth @@ -167,9 +167,9 @@ popd #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 9aeee7f..682f622 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,38 +12,38 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$db_name +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) #================================================= # REMOVE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Removing the MySQL database..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing the MySQL database..." --weight=1 # Remove a database if it exists, along with the associated user -ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name +#REMOVEME? ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." --weight=2 +#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=2 # Remove metapackage and its dependencies -ynh_remove_app_dependencies +#REMOVEME? ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --weight=3 +#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=3 # Remove the app directory securely -ynh_secure_remove --file="$final_path" +#REMOVEME? ynh_secure_remove --file="$install_dir" #================================================= # REMOVE NGINX CONFIGURATION @@ -82,10 +82,10 @@ ynh_secure_remove --file="/etc/cron.d/$app" #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user -ynh_system_user_delete --username=$app +#REMOVEME? ynh_system_user_delete --username=$app #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index f6b829e..a0f67fd 100644 --- a/scripts/restore +++ b/scripts/restore @@ -14,35 +14,35 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { #### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= ynh_script_progression --message="Loading settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$db_name +#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=1 +#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1 -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " +#REMOVEME? test ! -d $install_dir \ + || ynh_die --message="There is already a directory: $install_dir " #================================================= # STANDARD RESTORATION STEPS @@ -56,39 +56,39 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." --weight=1 +#REMOVEME? ynh_script_progression --message="Restoring the MySQL database..." --weight=1 -db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_script_progression --message="Restoring the app main directory..." --weight=1 -ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="$install_dir" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" -chmod -R 775 "$final_path/view/smarty3" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" +chmod -R 775 "$install_dir/view/smarty3" #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 3cc9e46..d36c8ae 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,20 +12,20 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -email=$(ynh_app_setting_get --app=$app --key=email) -admin=$(ynh_app_setting_get --app=$app --key=admin) -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) -language=$(ynh_app_setting_get --app=$app --key=language) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$db_name +#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +#REMOVEME? email=$(ynh_app_setting_get --app=$app --key=email) +#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) +#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#REMOVEME? language=$(ynh_app_setting_get --app=$app --key=language) timezone=$(cat /etc/timezone) #================================================= @@ -37,16 +37,16 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=2 +#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=2 # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { # restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # CHECK THE PATH @@ -56,22 +56,22 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=3 # If db_name doesn't exist, create it if [ -z "$db_name" ]; then db_name=$(ynh_sanitize_dbid --db_name=$app) - ynh_app_setting_set --app=$app --key=db_name --value=$db_name +#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name fi -# If final_path doesn't exist, create it -if [ -z "$final_path" ]; then - final_path=/var/www/$app - ynh_app_setting_set --app=$app --key=final_path --value=$final_path +# If install_dir doesn't exist, create it +if [ -z "$install_dir" ]; then +#REMOVEME? install_dir=/var/www/$app +#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir fi # Remove files for upgrade compatibilty from previous versions of Friendica -if [ -f $final_path/.htconfig.php ]; then - ynh_secure_remove "$final_path/.htconfig.php" +if [ -f $install_dir/.htconfig.php ]; then +#REMOVEME? ynh_secure_remove "$install_dir/.htconfig.php" fi -if [ -f $final_path/.htconfig.php ]; then - ynh_secure_remove "$final_path/config/local.ini.php" +if [ -f $install_dir/.htconfig.php ]; then +#REMOVEME? ynh_secure_remove "$install_dir/config/local.ini.php" fi # If admin_mail setting doesn't exist, create it @@ -87,8 +87,8 @@ if [ -z $language ]; then fi # Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all +#REMOVEME? if ynh_legacy_permissions_exists; then +#REMOVEME? ynh_legacy_permissions_delete_all ynh_app_setting_delete --app=$app --key=is_public fi @@ -96,10 +96,10 @@ fi #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 +#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 # Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -109,16 +109,16 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=3 # Check if the repo can be updated with git - if [ `cd $final_path && git rev-parse --is-inside-work-tree &> /dev/null` ]; + if [ `cd $install_dir && git rev-parse --is-inside-work-tree &> /dev/null` ]; then # Update through Git - pushd "$final_path" + pushd "$install_dir" git fetch git checkout stable git pull git reset --hard $version_commit popd - pushd "$final_path/addon" + pushd "$install_dir/addon" git fetch git checkout stable git pull @@ -129,40 +129,40 @@ else # Create a temporary directory and backup smarty3 folder tmpdir="$(mktemp -d)" - cp -a "$final_path/view/smarty3" "$tmpdir/smarty3" + cp -a "$install_dir/view/smarty3" "$tmpdir/smarty3" # Remove the app directory securely - ynh_secure_remove --file="$final_path" +#REMOVEME? ynh_secure_remove --file="$install_dir" # 1 - Clone stable repo - git clone --quiet https://github.com/friendica/friendica.git -b stable "$final_path" + git clone --quiet https://github.com/friendica/friendica.git -b stable "$install_dir" # Reset branch to the level of update we needed - pushd "$final_path" + pushd "$install_dir" git reset --hard --quiet $version_commit popd # 2 - Clone addons repo - git clone --quiet https://github.com/friendica/friendica-addons.git -b stable "$final_path/addon" + git clone --quiet https://github.com/friendica/friendica-addons.git -b stable "$install_dir/addon" # Reset addons branch to the level of update we needed - pushd "$final_path/addon" + pushd "$install_dir/addon" git reset --hard --quiet $addons_version_commit popd # Restore the smarty3 folder - cp -a "$tmpdir/smarty3" "$final_path/view/smarty3" + cp -a "$tmpdir/smarty3" "$install_dir/view/smarty3" ynh_secure_remove --file="$tmpdir" fi fi # Copy config file for correct place -ynh_add_config --template="../conf/local-sample.config.php" --destination="$final_path/config/local.config.php" +ynh_add_config --template="../conf/local-sample.config.php" --destination="$install_dir/config/local.config.php" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" # 3 - some extra folders -chmod -R 775 "$final_path/view/smarty3" +chmod -R 775 "$install_dir/view/smarty3" #================================================= # NGINX CONFIGURATION @@ -175,9 +175,9 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=6 +#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=6 -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # PHP-FPM CONFIGURATION @@ -196,7 +196,7 @@ chown root: "/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app" # Run Composer -pushd "$final_path" +pushd "$install_dir" ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet ynh_exec_as "$app" bin/console dbstructure update #ynh_exec_as "$app" bin/console config system addon ldapauth @@ -205,9 +205,9 @@ popd #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT From 7d2bc67d324a3b000602654cbe40cbcc10f6d694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 20 Aug 2023 15:51:37 +0200 Subject: [PATCH 02/53] v2 --- check_process | 24 --- conf/extra_php-fpm.conf | 4 + conf/nginx.conf | 2 +- conf/php-fpm.conf | 430 ---------------------------------------- doc/ADMIN.md | 7 + doc/ADMIN_fr.md | 7 + doc/DESCRIPTION_fr.md | 3 + doc/DISCLAIMER.md | 19 -- doc/DISCLAIMER_fr.md | 19 -- manifest.json | 67 ------- manifest.toml | 22 +- scripts/_common.sh | 5 - scripts/backup | 23 --- scripts/change_url | 84 -------- scripts/install | 71 +------ scripts/remove | 61 ------ scripts/restore | 84 +------- scripts/upgrade | 82 +------- tests.toml | 0 19 files changed, 47 insertions(+), 967 deletions(-) delete mode 100644 check_process create mode 100644 conf/extra_php-fpm.conf delete mode 100644 conf/php-fpm.conf create mode 100644 doc/ADMIN.md create mode 100644 doc/ADMIN_fr.md create mode 100644 doc/DESCRIPTION_fr.md delete mode 100644 doc/DISCLAIMER.md delete mode 100644 doc/DISCLAIMER_fr.md delete mode 100644 manifest.json create mode 100644 tests.toml diff --git a/check_process b/check_process deleted file mode 100644 index ff18b03..0000000 --- a/check_process +++ /dev/null @@ -1,24 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - admin="john" - language="en" - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=1 - setup_nourl=0 - setup_private=0 - setup_public=1 - upgrade=1 - #upgrade=1 from_commit=41c39d47e4e398339b7d6a4167ca2198dae998e3 - backup_restore=1 - multi_instance=1 - change_url=1 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=41c39d47e4e398339b7d6a4167ca2198dae998e3 - name=Merge pull request #50 from YunoHost-Apps/2021.04 - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf new file mode 100644 index 0000000..700c37c --- /dev/null +++ b/conf/extra_php-fpm.conf @@ -0,0 +1,4 @@ +; Additional php.ini defines, specific to this pool of workers. + +php_admin_value[upload_max_filesize] = 50M +php_admin_value[post_max_size] = 50M diff --git a/conf/nginx.conf b/conf/nginx.conf index 5e6ae82..c0f7011 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -8,7 +8,7 @@ location __PATH__/ { } #allow uploads up to 20MB in size - client_max_body_size 20m; + client_max_body_size 50M; client_body_buffer_size 128k; #Default indexes and catch-all diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf deleted file mode 100644 index 13a53b0..0000000 --- a/conf/php-fpm.conf +++ /dev/null @@ -1,430 +0,0 @@ -; Start a new pool named 'www'. -; the variable $pool can be used in any directive and will be replaced by the -; pool name ('www' here) -[__NAMETOCHANGE__] - -; Per pool prefix -; It only applies on the following directives: -; - 'access.log' -; - 'slowlog' -; - 'listen' (unixsocket) -; - 'chroot' -; - 'chdir' -; - 'php_values' -; - 'php_admin_values' -; When not set, the global prefix (or /usr) applies instead. -; Note: This directive can also be relative to the global prefix. -; Default Value: none -;prefix = /path/to/pools/$pool - -; Unix user/group of processes -; Note: The user is mandatory. If the group is not set, the default user's group -; will be used. -user = __USER__ -group = __USER__ - -; The address on which to accept FastCGI requests. -; Valid syntaxes are: -; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on -; a specific port; -; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on -; a specific port; -; 'port' - to listen on a TCP socket to all addresses -; (IPv6 and IPv4-mapped) on a specific port; -; '/path/to/unix/socket' - to listen on a unix socket. -; Note: This value is mandatory. -listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock - -; Set listen(2) backlog. -; Default Value: 511 (-1 on FreeBSD and OpenBSD) -;listen.backlog = 511 - -; Set permissions for unix socket, if one is used. In Linux, read/write -; permissions must be set in order to allow connections from a web server. Many -; BSD-derived systems allow connections regardless of permissions. -; Default Values: user and group are set as the running user -; mode is set to 0660 -listen.owner = www-data -listen.group = www-data -;listen.mode = 0660 -; When POSIX Access Control Lists are supported you can set them using -; these options, value is a comma separated list of user/group names. -; When set, listen.owner and listen.group are ignored -;listen.acl_users = -;listen.acl_groups = - -; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect. -; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original -; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address -; must be separated by a comma. If this value is left blank, connections will be -; accepted from any ip address. -; Default Value: any -;listen.allowed_clients = 127.0.0.1 - -; Specify the nice(2) priority to apply to the pool processes (only if set) -; The value can vary from -19 (highest priority) to 20 (lower priority) -; Note: - It will only work if the FPM master process is launched as root -; - The pool processes will inherit the master process priority -; unless it specified otherwise -; Default Value: no set -; process.priority = -19 - -; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user -; or group is differrent than the master process user. It allows to create process -; core dump and ptrace the process for the pool user. -; Default Value: no -; process.dumpable = yes - -; Choose how the process manager will control the number of child processes. -; Possible Values: -; static - a fixed number (pm.max_children) of child processes; -; dynamic - the number of child processes are set dynamically based on the -; following directives. With this process management, there will be -; always at least 1 children. -; pm.max_children - the maximum number of children that can -; be alive at the same time. -; pm.start_servers - the number of children created on startup. -; pm.min_spare_servers - the minimum number of children in 'idle' -; state (waiting to process). If the number -; of 'idle' processes is less than this -; number then some children will be created. -; pm.max_spare_servers - the maximum number of children in 'idle' -; state (waiting to process). If the number -; of 'idle' processes is greater than this -; number then some children will be killed. -; ondemand - no children are created at startup. Children will be forked when -; new requests will connect. The following parameter are used: -; pm.max_children - the maximum number of children that -; can be alive at the same time. -; pm.process_idle_timeout - The number of seconds after which -; an idle process will be killed. -; Note: This value is mandatory. -pm = dynamic - -; The number of child processes to be created when pm is set to 'static' and the -; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. -; This value sets the limit on the number of simultaneous requests that will be -; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. -; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP -; CGI. The below defaults are based on a server without much resources. Don't -; forget to tweak pm.* to fit your needs. -; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' -; Note: This value is mandatory. -pm.max_children = 5 - -; The number of child processes created on startup. -; Note: Used only when pm is set to 'dynamic' -; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 -pm.start_servers = 2 - -; The desired minimum number of idle server processes. -; Note: Used only when pm is set to 'dynamic' -; Note: Mandatory when pm is set to 'dynamic' -pm.min_spare_servers = 1 - -; The desired maximum number of idle server processes. -; Note: Used only when pm is set to 'dynamic' -; Note: Mandatory when pm is set to 'dynamic' -pm.max_spare_servers = 3 - -; The number of seconds after which an idle process will be killed. -; Note: Used only when pm is set to 'ondemand' -; Default Value: 10s -;pm.process_idle_timeout = 10s; - -; The number of requests each child process should execute before respawning. -; This can be useful to work around memory leaks in 3rd party libraries. For -; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. -; Default Value: 0 -;pm.max_requests = 500 - -; The URI to view the FPM status page. If this value is not set, no URI will be -; recognized as a status page. It shows the following informations: -; pool - the name of the pool; -; process manager - static, dynamic or ondemand; -; start time - the date and time FPM has started; -; start since - number of seconds since FPM has started; -; accepted conn - the number of request accepted by the pool; -; listen queue - the number of request in the queue of pending -; connections (see backlog in listen(2)); -; max listen queue - the maximum number of requests in the queue -; of pending connections since FPM has started; -; listen queue len - the size of the socket queue of pending connections; -; idle processes - the number of idle processes; -; active processes - the number of active processes; -; total processes - the number of idle + active processes; -; max active processes - the maximum number of active processes since FPM -; has started; -; max children reached - number of times, the process limit has been reached, -; when pm tries to start more children (works only for -; pm 'dynamic' and 'ondemand'); -; Value are updated in real time. -; Example output: -; pool: www -; process manager: static -; start time: 01/Jul/2011:17:53:49 +0200 -; start since: 62636 -; accepted conn: 190460 -; listen queue: 0 -; max listen queue: 1 -; listen queue len: 42 -; idle processes: 4 -; active processes: 11 -; total processes: 15 -; max active processes: 12 -; max children reached: 0 -; -; By default the status page output is formatted as text/plain. Passing either -; 'html', 'xml' or 'json' in the query string will return the corresponding -; output syntax. Example: -; http://www.foo.bar/status -; http://www.foo.bar/status?json -; http://www.foo.bar/status?html -; http://www.foo.bar/status?xml -; -; By default the status page only outputs short status. Passing 'full' in the -; query string will also return status for each pool process. -; Example: -; http://www.foo.bar/status?full -; http://www.foo.bar/status?json&full -; http://www.foo.bar/status?html&full -; http://www.foo.bar/status?xml&full -; The Full status returns for each process: -; pid - the PID of the process; -; state - the state of the process (Idle, Running, ...); -; start time - the date and time the process has started; -; start since - the number of seconds since the process has started; -; requests - the number of requests the process has served; -; request duration - the duration in µs of the requests; -; request method - the request method (GET, POST, ...); -; request URI - the request URI with the query string; -; content length - the content length of the request (only with POST); -; user - the user (PHP_AUTH_USER) (or '-' if not set); -; script - the main script called (or '-' if not set); -; last request cpu - the %cpu the last request consumed -; it's always 0 if the process is not in Idle state -; because CPU calculation is done when the request -; processing has terminated; -; last request memory - the max amount of memory the last request consumed -; it's always 0 if the process is not in Idle state -; because memory calculation is done when the request -; processing has terminated; -; If the process is in Idle state, then informations are related to the -; last request the process has served. Otherwise informations are related to -; the current request being served. -; Example output: -; ************************ -; pid: 31330 -; state: Running -; start time: 01/Jul/2011:17:53:49 +0200 -; start since: 63087 -; requests: 12808 -; request duration: 1250261 -; request method: GET -; request URI: /test_mem.php?N=10000 -; content length: 0 -; user: - -; script: /home/fat/web/docs/php/test_mem.php -; last request cpu: 0.00 -; last request memory: 0 -; -; Note: There is a real-time FPM status monitoring sample web page available -; It's available in: /usr/share/php/7.0/fpm/status.html -; -; Note: The value must start with a leading slash (/). The value can be -; anything, but it may not be a good idea to use the .php extension or it -; may conflict with a real PHP file. -; Default Value: not set -;pm.status_path = /status - -; The ping URI to call the monitoring page of FPM. If this value is not set, no -; URI will be recognized as a ping page. This could be used to test from outside -; that FPM is alive and responding, or to -; - create a graph of FPM availability (rrd or such); -; - remove a server from a group if it is not responding (load balancing); -; - trigger alerts for the operating team (24/7). -; Note: The value must start with a leading slash (/). The value can be -; anything, but it may not be a good idea to use the .php extension or it -; may conflict with a real PHP file. -; Default Value: not set -;ping.path = /ping - -; This directive may be used to customize the response of a ping request. The -; response is formatted as text/plain with a 200 response code. -; Default Value: pong -;ping.response = pong - -; The access log file -; Default: not set -;access.log = log/$pool.access.log - -; The access log format. -; The following syntax is allowed -; %%: the '%' character -; %C: %CPU used by the request -; it can accept the following format: -; - %{user}C for user CPU only -; - %{system}C for system CPU only -; - %{total}C for user + system CPU (default) -; %d: time taken to serve the request -; it can accept the following format: -; - %{seconds}d (default) -; - %{miliseconds}d -; - %{mili}d -; - %{microseconds}d -; - %{micro}d -; %e: an environment variable (same as $_ENV or $_SERVER) -; it must be associated with embraces to specify the name of the env -; variable. Some exemples: -; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e -; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e -; %f: script filename -; %l: content-length of the request (for POST request only) -; %m: request method -; %M: peak of memory allocated by PHP -; it can accept the following format: -; - %{bytes}M (default) -; - %{kilobytes}M -; - %{kilo}M -; - %{megabytes}M -; - %{mega}M -; %n: pool name -; %o: output header -; it must be associated with embraces to specify the name of the header: -; - %{Content-Type}o -; - %{X-Powered-By}o -; - %{Transfert-Encoding}o -; - .... -; %p: PID of the child that serviced the request -; %P: PID of the parent of the child that serviced the request -; %q: the query string -; %Q: the '?' character if query string exists -; %r: the request URI (without the query string, see %q and %Q) -; %R: remote IP address -; %s: status (response code) -; %t: server time the request was received -; it can accept a strftime(3) format: -; %d/%b/%Y:%H:%M:%S %z (default) -; The strftime(3) format must be encapsuled in a %{}t tag -; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t -; %T: time the log has been written (the request has finished) -; it can accept a strftime(3) format: -; %d/%b/%Y:%H:%M:%S %z (default) -; The strftime(3) format must be encapsuled in a %{}t tag -; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t -; %u: remote user -; -; Default: "%R - %u %t \"%m %r\" %s" -;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" - -; The log file for slow requests -; Default Value: not set -; Note: slowlog is mandatory if request_slowlog_timeout is set -;slowlog = log/$pool.log.slow - -; The timeout for serving a single request after which a PHP backtrace will be -; dumped to the 'slowlog' file. A value of '0s' means 'off'. -; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) -; Default Value: 0 -;request_slowlog_timeout = 0 - -; The timeout for serving a single request after which the worker process will -; be killed. This option should be used when the 'max_execution_time' ini option -; does not stop script execution for some reason. A value of '0' means 'off'. -; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) -; Default Value: 0 -request_terminate_timeout = 1d - -; Set open file descriptor rlimit. -; Default Value: system defined value -;rlimit_files = 1024 - -; Set max core size rlimit. -; Possible Values: 'unlimited' or an integer greater or equal to 0 -; Default Value: system defined value -;rlimit_core = 0 - -; Chroot to this directory at the start. This value must be defined as an -; absolute path. When this value is not set, chroot is not used. -; Note: you can prefix with '$prefix' to chroot to the pool prefix or one -; of its subdirectories. If the pool prefix is not set, the global prefix -; will be used instead. -; Note: chrooting is a great security feature and should be used whenever -; possible. However, all PHP paths will be relative to the chroot -; (error_log, sessions.save_path, ...). -; Default Value: not set -;chroot = - -; Chdir to this directory at the start. -; Note: relative path can be used. -; Default Value: current directory or / when chroot -chdir = __INSTALL_DIR__ - -; Redirect worker stdout and stderr into main error log. If not set, stdout and -; stderr will be redirected to /dev/null according to FastCGI specs. -; Note: on highloaded environement, this can cause some delay in the page -; process time (several ms). -; Default Value: no -;catch_workers_output = yes - -; Clear environment in FPM workers -; Prevents arbitrary environment variables from reaching FPM worker processes -; by clearing the environment in workers before env vars specified in this -; pool configuration are added. -; Setting to "no" will make all environment variables available to PHP code -; via getenv(), $_ENV and $_SERVER. -; Default Value: yes -;clear_env = no - -; Limits the extensions of the main script FPM will allow to parse. This can -; prevent configuration mistakes on the web server side. You should only limit -; FPM to .php extensions to prevent malicious users to use other extensions to -; execute php code. -; Note: set an empty value to allow all extensions. -; Default Value: .php -;security.limit_extensions = .php .php3 .php4 .php5 .php7 - -; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from -; the current environment. -; Default Value: clean env -;env[HOSTNAME] = $HOSTNAME -;env[PATH] = /usr/local/bin:/usr/bin:/bin -;env[TMP] = /tmp -;env[TMPDIR] = /tmp -;env[TEMP] = /tmp - -; Additional php.ini defines, specific to this pool of workers. These settings -; overwrite the values previously defined in the php.ini. The directives are the -; same as the PHP SAPI: -; php_value/php_flag - you can set classic ini defines which can -; be overwritten from PHP call 'ini_set'. -; php_admin_value/php_admin_flag - these directives won't be overwritten by -; PHP call 'ini_set' -; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. - -; Defining 'extension' will load the corresponding shared extension from -; extension_dir. Defining 'disable_functions' or 'disable_classes' will not -; overwrite previously defined php.ini values, but will append the new value -; instead. - -; Note: path INI options can be relative and will be expanded with the prefix -; (pool, global or /usr) - -; Default Value: nothing is defined by default except the values in php.ini and -; specified at startup with the -d argument -;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com -;php_flag[display_errors] = off -;php_admin_value[error_log] = /var/log/fpm-php.www.log -;php_admin_flag[log_errors] = on -;php_admin_value[memory_limit] = 32M - -; Common values to change to increase file upload limit -; php_admin_value[upload_max_filesize] = 50M -; php_admin_value[post_max_size] = 50M -; php_admin_flag[mail.add_x_header] = Off - -; Other common parameters -; php_admin_value[max_execution_time] = 600 -; php_admin_value[max_input_time] = 300 -; php_admin_value[memory_limit] = 256M -; php_admin_flag[short_open_tag] = On diff --git a/doc/ADMIN.md b/doc/ADMIN.md new file mode 100644 index 0000000..967cdf5 --- /dev/null +++ b/doc/ADMIN.md @@ -0,0 +1,7 @@ +## Installation + +### User with LDAP admin rights + +**For admin rights**: When installation is complete, you will need to visit your domain page and login with the **admin account username and password** which was entered at the time of installation process. You can then create your profile and access the admin panel. + + **For normal YunoHost users :** Normal LDAP users can login through Ldap authentication and create there profiles. diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md new file mode 100644 index 0000000..c63277b --- /dev/null +++ b/doc/ADMIN_fr.md @@ -0,0 +1,7 @@ +## Installation + +### Utilisateur avec des droits d'administrateur LDAP + +**Pour les droits d'administrateur** : une fois l'installation terminée, vous devrez visiter la page de votre domaine et vous connecter avec le **nom d'utilisateur et le mot de passe du compte administrateur** qui ont été saisis au moment du processus d'installation. Vous pouvez ensuite créer votre profil et accéder au panneau d'administration. + + **Pour les utilisateurs normaux de YunoHost :** Les utilisateurs LDAP normaux peuvent se connecter via l'authentification LDAP et y créer des profils. diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md new file mode 100644 index 0000000..4b3d428 --- /dev/null +++ b/doc/DESCRIPTION_fr.md @@ -0,0 +1,3 @@ +Friendica is a decentralised communications platform that integrates social communication. The platform links to independent social projects and corporate services. + +Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted. \ No newline at end of file diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md deleted file mode 100644 index 1a38dd5..0000000 --- a/doc/DISCLAIMER.md +++ /dev/null @@ -1,19 +0,0 @@ -## Installation - -### Register a new domain and add it to YunoHost - -Before installing, read the [Friendica installation instructions](https://github.com/friendica/friendica/blob/develop/doc/Install.md) for important information about installation. - -- Dedicated domain (must install under web root like **https://friendica.example.com/** not **https://example.com/friendica/** ) - -- Friendica requires browser-approved SSL certificates. - -### Install Friendica -Use the YunoHost admin panel to install Friendica by entering the GitHub repo address in the custom app URL: - - https://github.com/YunoHost-Apps/friendica_ynh - -## User with LDAP admin rights -**For admin rights**: When installation is complete, you will need to visit your domain page and login with the **admin account username and password** which was entered at the time of installation process. You can then create your profile and access the admin panel. - - **For normal YunoHost users :** Normal LDAP users can login through Ldap authentication and create there profiles. diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md deleted file mode 100644 index 3a5efdd..0000000 --- a/doc/DISCLAIMER_fr.md +++ /dev/null @@ -1,19 +0,0 @@ -## Installation - -### Enregistrez un nouveau domaine et ajoutez-le à YunoHost - -Avant l'installation, lisez les [instructions d'installation de Friendica](https://github.com/friendica/friendica/blob/develop/doc/Install.md) pour obtenir des informations importantes sur l'installation. - -- Domaine dédié (doit être installé sous la racine Web comme **https://friendica.example.com/** et non **https://example.com/friendica/** ) - -- Friendica nécessite des certificats SSL approuvés par le navigateur. - -### Installer Friendica -Utilisez le panneau d'administration YunoHost pour installer Friendica en saisissant l'adresse du dépôt GitHub dans l'URL de l'application personnalisée : - -https://github.com/YunoHost-Apps/friendica_ynh - -## Utilisateur avec des droits d'administrateur LDAP -**Pour les droits d'administrateur** : une fois l'installation terminée, vous devrez visiter la page de votre domaine et vous connecter avec le **nom d'utilisateur et le mot de passe du compte administrateur** qui ont été saisis au moment du processus d'installation. Vous pouvez ensuite créer votre profil et accéder au panneau d'administration. - - **Pour les utilisateurs normaux de YunoHost :** Les utilisateurs LDAP normaux peuvent se connecter via l'authentification LDAP et y créer des profils. diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 60df64e..0000000 --- a/manifest.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "Friendica", - "id": "friendica", - "packaging_format": 1, - "description": { - "en": "Social Communication Server", - "fr": "Serveur de Communication Social" - }, - "version": "2023.09~ynh1", - "url": "http://friendi.ca", - "upstream": { - "license": "AGPL-3.0-only", - "website": "http://friendi.ca", - "demo": "https://dir.friendica.social/servers", - "admindoc": "https://github.com/friendica/friendica/wiki", - "userdoc": "https://wiki.friendi.ca/", - "code": "https://github.com/friendica/friendica", - "cpe": "cpe:2.3:a:friendica:friendica" - }, - "license": "AGPL-3.0-only", - "maintainer": { - "name": "Anmol Sharma", - "email": "" - }, - "previous_maintainers": { - "name": "aymhce", - "email": "aymhce@gmail.com" - }, - "requirements": { - "yunohost": ">= 11.2" - }, - "multi_instance": true, - "services": [ - "nginx", - "php7.4-fpm", - "mysql" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "admin", - "type": "user" - }, - { - "name": "language", - "type": "string", - "ask": { - "en": "Choose the application language", - "fr": "Choisissez la langue de l'application" - }, - "choices": [ - "de", - "en", - "es", - "fr", - "it", - "pt" - ], - "default": "en" - } - ] - } -} \ No newline at end of file diff --git a/manifest.toml b/manifest.toml index be1b617..da0b635 100644 --- a/manifest.toml +++ b/manifest.toml @@ -7,7 +7,7 @@ description.fr = "Serveur de Communication Social" version = "2023.09~ynh1" -maintainers = ["Anmol Sharma"] +maintainers = [] [upstream] license = "AGPL-3.0-only" @@ -16,27 +16,22 @@ demo = "https://dir.friendica.social/servers" admindoc = "https://github.com/friendica/friendica/wiki" userdoc = "https://wiki.friendi.ca/" code = "https://github.com/friendica/friendica" -cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) -fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. [integration] yunohost = ">= 11.2" -architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +architectures = "all" multi_instance = true -ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. -sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. -disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... -ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... -ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ldap = true +sso = true +disk = "50M" +ram.build = "150M" +ram.runtime = "50M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" - full_domain = true [install.admin] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "user" [install.language] @@ -54,5 +49,8 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.permissions] main.url = "/" + [resources.apt] + packages = "mariadb-server php7.4-mbstring php7.4-json php7.4-imagick php7.4-xml php7.4-zip php7.4-mysql php7.4-gd php7.4-gmp" + [resources.database] type = "mysql" diff --git a/scripts/_common.sh b/scripts/_common.sh index e9dbd30..e23449c 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -9,11 +9,6 @@ version_commit="2dbfb070083ec395bf5d24ec89fe96b282c6a12d" addons_version_commit="f2cc0312ca9a95d99a8330452848180792bf9227" -# dependencies used by the app -#REMOVEME? YNH_PHP_VERSION="7.4" - -#REMOVEME? pkg_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-gmp" - #================================================= # EXPERIMENTAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 6a642fd..b96008b 100644 --- a/scripts/backup +++ b/scripts/backup @@ -10,29 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. - true -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/change_url b/scripts/change_url index 2a4d00b..df843ac 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,59 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN -#REMOVEME? old_path=$YNH_APP_OLD_PATH - -#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN -#REMOVEME? new_path=$YNH_APP_NEW_PATH - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? # Needed for helper "ynh_add_nginx_config" -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - -#================================================= -# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. -#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # Restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -#REMOVEME? change_domain=0 -#REMOVEME? if [ "$old_domain" != "$new_domain" ] -then - #REMOVEME? change_domain=1 -fi - -#REMOVEME? change_path=0 -#REMOVEME? if [ "$old_path" != "$new_path" ] -then - #REMOVEME? change_path=1 -fi - #================================================= # MODIFY URL IN NGINX CONF #================================================= @@ -69,37 +16,6 @@ ynh_script_progression --message="Updating NGINX web server configuration..." -- ynh_change_url_nginx_config -#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf - -# Change the path in the NGINX config file -if [ $change_path -eq 1 ] -then - # Make a backup of the original NGINX config file if modified -#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for NGINX helper -#REMOVEME? domain="$old_domain" -#REMOVEME? path="$new_path" - # Create a dedicated NGINX config -#REMOVEME? ynh_add_nginx_config -fi - -# Change the domain for NGINX -if [ $change_domain -eq 1 ] -then - # Delete file checksum for the old conf file location -#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" -#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location -#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi - -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index f21481b..cbbef24 100644 --- a/scripts/install +++ b/scripts/install @@ -9,84 +9,25 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. - true -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -#REMOVEME? domain=$YNH_APP_ARG_DOMAIN -path='/' -#REMOVEME? admin=$YNH_APP_ARG_ADMIN email=$(ynh_user_get_info --username=$admin --key=mail) -#REMOVEME? language=$YNH_APP_ARG_LANGUAGE timezone=$(cat /etc/timezone) -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 - -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" - -# Register (book) web path -#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=1 +ynh_script_progression --message="Storing installation settings..." --weight=1 -#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain -#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path -#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=email --value=$email -ynh_app_setting_set --app=$app --key=language --value=$language - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=6 - -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1 - -# Create a system user -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - -#================================================= -# CREATE A MYSQL DATABASE -#================================================= -#REMOVEME? ynh_script_progression --message="Creating a MySQL database..." --weight=2 - -#REMOVEME? db_name=$(ynh_sanitize_dbid --db_name=$app) -#REMOVEME? db_user=$db_name -#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name -#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=5 -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir - # 1 - Clone stable repo git clone --quiet https://github.com/friendica/friendica.git -b stable "$install_dir" # Reset branch to the level of update we needed @@ -130,8 +71,7 @@ ynh_add_config --template="../conf/addon.config.php" --destination="$install_dir ynh_script_progression --message="Configuring PHP_FPM..." --weight=4 # Create a dedicated PHP-FPM configy -ynh_add_fpm_config -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +ynh_add_fpm_config --usage=low --footprint=low # 3 - some extra folders mkdir -p "$install_dir/view/smarty3" @@ -164,13 +104,6 @@ pushd "$install_dir" ynh_exec_as "$app" php$phpversion bin/console.php addon enable ldapauth popd -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 682f622..8c19578 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,42 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - -#================================================= -# REMOVE THE MYSQL DATABASE -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the MySQL database..." --weight=1 - -# Remove a database if it exists, along with the associated user -#REMOVEME? ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name - -#================================================= -# REMOVE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=2 - -# Remove metapackage and its dependencies -#REMOVEME? ynh_remove_app_dependencies - -#================================================= -# REMOVE APP MAIN DIR -#================================================= -#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=3 - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -53,40 +17,15 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # Remove the dedicated nginx config ynh_remove_nginx_config -#================================================= -# REMOVE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1 - # Remove the dedicated PHP-FPM config ynh_remove_fpm_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# REMOVE CRON FILE -#================================================= -ynh_script_progression --message="Removing cron file..." --weight=1 - # Remove a cron file ynh_secure_remove --file="/etc/cron.d/$app" -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 - -# Delete a system user -#REMOVEME? ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index a0f67fd..34a2258 100644 --- a/scripts/restore +++ b/scripts/restore @@ -10,74 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - #### Remove this function if there's nothing to clean before calling the remove script. - true -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1 - -#REMOVEME? test ! -d $install_dir \ - || ynh_die --message="There is already a directory: $install_dir " - -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=1 - -# Define and install dependencies -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# RESTORE THE MYSQL DATABASE -#================================================= -#REMOVEME? ynh_script_progression --message="Restoring the MySQL database..." --weight=1 - -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd -ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql - -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -85,11 +17,17 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" chmod -R 775 "$install_dir/view/smarty3" +#================================================= +# RESTORE THE MYSQL DATABASE +#================================================= +ynh_script_progression --message="Restoring the MySQL database..." --weight=1 + +ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql + #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= @@ -97,13 +35,7 @@ ynh_script_progression --message="Restoring PHP-FPM configuration..." --weight=1 ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" -# Recreate a dedicated php-fpm config -ynh_add_fpm_config - -#================================================= -# RESTORE THE CRON FILE -#================================================= -ynh_script_progression --message="Restoring various files..." --weight=1 +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file "/etc/cron.d/$app" chown root: "/etc/cron.d/$app" diff --git a/scripts/upgrade b/scripts/upgrade index d36c8ae..65f0acb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,20 +12,8 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -#REMOVEME? email=$(ynh_app_setting_get --app=$app --key=email) -#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) -#REMOVEME? language=$(ynh_app_setting_get --app=$app --key=language) timezone=$(cat /etc/timezone) #================================================= @@ -34,44 +22,18 @@ timezone=$(cat /etc/timezone) upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=2 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # CHECK THE PATH #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=3 -# If db_name doesn't exist, create it -if [ -z "$db_name" ]; then - db_name=$(ynh_sanitize_dbid --db_name=$app) -#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name -fi - -# If install_dir doesn't exist, create it -if [ -z "$install_dir" ]; then -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir -fi - # Remove files for upgrade compatibilty from previous versions of Friendica if [ -f $install_dir/.htconfig.php ]; then -#REMOVEME? ynh_secure_remove "$install_dir/.htconfig.php" + ynh_secure_remove "$install_dir/.htconfig.php" fi if [ -f $install_dir/.htconfig.php ]; then -#REMOVEME? ynh_secure_remove "$install_dir/config/local.ini.php" + ynh_secure_remove "$install_dir/config/local.ini.php" fi # If admin_mail setting doesn't exist, create it @@ -86,21 +48,6 @@ if [ -z $language ]; then ynh_app_setting_set --app=$app --key=language --value=$language fi -# Cleaning legacy permissions -#REMOVEME? if ynh_legacy_permissions_exists; then -#REMOVEME? ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 - -# Create a dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -132,7 +79,7 @@ else cp -a "$install_dir/view/smarty3" "$tmpdir/smarty3" # Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" + ynh_secure_remove --file="$install_dir" # 1 - Clone stable repo git clone --quiet https://github.com/friendica/friendica.git -b stable "$install_dir" @@ -172,20 +119,8 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=6 - -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=4 - # Create a dedicated PHP-FPM config -ynh_add_fpm_config +ynh_add_fpm_config --usage=low --footprint=low #================================================= # STORE THE CONFIG FILE CHECKSUM @@ -202,13 +137,6 @@ pushd "$install_dir" #ynh_exec_as "$app" bin/console config system addon ldapauth popd -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..e69de29 From 4df8f63b6a76e49122163bd232680bb1cecc060d Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 20 Aug 2023 13:51:41 +0000 Subject: [PATCH 03/53] Auto-update README --- README.md | 22 ---------------------- README_fr.md | 22 ---------------------- 2 files changed, 44 deletions(-) diff --git a/README.md b/README.md index e3cc85c..c61f45c 100644 --- a/README.md +++ b/README.md @@ -28,28 +28,6 @@ Friendica connects you effortlessly to a federated communications network of sev ![Screenshot of Friendica](./doc/screenshots/friendica-vier-profile.png) -## Disclaimers / important information - -## Installation - -### Register a new domain and add it to YunoHost - -Before installing, read the [Friendica installation instructions](https://github.com/friendica/friendica/blob/develop/doc/Install.md) for important information about installation. - -- Dedicated domain (must install under web root like **https://friendica.example.com/** not **https://example.com/friendica/** ) - -- Friendica requires browser-approved SSL certificates. - -### Install Friendica -Use the YunoHost admin panel to install Friendica by entering the GitHub repo address in the custom app URL: - - https://github.com/YunoHost-Apps/friendica_ynh - -## User with LDAP admin rights -**For admin rights**: When installation is complete, you will need to visit your domain page and login with the **admin account username and password** which was entered at the time of installation process. You can then create your profile and access the admin panel. - - **For normal YunoHost users :** Normal LDAP users can login through Ldap authentication and create there profiles. - ## Documentation and resources * Official app website: diff --git a/README_fr.md b/README_fr.md index 9bbd62e..36606a2 100644 --- a/README_fr.md +++ b/README_fr.md @@ -28,28 +28,6 @@ Friendica connects you effortlessly to a federated communications network of sev ![Capture d’écran de Friendica](./doc/screenshots/friendica-vier-profile.png) -## Avertissements / informations importantes - -## Installation - -### Enregistrez un nouveau domaine et ajoutez-le à YunoHost - -Avant l'installation, lisez les [instructions d'installation de Friendica](https://github.com/friendica/friendica/blob/develop/doc/Install.md) pour obtenir des informations importantes sur l'installation. - -- Domaine dédié (doit être installé sous la racine Web comme **https://friendica.example.com/** et non **https://example.com/friendica/** ) - -- Friendica nécessite des certificats SSL approuvés par le navigateur. - -### Installer Friendica -Utilisez le panneau d'administration YunoHost pour installer Friendica en saisissant l'adresse du dépôt GitHub dans l'URL de l'application personnalisée : - -https://github.com/YunoHost-Apps/friendica_ynh - -## Utilisateur avec des droits d'administrateur LDAP -**Pour les droits d'administrateur** : une fois l'installation terminée, vous devrez visiter la page de votre domaine et vous connecter avec le **nom d'utilisateur et le mot de passe du compte administrateur** qui ont été saisis au moment du processus d'installation. Vous pouvez ensuite créer votre profil et accéder au panneau d'administration. - - **Pour les utilisateurs normaux de YunoHost :** Les utilisateurs LDAP normaux peuvent se connecter via l'authentification LDAP et y créer des profils. - ## Documentations et ressources * Site officiel de l’app : From f588ebb0e2c3cd00880ce60f1c4be32cd7f34e08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 20 Aug 2023 15:55:57 +0200 Subject: [PATCH 04/53] Update manifest.toml --- manifest.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/manifest.toml b/manifest.toml index da0b635..af56b23 100644 --- a/manifest.toml +++ b/manifest.toml @@ -30,6 +30,10 @@ ram.runtime = "50M" [install] [install.domain] type = "domain" + + [install.init_main_permission] + type = "group" + default = "visitors" [install.admin] type = "user" From 2804493701b217be5adc91ed427d9ea89c6ea97a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 20 Aug 2023 15:57:56 +0200 Subject: [PATCH 05/53] Update tests.toml --- tests.toml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests.toml b/tests.toml index e69de29..91daf17 100644 --- a/tests.toml +++ b/tests.toml @@ -0,0 +1,7 @@ +test_format = 1.0 + +[default] + + # ------------ + # Tests to run + # ------------ \ No newline at end of file From 372eddc45f33500c97c0d169df8c6916a6f79537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 20 Aug 2023 16:13:39 +0200 Subject: [PATCH 06/53] Update install --- scripts/install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index cbbef24..e98a0bf 100644 --- a/scripts/install +++ b/scripts/install @@ -28,6 +28,8 @@ ynh_app_setting_set --app=$app --key=email --value=$email #================================================= ynh_script_progression --message="Setting up source files..." --weight=5 +git config --system --add safe.directory $install_dir + # 1 - Clone stable repo git clone --quiet https://github.com/friendica/friendica.git -b stable "$install_dir" # Reset branch to the level of update we needed From 57c3bb36f9d090283757bae5ce7454b669dcf8e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 20 Aug 2023 16:18:38 +0200 Subject: [PATCH 07/53] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index af56b23..053d012 100644 --- a/manifest.toml +++ b/manifest.toml @@ -41,7 +41,7 @@ ram.runtime = "50M" [install.language] ask.en = "Choose the application language" ask.fr = "Choisissez la langue de l'application" - type = "string" + type = "select" choices = ["de", "en", "es", "fr", "it", "pt"] default = "en" From 329a3b13cb24f6cd19231182309e2026361c627e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 09:55:30 +0200 Subject: [PATCH 08/53] src --- manifest.toml | 14 +++++++++++- scripts/_common.sh | 5 ----- scripts/install | 30 +++++-------------------- scripts/upgrade | 56 +++++----------------------------------------- 4 files changed, 24 insertions(+), 81 deletions(-) diff --git a/manifest.toml b/manifest.toml index 053d012..55ec76b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Friendica" description.en = "Social Communication Server" description.fr = "Serveur de Communication Social" -version = "2023.09~ynh1" +version = "2023.05~ynh1" maintainers = [] @@ -46,6 +46,18 @@ ram.runtime = "50M" default = "en" [resources] + + [resources.sources] + [resources.sources.main] + url = "https://github.com/friendica/friendica/archive/refs/tags/2023.05.tar.gz" + sha256 = "727a8fdab6a2f6424d3dbc895496447e750eb0f8e1e11b70f1e229a7e3c9a31d" + autoupdate.strategy = "latest_github_tag" + + [resources.sources.addons] + url = "https://github.com/friendica/friendica-addons/archive/refs/tags/2023.05.tar.gz" + sha256 = "df29aed28c0208e162c76f91949d0c3a0f77fe09853fe1a6d854b9956075d8a0" + autoupdate.strategy = "latest_github_tag" + [resources.system_user] [resources.install_dir] diff --git a/scripts/_common.sh b/scripts/_common.sh index e23449c..c3aba20 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,11 +4,6 @@ # COMMON VARIABLES #================================================= -# commit hashes -# 2023.08 -version_commit="2dbfb070083ec395bf5d24ec89fe96b282c6a12d" -addons_version_commit="f2cc0312ca9a95d99a8330452848180792bf9227" - #================================================= # EXPERIMENTAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index e98a0bf..551593a 100644 --- a/scripts/install +++ b/scripts/install @@ -28,26 +28,13 @@ ynh_app_setting_set --app=$app --key=email --value=$email #================================================= ynh_script_progression --message="Setting up source files..." --weight=5 -git config --system --add safe.directory $install_dir - -# 1 - Clone stable repo -git clone --quiet https://github.com/friendica/friendica.git -b stable "$install_dir" -# Reset branch to the level of update we needed -pushd "$install_dir" - git reset --hard --quiet $version_commit -popd +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source --dest_dir="$install_dir" +ynh_setup_source --dest_dir="$install_dir/addon" --source_id="addons" # Copy .htaccess-dist to ..htaccess cp -f "$install_dir/.htaccess-dist" "$install_dir/.htaccess" -# 2 - Clone addons repo -git clone --quiet https://github.com/friendica/friendica-addons.git -b stable "$install_dir/addon" -# Reset addons branch to the level of update we needed -pushd "$install_dir/addon" - git reset --hard --quiet $addons_version_commit -popd - -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" @@ -59,6 +46,9 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config +# Create a dedicated PHP-FPM configy +ynh_add_fpm_config --usage=low --footprint=low + #================================================= # ADD A CONFIGURATION #================================================= @@ -67,14 +57,6 @@ ynh_script_progression --message="Adding the LDAP Auth addon configuration file. # LDAP addon config ynh_add_config --template="../conf/addon.config.php" --destination="$install_dir/config/addon.config.php" -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring PHP_FPM..." --weight=4 - -# Create a dedicated PHP-FPM configy -ynh_add_fpm_config --usage=low --footprint=low - # 3 - some extra folders mkdir -p "$install_dir/view/smarty3" chmod -R 775 "$install_dir/view/smarty3" diff --git a/scripts/upgrade b/scripts/upgrade index 65f0acb..7111f42 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -54,63 +54,17 @@ fi if [ "$upgrade_type" == "UPGRADE_APP" ] then -ynh_script_progression --message="Upgrading source files..." --weight=3 -# Check if the repo can be updated with git - if [ `cd $install_dir && git rev-parse --is-inside-work-tree &> /dev/null` ]; - then - # Update through Git - pushd "$install_dir" - git fetch - git checkout stable - git pull - git reset --hard $version_commit - popd - pushd "$install_dir/addon" - git fetch - git checkout stable - git pull - git reset --hard $addons_version_commit - popd -# If Git is not present upgrade through manual method -else + ynh_script_progression --message="Upgrading source files..." --weight=1 - # Create a temporary directory and backup smarty3 folder - tmpdir="$(mktemp -d)" - cp -a "$install_dir/view/smarty3" "$tmpdir/smarty3" - - # Remove the app directory securely - ynh_secure_remove --file="$install_dir" - - # 1 - Clone stable repo - git clone --quiet https://github.com/friendica/friendica.git -b stable "$install_dir" - # Reset branch to the level of update we needed - pushd "$install_dir" - git reset --hard --quiet $version_commit - popd - - # 2 - Clone addons repo - git clone --quiet https://github.com/friendica/friendica-addons.git -b stable "$install_dir/addon" - # Reset addons branch to the level of update we needed - pushd "$install_dir/addon" - git reset --hard --quiet $addons_version_commit - popd - - # Restore the smarty3 folder - cp -a "$tmpdir/smarty3" "$install_dir/view/smarty3" - ynh_secure_remove --file="$tmpdir" - fi + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source --dest_dir="$install_dir" --keep ="config/local.config.php view/smarty3" + ynh_setup_source --dest_dir="$install_dir/addon" --source_id="addons" fi -# Copy config file for correct place -ynh_add_config --template="../conf/local-sample.config.php" --destination="$install_dir/config/local.config.php" - -chmod 750 "$install_dir" +chmod -R 775 "$install_dir/view/smarty3" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -# 3 - some extra folders -chmod -R 775 "$install_dir/view/smarty3" - #================================================= # NGINX CONFIGURATION #================================================= From 42345dcbafc6c2cf87179f2bda4fcb40dc52bd05 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 21 Aug 2023 07:55:34 +0000 Subject: [PATCH 09/53] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c61f45c..bd520a9 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Friendica is a decentralised communications platform that integrates social comm Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted. -**Shipped version:** 2023.09~ynh1 +**Shipped version:** 2023.05~ynh1 **Demo:** https://dir.friendica.social/servers diff --git a/README_fr.md b/README_fr.md index 36606a2..bf53cb3 100644 --- a/README_fr.md +++ b/README_fr.md @@ -20,7 +20,7 @@ Friendica is a decentralised communications platform that integrates social comm Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted. -**Version incluse :** 2023.09~ynh1 +**Version incluse :** 2023.05~ynh1 **Démo :** https://dir.friendica.social/servers From ecc8c1f98c6da943cde626590ab67983ea01dd22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 10:05:52 +0200 Subject: [PATCH 10/53] add daemon --- conf/cron | 2 -- conf/systemd.service | 22 ++++++++++++++++++++++ scripts/backup | 5 ++--- scripts/install | 31 ++++++++++++++----------------- scripts/remove | 18 +++++++++++++----- scripts/restore | 13 ++++++++----- scripts/upgrade | 22 ++++++++++++++++++---- 7 files changed, 77 insertions(+), 36 deletions(-) delete mode 100644 conf/cron create mode 100644 conf/systemd.service diff --git a/conf/cron b/conf/cron deleted file mode 100644 index 5a2ddf2..0000000 --- a/conf/cron +++ /dev/null @@ -1,2 +0,0 @@ -# Run poller periodically to update Friendica -*/10 * * * * __APP__ /usr/bin/php__PHPVERSION__ -f __INSTALL_DIR__/bin/worker.php diff --git a/conf/systemd.service b/conf/systemd.service new file mode 100644 index 0000000..d4ed749 --- /dev/null +++ b/conf/systemd.service @@ -0,0 +1,22 @@ +[Unit] +Description=Friendica daemon +After=network.target mariadb.service +Requires=network.target remote-fs.target nss-lookup.target + +[Service] +User=__APP__ +Group=__APP__ +WorkingDirectory=__INSTALL_DIR__/ +Type=simple +StandardOutput=null +StandardError=syslog +ExecStart=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/bin/daemon.php start +ExecStop=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/bin/daemon.php stop +PIDFile=friendica/daemon.pid +PrivateTmp=true +InaccessibleDirectories=/home /root /boot /opt /mnt /media +ReadOnlyDirectories=/etc /usr +Restart=always + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/scripts/backup b/scripts/backup index b96008b..afdb2f0 100644 --- a/scripts/backup +++ b/scripts/backup @@ -34,11 +34,10 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= -# BACKUP VARIOUS FILES +# BACKUP SYSTEMD #================================================= -# Backup cron job -ynh_backup --src_path="/etc/cron.d/$app" +ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/install b/scripts/install index e98a0bf..0fb6184 100644 --- a/scripts/install +++ b/scripts/install @@ -59,6 +59,13 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config +# Create a dedicated PHP-FPM configy +ynh_add_fpm_config --usage=low --footprint=low + +ynh_add_systemd_config + +yunohost service add $app --description="Friendica daemon" --log="/var/log/$app/$app.log" + #================================================= # ADD A CONFIGURATION #================================================= @@ -67,27 +74,10 @@ ynh_script_progression --message="Adding the LDAP Auth addon configuration file. # LDAP addon config ynh_add_config --template="../conf/addon.config.php" --destination="$install_dir/config/addon.config.php" -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring PHP_FPM..." --weight=4 - -# Create a dedicated PHP-FPM configy -ynh_add_fpm_config --usage=low --footprint=low - # 3 - some extra folders mkdir -p "$install_dir/view/smarty3" chmod -R 775 "$install_dir/view/smarty3" -#================================================= -# SETUP A CRON -#================================================= -ynh_script_progression --message="Setting up the cron job..." --weight=1 - -ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" -chown root: "/etc/cron.d/$app" -chmod 644 "/etc/cron.d/$app" - #================================================= # INSTALL FRIENDICA #================================================= @@ -106,6 +96,13 @@ pushd "$install_dir" ynh_exec_as "$app" php$phpversion bin/console.php addon enable ldapauth popd +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." --weight=1 + +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 8c19578..cfca097 100644 --- a/scripts/remove +++ b/scripts/remove @@ -10,9 +10,20 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# REMOVE NGINX CONFIGURATION +# REMOVE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 +# REMOVE SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 + +# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) +if ynh_exec_warn_less yunohost service status $app >/dev/null +then + ynh_script_progression --message="Removing $app service integration..." --weight=1 + yunohost service remove $app +fi + +ynh_remove_systemd_config # Remove the dedicated nginx config ynh_remove_nginx_config @@ -23,9 +34,6 @@ ynh_remove_fpm_config # Remove the app-specific logrotate config ynh_remove_logrotate -# Remove a cron file -ynh_secure_remove --file="/etc/cron.d/$app" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 34a2258..e7cb2b7 100644 --- a/scripts/restore +++ b/scripts/restore @@ -37,18 +37,21 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_restore_file "/etc/cron.d/$app" -chown root: "/etc/cron.d/$app" -chmod 644 "/etc/cron.d/$app" +ynh_restore_file --origin_path="/etc/systemd/system/$app.service" +systemctl enable $app.service --quiet + +yunohost service add $app --description="Friendica daemon" --log="/var/log/$app/$app.log" #================================================= # GENERIC FINALIZATION #================================================= -# RELOAD NGINX AND PHP-FPM +# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= -ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name=php$phpversion-fpm --action=reload + ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 65f0acb..a160eac 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -22,6 +22,13 @@ timezone=$(cat /etc/timezone) upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Stopping a systemd service..." --weight=1 + +ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" + #================================================= # CHECK THE PATH #================================================= @@ -122,14 +129,14 @@ ynh_add_nginx_config # Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low +ynh_add_systemd_config + +yunohost service add $app --description="Friendica daemon" --log="/var/log/$app/$app.log" + #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= -ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" -chown root: "/etc/cron.d/$app" -chmod 644 "/etc/cron.d/$app" - # Run Composer pushd "$install_dir" ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet @@ -137,6 +144,13 @@ pushd "$install_dir" #ynh_exec_as "$app" bin/console config system addon ldapauth popd +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." --weight=1 + +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" + #================================================= # END OF SCRIPT #================================================= From 76aa3570570b6d3685bc63381cfaf5bf7a9f2a2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 10:13:29 +0200 Subject: [PATCH 11/53] add fail2ban --- scripts/backup | 7 +++++++ scripts/install | 3 +++ scripts/remove | 4 +++- scripts/restore | 4 ++++ scripts/upgrade | 3 +++ 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/scripts/backup b/scripts/backup index b96008b..762c36c 100644 --- a/scripts/backup +++ b/scripts/backup @@ -33,6 +33,13 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +#================================================= +# BACKUP FAIL2BAN CONFIGURATION +#================================================= + +ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" +ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" + #================================================= # BACKUP VARIOUS FILES #================================================= diff --git a/scripts/install b/scripts/install index e98a0bf..6615d07 100644 --- a/scripts/install +++ b/scripts/install @@ -88,6 +88,9 @@ ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" chown root: "/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app" +# Create a dedicated Fail2Ban config +ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"\".*$" + #================================================= # INSTALL FRIENDICA #================================================= diff --git a/scripts/remove b/scripts/remove index 8c19578..425b544 100644 --- a/scripts/remove +++ b/scripts/remove @@ -21,7 +21,9 @@ ynh_remove_nginx_config ynh_remove_fpm_config # Remove the app-specific logrotate config -ynh_remove_logrotate +#ynh_remove_logrotate + +ynh_remove_fail2ban_config # Remove a cron file ynh_secure_remove --file="/etc/cron.d/$app" diff --git a/scripts/restore b/scripts/restore index 34a2258..1493b31 100644 --- a/scripts/restore +++ b/scripts/restore @@ -41,6 +41,10 @@ ynh_restore_file "/etc/cron.d/$app" chown root: "/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app" +ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" +ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" +ynh_systemd_action --action=restart --service_name=fail2ban + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 65f0acb..467396e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -122,6 +122,9 @@ ynh_add_nginx_config # Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low +# Create a dedicated Fail2Ban config +ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"\".*$" + #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= From 08cae916a9954b14a099644a6b4cfb7775618880 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 21 Aug 2023 09:48:06 +0000 Subject: [PATCH 12/53] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bd520a9..c61f45c 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Friendica is a decentralised communications platform that integrates social comm Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted. -**Shipped version:** 2023.05~ynh1 +**Shipped version:** 2023.09~ynh1 **Demo:** https://dir.friendica.social/servers diff --git a/README_fr.md b/README_fr.md index bf53cb3..36606a2 100644 --- a/README_fr.md +++ b/README_fr.md @@ -20,7 +20,7 @@ Friendica is a decentralised communications platform that integrates social comm Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted. -**Version incluse :** 2023.05~ynh1 +**Version incluse :** 2023.09~ynh1 **Démo :** https://dir.friendica.social/servers From 408167e9863d18a4f641b5a5aa3281ce3c8f902e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 11:49:02 +0200 Subject: [PATCH 13/53] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 053d012..b754823 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Friendica" description.en = "Social Communication Server" description.fr = "Serveur de Communication Social" -version = "2023.09~ynh1" +version = "2023.05~ynh1" maintainers = [] From 4093cddc724947569261986a795e5a32fbbab65e Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 21 Aug 2023 09:49:14 +0000 Subject: [PATCH 14/53] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c61f45c..bd520a9 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Friendica is a decentralised communications platform that integrates social comm Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted. -**Shipped version:** 2023.09~ynh1 +**Shipped version:** 2023.05~ynh1 **Demo:** https://dir.friendica.social/servers diff --git a/README_fr.md b/README_fr.md index 36606a2..bf53cb3 100644 --- a/README_fr.md +++ b/README_fr.md @@ -20,7 +20,7 @@ Friendica is a decentralised communications platform that integrates social comm Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted. -**Version incluse :** 2023.09~ynh1 +**Version incluse :** 2023.05~ynh1 **Démo :** https://dir.friendica.social/servers From baf37bed7029c54b24d1cafb995c599b61dfb25e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 11:52:26 +0200 Subject: [PATCH 15/53] fix --- manifest.toml | 2 +- tests.toml | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/manifest.toml b/manifest.toml index b754823..ffc84c7 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Friendica" description.en = "Social Communication Server" description.fr = "Serveur de Communication Social" -version = "2023.05~ynh1" +version = "2023.05~ynh2" maintainers = [] diff --git a/tests.toml b/tests.toml index 91daf17..3e870e5 100644 --- a/tests.toml +++ b/tests.toml @@ -2,6 +2,8 @@ test_format = 1.0 [default] - # ------------ - # Tests to run - # ------------ \ No newline at end of file + # ------------------------------- + # Commits to test upgrade from + # ------------------------------- + + test_upgrade_from.dc7cd3eabe212708375c0dcd4ee994a1373a8122.name = "Upgrade from 2023.05~ynh1" \ No newline at end of file From 5b9f3f4615807c79bfa665d03a53032f7e8cbe66 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 21 Aug 2023 09:52:37 +0000 Subject: [PATCH 16/53] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bd520a9..b163a38 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Friendica is a decentralised communications platform that integrates social comm Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted. -**Shipped version:** 2023.05~ynh1 +**Shipped version:** 2023.05~ynh2 **Demo:** https://dir.friendica.social/servers diff --git a/README_fr.md b/README_fr.md index bf53cb3..2f7986e 100644 --- a/README_fr.md +++ b/README_fr.md @@ -20,7 +20,7 @@ Friendica is a decentralised communications platform that integrates social comm Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted. -**Version incluse :** 2023.05~ynh1 +**Version incluse :** 2023.05~ynh2 **Démo :** https://dir.friendica.social/servers From 107b140c650756b9689425fea98ce02e39b119ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 11:53:28 +0200 Subject: [PATCH 17/53] Update nginx.conf --- conf/nginx.conf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index c0f7011..ff4222f 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -44,6 +44,7 @@ location __PATH__/ { location ~ /\. { deny all; } - #Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; + + #Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; } From b3100886154a6715713e5a7d3e0f707b642b3374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 11:54:28 +0200 Subject: [PATCH 18/53] fix --- doc/ADMIN.md | 4 +--- doc/ADMIN_fr.md | 4 +--- doc/DESCRIPTION.md | 1 - doc/DESCRIPTION_fr.md | 1 - 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/doc/ADMIN.md b/doc/ADMIN.md index 967cdf5..79afe3e 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -1,6 +1,4 @@ -## Installation - -### User with LDAP admin rights +## User with LDAP admin rights **For admin rights**: When installation is complete, you will need to visit your domain page and login with the **admin account username and password** which was entered at the time of installation process. You can then create your profile and access the admin panel. diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index c63277b..a212ff7 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -1,6 +1,4 @@ -## Installation - -### Utilisateur avec des droits d'administrateur LDAP +## Utilisateur avec des droits d'administrateur LDAP **Pour les droits d'administrateur** : une fois l'installation terminée, vous devrez visiter la page de votre domaine et vous connecter avec le **nom d'utilisateur et le mot de passe du compte administrateur** qui ont été saisis au moment du processus d'installation. Vous pouvez ensuite créer votre profil et accéder au panneau d'administration. diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index 4b3d428..a3f067b 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -1,3 +1,2 @@ Friendica is a decentralised communications platform that integrates social communication. The platform links to independent social projects and corporate services. - Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted. \ No newline at end of file diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md index 4b3d428..a3f067b 100644 --- a/doc/DESCRIPTION_fr.md +++ b/doc/DESCRIPTION_fr.md @@ -1,3 +1,2 @@ Friendica is a decentralised communications platform that integrates social communication. The platform links to independent social projects and corporate services. - Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted. \ No newline at end of file From e4378f2754779c5b8136dceac912c0a68d81ba41 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 21 Aug 2023 09:54:33 +0000 Subject: [PATCH 19/53] Auto-update README --- README.md | 1 - README_fr.md | 1 - 2 files changed, 2 deletions(-) diff --git a/README.md b/README.md index b163a38..d71dbe8 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,6 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview Friendica is a decentralised communications platform that integrates social communication. The platform links to independent social projects and corporate services. - Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted. **Shipped version:** 2023.05~ynh2 diff --git a/README_fr.md b/README_fr.md index 2f7986e..f99ab30 100644 --- a/README_fr.md +++ b/README_fr.md @@ -17,7 +17,6 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po ## Vue d’ensemble Friendica is a decentralised communications platform that integrates social communication. The platform links to independent social projects and corporate services. - Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted. **Version incluse :** 2023.05~ynh2 From 752038f1f879847aa25644860ba02c289f995c59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 12:18:06 +0200 Subject: [PATCH 20/53] Update upgrade --- scripts/upgrade | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index a160eac..8ff3dbe 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -39,8 +39,13 @@ if [ -f $install_dir/.htconfig.php ]; then ynh_secure_remove "$install_dir/.htconfig.php" fi +# Remove files for upgrade compatibilty from previous versions of Friendica if [ -f $install_dir/.htconfig.php ]; then - ynh_secure_remove "$install_dir/config/local.ini.php" + ynh_secure_remove "$install_dir/.htconfig.php" +fi + +if [ -f /etc/cron.d/$app ]; then + ynh_secure_remove --file="/etc/cron.d/$app" fi # If admin_mail setting doesn't exist, create it From b017f2a795ba0f2a6c34d9ce0ab2dc3f1e59dac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 12:18:22 +0200 Subject: [PATCH 21/53] Update upgrade --- scripts/upgrade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 8ff3dbe..09a0f06 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -44,18 +44,18 @@ if [ -f $install_dir/.htconfig.php ]; then ynh_secure_remove "$install_dir/.htconfig.php" fi -if [ -f /etc/cron.d/$app ]; then +if [ -f "/etc/cron.d/$app" ]; then ynh_secure_remove --file="/etc/cron.d/$app" fi # If admin_mail setting doesn't exist, create it -if [ -z $email ]; then +if [ -z "${email:-}" ]; then email=$(ynh_user_get_info --username=$admin --key=mail) ynh_app_setting_set --app=$app --key=email --value=$email fi # If language setting doesn't exist, create it -if [ -z $language ]; then +if [ -z "${language:-}" ]; then language=en ynh_app_setting_set --app=$app --key=language --value=$language fi From a9ffa6e18edb597dc28d743e379feb12a0370ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 12:23:35 +0200 Subject: [PATCH 22/53] fix --- scripts/backup | 8 ++++++++ scripts/install | 16 +++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/scripts/backup b/scripts/backup index b96008b..1ef93f8 100644 --- a/scripts/backup +++ b/scripts/backup @@ -33,6 +33,14 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +#================================================= +# SPECIFIC BACKUP +#================================================= +# BACKUP LOGROTATE +#================================================= + +ynh_backup --src_path="/etc/logrotate.d/$app" + #================================================= # BACKUP VARIOUS FILES #================================================= diff --git a/scripts/install b/scripts/install index 551593a..dc69de6 100644 --- a/scripts/install +++ b/scripts/install @@ -49,6 +49,13 @@ ynh_add_nginx_config # Create a dedicated PHP-FPM configy ynh_add_fpm_config --usage=low --footprint=low +# Use logrotate to manage application logfile(s) +ynh_use_logrotate + +ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" +chown root: "/etc/cron.d/$app" +chmod 644 "/etc/cron.d/$app" + #================================================= # ADD A CONFIGURATION #================================================= @@ -61,15 +68,6 @@ ynh_add_config --template="../conf/addon.config.php" --destination="$install_dir mkdir -p "$install_dir/view/smarty3" chmod -R 775 "$install_dir/view/smarty3" -#================================================= -# SETUP A CRON -#================================================= -ynh_script_progression --message="Setting up the cron job..." --weight=1 - -ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" -chown root: "/etc/cron.d/$app" -chmod 644 "/etc/cron.d/$app" - #================================================= # INSTALL FRIENDICA #================================================= From 8bb3c37b282e83a260d1cc9cb5cbc2bf96923e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 12:29:54 +0200 Subject: [PATCH 23/53] fix --- scripts/install | 3 --- scripts/upgrade | 10 ---------- 2 files changed, 13 deletions(-) diff --git a/scripts/install b/scripts/install index 538355e..d0e68a5 100644 --- a/scripts/install +++ b/scripts/install @@ -32,9 +32,6 @@ ynh_script_progression --message="Setting up source files..." --weight=5 ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir/addon" --source_id="addons" -# Copy .htaccess-dist to ..htaccess -cp -f "$install_dir/.htaccess-dist" "$install_dir/.htaccess" - chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" diff --git a/scripts/upgrade b/scripts/upgrade index 9534a31..9081a67 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -34,16 +34,6 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=3 -# Remove files for upgrade compatibilty from previous versions of Friendica -if [ -f $install_dir/.htconfig.php ]; then - ynh_secure_remove "$install_dir/.htconfig.php" -fi - -# Remove files for upgrade compatibilty from previous versions of Friendica -if [ -f $install_dir/.htconfig.php ]; then - ynh_secure_remove "$install_dir/.htconfig.php" -fi - if [ -f "/etc/cron.d/$app" ]; then ynh_secure_remove --file="/etc/cron.d/$app" fi From 747793ee7204750d0dbfc498a254c312f8b1126a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 12:34:53 +0200 Subject: [PATCH 24/53] fix --- scripts/install | 28 ++++++++++------------------ scripts/remove | 4 +++- scripts/restore | 7 +++++-- scripts/upgrade | 14 ++++++++------ 4 files changed, 26 insertions(+), 27 deletions(-) diff --git a/scripts/install b/scripts/install index d0e68a5..f247bf4 100644 --- a/scripts/install +++ b/scripts/install @@ -36,22 +36,26 @@ chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= -# NGINX CONFIGURATION +# SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 - -# Create a dedicated nginx config -ynh_add_nginx_config +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 # Create a dedicated PHP-FPM configy ynh_add_fpm_config --usage=low --footprint=low +# Create a dedicated nginx config +ynh_add_nginx_config + +# Create a dedicated systemd config ynh_add_systemd_config +yunohost service add $app --description="Friendica daemon" --log="/var/log/$app/$app.log" + # Use logrotate to manage application logfile(s) ynh_use_logrotate -yunohost service add $app --description="Friendica daemon" --log="/var/log/$app/$app.log" +# Create a dedicated Fail2Ban config +ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"\".*$" #================================================= # ADD A CONFIGURATION @@ -65,18 +69,6 @@ ynh_add_config --template="../conf/addon.config.php" --destination="$install_dir mkdir -p "$install_dir/view/smarty3" chmod -R 775 "$install_dir/view/smarty3" -#================================================= -# SETUP A CRON -#================================================= -ynh_script_progression --message="Setting up the cron job..." --weight=1 - -ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" -chown root: "/etc/cron.d/$app" -chmod 644 "/etc/cron.d/$app" - -# Create a dedicated Fail2Ban config -ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"\".*$" - #================================================= # INSTALL FRIENDICA #================================================= diff --git a/scripts/remove b/scripts/remove index 4f9c615..51eda02 100644 --- a/scripts/remove +++ b/scripts/remove @@ -32,10 +32,12 @@ ynh_remove_nginx_config ynh_remove_fpm_config # Remove the app-specific logrotate config -#ynh_remove_logrotate +ynh_remove_logrotate ynh_remove_fail2ban_config +ynh_secure_remove --file="/etc/cron.d/$app" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 8bfec05..7cdce78 100644 --- a/scripts/restore +++ b/scripts/restore @@ -17,7 +17,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" chmod -R 775 "$install_dir/view/smarty3" @@ -28,10 +27,12 @@ ynh_script_progression --message="Restoring the MySQL database..." --weight=1 ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql +#================================================= +# RESTORE SYSTEM CONFIGURATIONS #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Restoring PHP-FPM configuration..." --weight=1 +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" @@ -42,6 +43,8 @@ systemctl enable $app.service --quiet yunohost service add $app --description="Friendica daemon" --log="/var/log/$app/$app.log" +ynh_restore_file --origin_path="/etc/logrotate.d/$app" + ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" ynh_systemd_action --action=restart --service_name=fail2ban diff --git a/scripts/upgrade b/scripts/upgrade index 9081a67..dfd5c6c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -68,9 +68,9 @@ chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= -# NGINX CONFIGURATION +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config @@ -78,13 +78,15 @@ ynh_add_nginx_config # Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low -# Create a dedicated Fail2Ban config -ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"\".*$" - ynh_add_systemd_config yunohost service add $app --description="Friendica daemon" --log="/var/log/$app/$app.log" +ynh_use_logrotate --non-append + +# Create a dedicated Fail2Ban config +ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"\".*$" + #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= @@ -92,7 +94,7 @@ yunohost service add $app --description="Friendica daemon" --log="/var/log/$app/ # Run Composer pushd "$install_dir" ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet - ynh_exec_as "$app" bin/console dbstructure update + ynh_exec_as "$app" php$phpversion bin/console dbstructure update #ynh_exec_as "$app" bin/console config system addon ldapauth popd From f6991ab81c23014dd5bb378d1f66103cf1fc5687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 12:35:17 +0200 Subject: [PATCH 25/53] Update tests.toml --- tests.toml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests.toml b/tests.toml index 91daf17..1e929c7 100644 --- a/tests.toml +++ b/tests.toml @@ -2,6 +2,8 @@ test_format = 1.0 [default] - # ------------ - # Tests to run - # ------------ \ No newline at end of file + # ------------------------------- + # Commits to test upgrade from + # ------------------------------- + + test_upgrade_from.00a1a6e7.name = "Upgrade from 5.4" \ No newline at end of file From da62a317bc38688857bf14df24608f82d173fadf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 12:35:47 +0200 Subject: [PATCH 26/53] Update tests.toml --- tests.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.toml b/tests.toml index 1e929c7..d83170e 100644 --- a/tests.toml +++ b/tests.toml @@ -6,4 +6,4 @@ test_format = 1.0 # Commits to test upgrade from # ------------------------------- - test_upgrade_from.00a1a6e7.name = "Upgrade from 5.4" \ No newline at end of file + test_upgrade_from.dc7cd3eabe212708375c0dcd4ee994a1373a8122.name = "Upgrade from 2023.01~ynh1" \ No newline at end of file From 1f28f2a2abcb79317fd54cef97cee2ecc4a1e5dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 12:44:17 +0200 Subject: [PATCH 27/53] Update backup --- scripts/backup | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/backup b/scripts/backup index 1601847..79a75bc 100644 --- a/scripts/backup +++ b/scripts/backup @@ -57,8 +57,12 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= ynh_print_info --message="Backing up the MySQL database..." +(cd $install_dir && ynh_exec_as "$app" php$phpversion bin/console maintenance 1) + ynh_mysql_dump_db --database="$db_name" > db.sql +(cd $install_dir && ynh_exec_as "$app" php$phpversion bin/console maintenance 0) + #================================================= # END OF SCRIPT #================================================= From 9eecf70ee8389c4bbc85004596d09dc311d54158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 13:12:12 +0200 Subject: [PATCH 28/53] Update backup --- scripts/backup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/backup b/scripts/backup index 79a75bc..63677f2 100644 --- a/scripts/backup +++ b/scripts/backup @@ -15,6 +15,8 @@ source /usr/share/yunohost/helpers #================================================= ynh_print_info --message="Declaring files to be backed up..." +(cd $install_dir && ynh_exec_as "$app" php$phpversion bin/console maintenance 1) + #================================================= # BACKUP THE APP MAIN DIR #================================================= @@ -57,8 +59,6 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= ynh_print_info --message="Backing up the MySQL database..." -(cd $install_dir && ynh_exec_as "$app" php$phpversion bin/console maintenance 1) - ynh_mysql_dump_db --database="$db_name" > db.sql (cd $install_dir && ynh_exec_as "$app" php$phpversion bin/console maintenance 0) From f6e17108f3bdb3cb3314204a635beb18a32e0727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 13:14:30 +0200 Subject: [PATCH 29/53] Update upgrade --- scripts/upgrade | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index dfd5c6c..741371f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -95,7 +95,6 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failreg pushd "$install_dir" ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet ynh_exec_as "$app" php$phpversion bin/console dbstructure update - #ynh_exec_as "$app" bin/console config system addon ldapauth popd #================================================= From 6d69b5eb96045f49c206fbdb9add400cdbd8ac31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 13:15:48 +0200 Subject: [PATCH 30/53] cleaning --- doc/ADMIN.md | 2 -- doc/ADMIN_fr.md | 2 -- 2 files changed, 4 deletions(-) diff --git a/doc/ADMIN.md b/doc/ADMIN.md index 79afe3e..902cc51 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -1,5 +1,3 @@ ## User with LDAP admin rights **For admin rights**: When installation is complete, you will need to visit your domain page and login with the **admin account username and password** which was entered at the time of installation process. You can then create your profile and access the admin panel. - - **For normal YunoHost users :** Normal LDAP users can login through Ldap authentication and create there profiles. diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index a212ff7..c7c9d79 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -1,5 +1,3 @@ ## Utilisateur avec des droits d'administrateur LDAP **Pour les droits d'administrateur** : une fois l'installation terminée, vous devrez visiter la page de votre domaine et vous connecter avec le **nom d'utilisateur et le mot de passe du compte administrateur** qui ont été saisis au moment du processus d'installation. Vous pouvez ensuite créer votre profil et accéder au panneau d'administration. - - **Pour les utilisateurs normaux de YunoHost :** Les utilisateurs LDAP normaux peuvent se connecter via l'authentification LDAP et y créer des profils. From 9154d4a55fa8a40ac30c0042eb53df4049d20419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 13:49:33 +0200 Subject: [PATCH 31/53] Update upgrade --- scripts/upgrade | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 741371f..4f313ee 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,13 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -timezone=$(cat /etc/timezone) - #================================================= # CHECK VERSION #================================================= @@ -38,18 +31,6 @@ if [ -f "/etc/cron.d/$app" ]; then ynh_secure_remove --file="/etc/cron.d/$app" fi -# If admin_mail setting doesn't exist, create it -if [ -z "${email:-}" ]; then - email=$(ynh_user_get_info --username=$admin --key=mail) - ynh_app_setting_set --app=$app --key=email --value=$email -fi - -# If language setting doesn't exist, create it -if [ -z "${language:-}" ]; then - language=en - ynh_app_setting_set --app=$app --key=language --value=$language -fi - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= From 57422eba2cd675e2c10dddf5f610db7a5d95f4e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 13:50:20 +0200 Subject: [PATCH 32/53] Update upgrade --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 4f313ee..1b86097 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -40,11 +40,11 @@ then ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" --keep ="config/local.config.php view/smarty3" + ynh_setup_source --dest_dir="$install_dir" --keep ="config/local.config.php " #view/smarty3 ynh_setup_source --dest_dir="$install_dir/addon" --source_id="addons" fi -chmod -R 775 "$install_dir/view/smarty3" +#chmod -R 775 "$install_dir/view/smarty3" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" From 7e2813cfb8399be8c4b648dbb97876f2cdd0f633 Mon Sep 17 00:00:00 2001 From: eric_G <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 13:52:42 +0200 Subject: [PATCH 33/53] Update scripts/upgrade Co-authored-by: Alexandre Aubin --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 1b86097..3f3494b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -40,7 +40,7 @@ then ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" --keep ="config/local.config.php " #view/smarty3 + ynh_setup_source --dest_dir="$install_dir" --keep="config/local.config.php" #view/smarty3 ynh_setup_source --dest_dir="$install_dir/addon" --source_id="addons" fi From f4422608a974c193eef8c1eeefc123d3b7382d19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 14:03:11 +0200 Subject: [PATCH 34/53] Update install --- scripts/install | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index f247bf4..a4c087b 100644 --- a/scripts/install +++ b/scripts/install @@ -32,6 +32,9 @@ ynh_script_progression --message="Setting up source files..." --weight=5 ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir/addon" --source_id="addons" +mkdir -p "$install_dir/view/smarty3" + +chmod -R 775 "$install_dir/view/smarty3" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" @@ -65,10 +68,6 @@ ynh_script_progression --message="Adding the LDAP Auth addon configuration file. # LDAP addon config ynh_add_config --template="../conf/addon.config.php" --destination="$install_dir/config/addon.config.php" -# 3 - some extra folders -mkdir -p "$install_dir/view/smarty3" -chmod -R 775 "$install_dir/view/smarty3" - #================================================= # INSTALL FRIENDICA #================================================= From 4d7d0a6f82e013c179296abd1ceb09792fec2364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 14:08:27 +0200 Subject: [PATCH 35/53] Update upgrade --- scripts/upgrade | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 3f3494b..fdd9d63 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -40,11 +40,10 @@ then ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" --keep="config/local.config.php" #view/smarty3 + ynh_setup_source --dest_dir="$install_dir" --keep="config/local.config.php" ynh_setup_source --dest_dir="$install_dir/addon" --source_id="addons" fi -#chmod -R 775 "$install_dir/view/smarty3" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" From 31baa17519712afc33a4675549bd98b5481ff866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 14:10:49 +0200 Subject: [PATCH 36/53] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 13c631c..1db03d5 100644 --- a/manifest.toml +++ b/manifest.toml @@ -66,7 +66,7 @@ ram.runtime = "50M" main.url = "/" [resources.apt] - packages = "mariadb-server php7.4-mbstring php7.4-json php7.4-imagick php7.4-xml php7.4-zip php7.4-mysql php7.4-gd php7.4-gmp" + packages = "mariadb-server php8.0-mbstring php8.0-json php8.0-imagick php8.0-xml php8.0-zip php8.0-mysql php8.0-gd php8.0-gmp" [resources.database] type = "mysql" From 79e3299d74add1140eaaae7cd087de4d2708db10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 16:12:06 +0200 Subject: [PATCH 37/53] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 1db03d5..13c631c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -66,7 +66,7 @@ ram.runtime = "50M" main.url = "/" [resources.apt] - packages = "mariadb-server php8.0-mbstring php8.0-json php8.0-imagick php8.0-xml php8.0-zip php8.0-mysql php8.0-gd php8.0-gmp" + packages = "mariadb-server php7.4-mbstring php7.4-json php7.4-imagick php7.4-xml php7.4-zip php7.4-mysql php7.4-gd php7.4-gmp" [resources.database] type = "mysql" From 8ae6a1377cff5a3a77bc0154f75c9c040c92a450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 16:31:44 +0200 Subject: [PATCH 38/53] Update manifest.toml --- manifest.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index 13c631c..60f6b1a 100644 --- a/manifest.toml +++ b/manifest.toml @@ -2,8 +2,8 @@ packaging_format = 2 id = "friendica" name = "Friendica" -description.en = "Social Communication Server" -description.fr = "Serveur de Communication Social" +description.en = "Decentralized Social Network" +description.fr = "Réseau social décentralisé" version = "2023.05~ynh2" From 8f69d3599f3f17e48347b9e2dbf8f66a535aa41e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 16:50:01 +0200 Subject: [PATCH 39/53] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 60f6b1a..72d57a9 100644 --- a/manifest.toml +++ b/manifest.toml @@ -66,7 +66,7 @@ ram.runtime = "50M" main.url = "/" [resources.apt] - packages = "mariadb-server php7.4-mbstring php7.4-json php7.4-imagick php7.4-xml php7.4-zip php7.4-mysql php7.4-gd php7.4-gmp" + packages = "mariadb-server php8.0-mbstring php8.0-json php8.0-imagick php8.0-xml php8.0-zip php8.0-mysql php8.0-gd php8.0-gmp" [resources.database] type = "mysql" From 605981ac33e98f14f909200461c6bc3850a80392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 17:00:57 +0200 Subject: [PATCH 40/53] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index a4c087b..eeaed0e 100644 --- a/scripts/install +++ b/scripts/install @@ -75,7 +75,7 @@ ynh_script_progression --message="Install Friendica..." --weight=1 pushd "$install_dir" # Import Composer dependencies - ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet + ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet --ignore-platform-reqs # Install application ynh_exec_as "$app" php$phpversion bin/console.php autoinstall\ From f203a1c262a1c8abf196549d55c2d7efaf1f0d61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 17:05:42 +0200 Subject: [PATCH 41/53] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 72d57a9..2413210 100644 --- a/manifest.toml +++ b/manifest.toml @@ -66,7 +66,7 @@ ram.runtime = "50M" main.url = "/" [resources.apt] - packages = "mariadb-server php8.0-mbstring php8.0-json php8.0-imagick php8.0-xml php8.0-zip php8.0-mysql php8.0-gd php8.0-gmp" + packages = "mariadb-server php8.0-curl php8.0-mbstring php8.0-json php8.0-imagick php8.0-xml php8.0-zip php8.0-mysql php8.0-gd php8.0-gmp" [resources.database] type = "mysql" From 5ae85298f929abec1e15f2d50c6a0dd98479e9b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 17:06:44 +0200 Subject: [PATCH 42/53] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index eeaed0e..7dfe437 100644 --- a/scripts/install +++ b/scripts/install @@ -75,7 +75,7 @@ ynh_script_progression --message="Install Friendica..." --weight=1 pushd "$install_dir" # Import Composer dependencies - ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet --ignore-platform-reqs + ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet #--ignore-platform-reqs # Install application ynh_exec_as "$app" php$phpversion bin/console.php autoinstall\ From 1e86132437b5fcd77805b7421a6b2cf6368b1e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 17:12:44 +0200 Subject: [PATCH 43/53] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 2413210..3110be4 100644 --- a/manifest.toml +++ b/manifest.toml @@ -66,7 +66,7 @@ ram.runtime = "50M" main.url = "/" [resources.apt] - packages = "mariadb-server php8.0-curl php8.0-mbstring php8.0-json php8.0-imagick php8.0-xml php8.0-zip php8.0-mysql php8.0-gd php8.0-gmp" + packages = "mariadb-server php8.2-curl php8.2-mbstringphp8.2-imagick php8.2-xml php8.2-zip php8.2-mysql php8.2-gd php8.2-gmp" [resources.database] type = "mysql" From 53b8b02eae2096611622c951d5a7727da4838149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 17:21:48 +0200 Subject: [PATCH 44/53] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 7dfe437..a4c087b 100644 --- a/scripts/install +++ b/scripts/install @@ -75,7 +75,7 @@ ynh_script_progression --message="Install Friendica..." --weight=1 pushd "$install_dir" # Import Composer dependencies - ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet #--ignore-platform-reqs + ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet # Install application ynh_exec_as "$app" php$phpversion bin/console.php autoinstall\ From 000a7d7b6c4cbd57f2c40fd83a71f7be87140dc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 17:47:32 +0200 Subject: [PATCH 45/53] fix --- conf/local-sample.config.php | 1 + conf/systemd.service | 2 +- manifest.toml | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/conf/local-sample.config.php b/conf/local-sample.config.php index 2e7d58a..76a2b63 100644 --- a/conf/local-sample.config.php +++ b/conf/local-sample.config.php @@ -40,5 +40,6 @@ return [ 'system' => [ 'default_timezone' => '__TIMEZONE__', 'language' => '__LANGUAGE__', + 'pidfile' => '/run/friendica/daemon.pid', ], ]; diff --git a/conf/systemd.service b/conf/systemd.service index d4ed749..6f7f3f8 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -4,10 +4,10 @@ After=network.target mariadb.service Requires=network.target remote-fs.target nss-lookup.target [Service] +Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ -Type=simple StandardOutput=null StandardError=syslog ExecStart=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/bin/daemon.php start diff --git a/manifest.toml b/manifest.toml index 3110be4..85ca75c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -66,7 +66,7 @@ ram.runtime = "50M" main.url = "/" [resources.apt] - packages = "mariadb-server php8.2-curl php8.2-mbstringphp8.2-imagick php8.2-xml php8.2-zip php8.2-mysql php8.2-gd php8.2-gmp" + packages = "mariadb-server php8.2-curl php8.2-mbstring php8.2-imagick php8.2-xml php8.2-zip php8.2-mysql php8.2-gd php8.2-gmp" [resources.database] type = "mysql" From da667bed58b8a29088cced2e74044af4c2b6c2f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 17:48:24 +0200 Subject: [PATCH 46/53] Update systemd.service --- conf/systemd.service | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 6f7f3f8..9f00342 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,8 +8,8 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ -StandardOutput=null -StandardError=syslog +StandardOutput=append:/var/log/__APP__/__APP__.log +StandardError=inherit ExecStart=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/bin/daemon.php start ExecStop=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/bin/daemon.php stop PIDFile=friendica/daemon.pid From f89528e81e3fecce225782cd637a57796f85b8ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:05:12 +0200 Subject: [PATCH 47/53] Update install --- scripts/install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index a4c087b..9a0e99b 100644 --- a/scripts/install +++ b/scripts/install @@ -38,6 +38,8 @@ chmod -R 775 "$install_dir/view/smarty3" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" +echo "d /run/friendica 0755 www-data www-data -" > /etc/tmpfiles.d/friendica.conf + #================================================= # SYSTEM CONFIGURATION #================================================= From 216bf4bcd566154468b0941ebe2e7c20d01323ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:25:03 +0200 Subject: [PATCH 48/53] Update local-sample.config.php --- conf/local-sample.config.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/conf/local-sample.config.php b/conf/local-sample.config.php index 76a2b63..67c610a 100644 --- a/conf/local-sample.config.php +++ b/conf/local-sample.config.php @@ -32,14 +32,17 @@ return [ // **************************************************************** 'config' => [ + 'php_path' => '/usr/bin/php' 'admin_email' => '__EMAIL__', 'sitename' => 'Friendica Social Network', 'register_policy' => \Friendica\Module\Register::OPEN, - 'register_text' => '', + 'max_import_size' => 200000, ], 'system' => [ + 'url' => 'https://__DOMAIN__', + 'basepath' => '__INSTALL_DIR__' + 'pidfile' => '/run/friendica/daemon.pid', 'default_timezone' => '__TIMEZONE__', 'language' => '__LANGUAGE__', - 'pidfile' => '/run/friendica/daemon.pid', ], ]; From 3d502630631aa74b67330026d8248a2674d57a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:25:48 +0200 Subject: [PATCH 49/53] Update install --- scripts/install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 9a0e99b..0bb6fc3 100644 --- a/scripts/install +++ b/scripts/install @@ -80,9 +80,9 @@ pushd "$install_dir" ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet # Install application - ynh_exec_as "$app" php$phpversion bin/console.php autoinstall\ - --dbhost "localhost" --dbdata "$db_name" --dbuser "$db_user" --dbpass "$db_pwd"\ - --admin "$email" --tz "$timezone" --lang "$language" --url "https://$domain$path" + #ynh_exec_as "$app" php$phpversion bin/console.php autoinstall\ + # --dbhost "localhost" --dbdata "$db_name" --dbuser "$db_user" --dbpass "$db_pwd"\ + # --admin "$email" --tz "$timezone" --lang "$language" --url "https://$domain$path" # Enable LDAP Auth addon ynh_exec_as "$app" php$phpversion bin/console.php addon enable ldapauth From 1f84ec8c899f05e81a70b02f1c22f08540769b33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:30:41 +0200 Subject: [PATCH 50/53] Update install --- scripts/install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index 0bb6fc3..b51f841 100644 --- a/scripts/install +++ b/scripts/install @@ -76,6 +76,7 @@ ynh_add_config --template="../conf/addon.config.php" --destination="$install_dir ynh_script_progression --message="Install Friendica..." --weight=1 pushd "$install_dir" + ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < "$install_dir/database.sql" # Import Composer dependencies ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet @@ -86,6 +87,7 @@ pushd "$install_dir" # Enable LDAP Auth addon ynh_exec_as "$app" php$phpversion bin/console.php addon enable ldapauth + popd #================================================= From f428e044808dfc1fc61ef7b3a4ffe570179d6529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:33:00 +0200 Subject: [PATCH 51/53] Update install --- scripts/install | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index b51f841..16d88ad 100644 --- a/scripts/install +++ b/scripts/install @@ -76,14 +76,13 @@ ynh_add_config --template="../conf/addon.config.php" --destination="$install_dir ynh_script_progression --message="Install Friendica..." --weight=1 pushd "$install_dir" - ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < "$install_dir/database.sql" # Import Composer dependencies ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet # Install application - #ynh_exec_as "$app" php$phpversion bin/console.php autoinstall\ - # --dbhost "localhost" --dbdata "$db_name" --dbuser "$db_user" --dbpass "$db_pwd"\ - # --admin "$email" --tz "$timezone" --lang "$language" --url "https://$domain$path" + ynh_exec_as "$app" php$phpversion bin/console.php autoinstall\ + --dbhost "localhost" --dbdata "$db_name" --dbuser "$db_user" --dbpass "$db_pwd"\ + --admin "$email" --tz "$timezone" --lang "$language" --url "https://$domain$path" # Enable LDAP Auth addon ynh_exec_as "$app" php$phpversion bin/console.php addon enable ldapauth From 105a7b020f8dc0e8752dea5b99476b19daf7b255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:39:17 +0200 Subject: [PATCH 52/53] fix --- conf/cron | 2 ++ conf/systemd.service | 22 ---------------------- scripts/backup | 2 +- scripts/install | 14 +++----------- scripts/remove | 9 --------- scripts/restore | 8 ++------ 6 files changed, 8 insertions(+), 49 deletions(-) create mode 100644 conf/cron delete mode 100644 conf/systemd.service diff --git a/conf/cron b/conf/cron new file mode 100644 index 0000000..e7e5fd1 --- /dev/null +++ b/conf/cron @@ -0,0 +1,2 @@ +# Run poller periodically to update Friendica +*/10 * * * * __APP__ /usr/bin/php__PHPVERSION__ -f __INSTALL_DIR__/bin/worker.php \ No newline at end of file diff --git a/conf/systemd.service b/conf/systemd.service deleted file mode 100644 index 9f00342..0000000 --- a/conf/systemd.service +++ /dev/null @@ -1,22 +0,0 @@ -[Unit] -Description=Friendica daemon -After=network.target mariadb.service -Requires=network.target remote-fs.target nss-lookup.target - -[Service] -Type=simple -User=__APP__ -Group=__APP__ -WorkingDirectory=__INSTALL_DIR__/ -StandardOutput=append:/var/log/__APP__/__APP__.log -StandardError=inherit -ExecStart=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/bin/daemon.php start -ExecStop=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/bin/daemon.php stop -PIDFile=friendica/daemon.pid -PrivateTmp=true -InaccessibleDirectories=/home /root /boot /opt /mnt /media -ReadOnlyDirectories=/etc /usr -Restart=always - -[Install] -WantedBy=multi-user.target \ No newline at end of file diff --git a/scripts/backup b/scripts/backup index 63677f2..8dce025 100644 --- a/scripts/backup +++ b/scripts/backup @@ -52,7 +52,7 @@ ynh_backup --src_path="/etc/logrotate.d/$app" # BACKUP VARIOUS FILES #================================================= -ynh_backup --src_path="/etc/systemd/system/$app.service" +ynh_backup --src_path="/etc/cron.d/$app" #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/install b/scripts/install index 16d88ad..4b819e2 100644 --- a/scripts/install +++ b/scripts/install @@ -51,10 +51,9 @@ ynh_add_fpm_config --usage=low --footprint=low # Create a dedicated nginx config ynh_add_nginx_config -# Create a dedicated systemd config -ynh_add_systemd_config - -yunohost service add $app --description="Friendica daemon" --log="/var/log/$app/$app.log" +ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" +chown root: "/etc/cron.d/$app" +chmod 644 "/etc/cron.d/$app" # Use logrotate to manage application logfile(s) ynh_use_logrotate @@ -89,13 +88,6 @@ pushd "$install_dir" popd -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 51eda02..6f01b8e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -16,15 +16,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 -# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status $app >/dev/null -then - ynh_script_progression --message="Removing $app service integration..." --weight=1 - yunohost service remove $app -fi - -ynh_remove_systemd_config - # Remove the dedicated nginx config ynh_remove_nginx_config diff --git a/scripts/restore b/scripts/restore index 7cdce78..648fa0a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -38,17 +38,14 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable $app.service --quiet - -yunohost service add $app --description="Friendica daemon" --log="/var/log/$app/$app.log" - ynh_restore_file --origin_path="/etc/logrotate.d/$app" ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" ynh_systemd_action --action=restart --service_name=fail2ban +ynh_restore_file --origin_path="/etc/cron.d/$app" + #================================================= # GENERIC FINALIZATION #================================================= @@ -56,7 +53,6 @@ ynh_systemd_action --action=restart --service_name=fail2ban #================================================= ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload From d684c992a4840d52dd0e6f9b4d4330d7fa8f2d6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:40:35 +0200 Subject: [PATCH 53/53] fix --- scripts/install | 2 -- scripts/upgrade | 11 ----------- 2 files changed, 13 deletions(-) diff --git a/scripts/install b/scripts/install index 4b819e2..95d3517 100644 --- a/scripts/install +++ b/scripts/install @@ -38,8 +38,6 @@ chmod -R 775 "$install_dir/view/smarty3" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -echo "d /run/friendica 0755 www-data www-data -" > /etc/tmpfiles.d/friendica.conf - #================================================= # SYSTEM CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index fdd9d63..d5acece 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -58,10 +58,6 @@ ynh_add_nginx_config # Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low -ynh_add_systemd_config - -yunohost service add $app --description="Friendica daemon" --log="/var/log/$app/$app.log" - ynh_use_logrotate --non-append # Create a dedicated Fail2Ban config @@ -77,13 +73,6 @@ pushd "$install_dir" ynh_exec_as "$app" php$phpversion bin/console dbstructure update popd -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - #================================================= # END OF SCRIPT #=================================================