From e135f999cecff1ab2bf96202d750af5a4e07fc93 Mon Sep 17 00:00:00 2001 From: anmol Date: Sat, 16 Feb 2019 17:10:20 +0530 Subject: [PATCH 1/9] Updated to version 2019.01 --- README.md | 2 +- conf/addons.src | 4 ++-- conf/app.src | 6 +++--- manifest.json | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5c95c50..d21cb71 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [Friendica](http://friendi.ca/) integration for YunoHost
-**Version:2018.09**

+**Version:2019.01**

Current snapshot in *sources*: diff --git a/conf/addons.src b/conf/addons.src index 75ded5f..5c08c63 100644 --- a/conf/addons.src +++ b/conf/addons.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/friendica/friendica-addons/archive/2018.09.zip -SOURCE_SUM=4862f5d8fb46375ea0232ab3bf6c012153371e51d6d1505bc25a696a7aefc82a +SOURCE_URL=https://github.com/friendica/friendica-addons/archive/2019.01.zip +SOURCE_SUM=23edfeddf58de1f605f8cb71603fbb31f415641b76f09a102e4bdb2ec78d508d SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true diff --git a/conf/app.src b/conf/app.src index c922317..49cb14b 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://github.com/friendica/friendica/archive/2018.09.zip -SOURCE_SUM=02407b87da8d645faaa88429970617231d71bb7611ebe2770f5cca5c54e60e2e +SOURCE_URL=https://github.com/friendica/friendica/releases/download/2019.01/friendica-full-2019.01.tar.bz2 +SOURCE_SUM=f56f9f9e8de4380d10ec625d253bf346be3143011ce693d9e0f9f26ed05b0bacf SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=zip +SOURCE_FORMAT=tar.bz2 SOURCE_IN_SUBDIR=true SOURCE_FILENAME= diff --git a/manifest.json b/manifest.json index 53cac86..9e5edf2 100644 --- a/manifest.json +++ b/manifest.json @@ -8,7 +8,7 @@ }, "url": "http://friendi.ca", "license": "free", - "version": "2018.09", + "version": "2019.01", "maintainer": { "name": "Anmol Sharma", "email": "anmol@datamol.org" From 179b814e24c82e6f0f6d0b8f80e5f846df6b4330 Mon Sep 17 00:00:00 2001 From: anmol Date: Sat, 16 Feb 2019 17:27:12 +0530 Subject: [PATCH 2/9] Updated to version 2019.01 --- conf/app.src | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/app.src b/conf/app.src index 49cb14b..adee030 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://github.com/friendica/friendica/releases/download/2019.01/friendica-full-2019.01.tar.bz2 -SOURCE_SUM=f56f9f9e8de4380d10ec625d253bf346be3143011ce693d9e0f9f26ed05b0bacf +SOURCE_URL=https://github.com/friendica/friendica/archive/2019.01.zip +SOURCE_SUM=f79e9de1f641ba2a6b42166cb2c190871544c4dee755ed307743fe8744f98987 SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.bz2 +SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true SOURCE_FILENAME= From 5d2b40e857cf4d165c69a2712398d48a4376b827 Mon Sep 17 00:00:00 2001 From: anmol Date: Fri, 8 Mar 2019 14:33:52 +0530 Subject: [PATCH 3/9] Updared to version 2019.01 --- conf/app.src | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/app.src b/conf/app.src index adee030..c8b5fb7 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://github.com/friendica/friendica/archive/2019.01.zip -SOURCE_SUM=f79e9de1f641ba2a6b42166cb2c190871544c4dee755ed307743fe8744f98987 +SOURCE_URL=https://friendi.ca/wp-content/uploads/2019/02/friendica-full-2019.01.tar.gz +SOURCE_SUM=895025c0adf042b6139ed3e7c4674a49d3a0237ce3490a367be681e6310c92a3 SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=zip +SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true SOURCE_FILENAME= From 6e354edc75260bebcd5cce7dc3512ae7f4ce3698 Mon Sep 17 00:00:00 2001 From: anmol Date: Mon, 11 Mar 2019 23:54:16 +0530 Subject: [PATCH 4/9] Fix install script --- scripts/install | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/install b/scripts/install index c4cf0a0..060c1f5 100644 --- a/scripts/install +++ b/scripts/install @@ -104,13 +104,13 @@ ynh_add_nginx_config # configure friendica -sudo cp -f "/var/www/$app/config/local-sample.ini.php" "/var/www/$app/config/local.ini.php" -ynh_replace_string "your.mysqlhost.com" "localhost" "$final_path/config/local.ini.php" -ynh_replace_string "mysqlusername" "$db_name" "$final_path/config/local.ini.php" -ynh_replace_string "mysqldatabasename" "$db_name" "$final_path/config/local.ini.php" -ynh_replace_string "mysqlpassword" "$db_pwd" "$final_path/config/local.ini.php" -ynh_replace_string "admin_email =" "admin_email = $admin_mail" "$final_path/config/local.ini.php" -ynh_replace_string "register_policy = REGISTER_OPEN" "register_policy = REGISTER_CLOSED" "$final_path/config/local.ini.php" +sudo cp -f "/var/www/$app/config/local-sample.config.php" "/var/www/$app/config/local.config.php" +ynh_replace_string "your.mysqlhost.com" "localhost" "$final_path/config/local.config.php" +ynh_replace_string "mysqlusername" "$db_name" "$final_path/config/local.config.php" +ynh_replace_string "mysqldatabasename" "$db_name" "$final_path/config/local.config.php" +ynh_replace_string "mysqlpassword" "$db_pwd" "$final_path/config/local.config.php" +ynh_replace_string "'admin_email' => ''," "'admin_email' => '$admin_mail'," "$final_path/config/local.config.php" +ynh_replace_string "REGISTER_OPEN" "REGISTER_CLOSED" "$final_path/config/local.config.php" # init db From 8107638297f0a828bed85b29ad71432511fd8670 Mon Sep 17 00:00:00 2001 From: anmol Date: Tue, 12 Mar 2019 00:33:01 +0530 Subject: [PATCH 5/9] Fix install script --- conf/addon.config.php | 11 +++++++++++ conf/addon.ini.php | 21 --------------------- scripts/install | 4 ++-- 3 files changed, 13 insertions(+), 23 deletions(-) create mode 100644 conf/addon.config.php delete mode 100644 conf/addon.ini.php diff --git a/conf/addon.config.php b/conf/addon.config.php new file mode 100644 index 0000000..c2800ff --- /dev/null +++ b/conf/addon.config.php @@ -0,0 +1,11 @@ + [ + 'ldap_server' => 'localhost', + 'ldap_searchdn' => 'ou=users,dc=yunohost,dc=org', + 'ldap_userattr' => 'uid', + 'ldap_autocreateaccount_emailattribute' => 'mail', + ], +]; diff --git a/conf/addon.ini.php b/conf/addon.ini.php deleted file mode 100644 index 8098cb6..0000000 --- a/conf/addon.ini.php +++ /dev/null @@ -1,21 +0,0 @@ - Date: Tue, 12 Mar 2019 01:44:21 +0530 Subject: [PATCH 6/9] Fix install script --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 4ac439b..239d7c4 100644 --- a/scripts/install +++ b/scripts/install @@ -155,6 +155,7 @@ ynh_store_file_checksum "$final_path/config/local.config.php" # Run composer (cd $final_path && sudo php bin/composer.phar install) +(cd $final_path && sudo bin/console config system addon ldapauth) chown -R $app: $final_path From cf900ac40f4ff8a864035a3d7f21debd8c489022 Mon Sep 17 00:00:00 2001 From: anmol Date: Tue, 12 Mar 2019 16:07:22 +0530 Subject: [PATCH 7/9] Fixed app according to the latest release --- check_process | 6 ++-- scripts/backup | 25 ++++++++++++----- scripts/install | 61 ++++++++++++++++++++++++++++++++++------ scripts/remove | 13 +++++++++ scripts/restore | 45 +++++++++++++++++++++-------- scripts/upgrade | 75 +++++++++++++++++++++++++++++++++++++------------ 6 files changed, 176 insertions(+), 49 deletions(-) diff --git a/check_process b/check_process index f6c3cc5..29c8259 100644 --- a/check_process +++ b/check_process @@ -1,5 +1,4 @@ -;; Default test - auto_remove=1 +;; Test complet ; Manifest domain="domain.tld" (DOMAIN) admin="john" (USER) @@ -11,18 +10,19 @@ setup_private=0 setup_public=1 upgrade=1 + upgrade=0 from_commit=CommitHash backup_restore=1 multi_instance=1 incorrect_path=1 port_already_use=0 change_url=0 + ;;; Levels Level 1=auto Level 2=auto Level 3=auto # There is LDAP support for the app Level 4=1 - # Level 5: Level 5=auto Level 6=auto Level 7=auto diff --git a/scripts/backup b/scripts/backup index 392665c..6dda7b0 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,24 +6,25 @@ # IMPORT GENERIC HELPERS #================================================= -if [ ! -e _common.sh ]; then - # Get the _common.sh file if it's not in the current directory - cp ../settings/scripts/_common.sh ./_common.sh - chmod a+rx _common.sh -fi -source _common.sh +#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= +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 #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -37,24 +38,34 @@ db_pwd=$(ynh_app_setting_get $app mysqlpwd) #================================================= # BACKUP THE APP MAIN DIR #================================================= +ynh_print_info "Backing up the main app directory..." ynh_backup "$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= +ynh_print_info "Backing up nginx web server configuration..." ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE PHP-FPM CONFIGURATION #================================================= - +ynh_print_info "Backing up php-fpm configuration..." ynh_backup "/etc/php5/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE #================================================= +ynh_print_info "Backing up the MySQL database..." ynh_mysql_dump_db "$db_name" > db.sql # Backup cron job ynh_backup "/etc/cron.d/$app" + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Backup script completed for $app. (YunoHost will now copy those files to the archive)." + diff --git a/scripts/install b/scripts/install index 239d7c4..472b7e6 100644 --- a/scripts/install +++ b/scripts/install @@ -13,6 +13,10 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +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 @@ -44,21 +48,23 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= +ynh_print_info "Validating installation parameters..." # Normalize the url path syntax path_url=$(ynh_normalize_url_path $path_url) -# Check web path availability -ynh_webpath_available $domain $path_url # Register (book) web path ynh_webpath_register $app $domain $path_url +### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". +### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app" final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" #================================================= # STORE SETTINGS FROM MANIFEST #================================================= +ynh_print_info "Storing installation settings..." ynh_app_setting_set $app domain $domain ynh_app_setting_set $app path $path_url @@ -70,13 +76,21 @@ ynh_app_setting_set $app database $database #================================================= # INSTALL DEPENDENCIES #================================================= +ynh_print_info "Installing dependencies..." ynh_install_app_dependencies 'php-mbstring|base-files(<<9.0)' php5-cli 'php5-imagick|php-imagick' php5-gd php5-mcrypt 'php-xml|base-files(<<9.0)' #================================================= # CREATE A MYSQL DATABASE #================================================= -# If your app uses a MySQL database, you can use these lines to bootstrap -# a database, an associated user and save the password in app settings +ynh_print_info "Creating a MySQL database..." +### Use these lines if you need a database for the application. +### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password. +### The password will be stored as 'mysqlpwd' into the app settings, +### and will be available as $db_pwd +### If you're not using these lines: +### - Remove the section "BACKUP THE MYSQL DATABASE" in the backup script +### - Remove also the section "REMOVE THE MYSQL DATABASE" in the remove script +### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script db_name=$(ynh_sanitize_dbid $app) ynh_app_setting_set $app db_name $db_name @@ -85,6 +99,11 @@ ynh_mysql_setup_db $db_name $db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_print_info "Setting up source files..." + +### `ynh_setup_source` is used to install an app from a zip or tar.gz file, +### downloaded from an upstream source, like a git repository. +### `ynh_setup_source` use the file conf/app.src ynh_app_setting_set $app final_path $final_path # Download, check integrity, uncompress and patch the source from app.src @@ -98,6 +117,9 @@ ynh_setup_source "$final_path/addon" "addons" #================================================= # NGINX CONFIGURATION #================================================= +ynh_print_info "Configuring nginx web server..." + +### `ynh_add_nginx_config` will use the file conf/nginx.conf # Create a dedicated nginx config ynh_add_nginx_config @@ -122,6 +144,7 @@ sudo cp "../conf/addon.config.php" "$final_path/config/." #================================================= # CREATE DEDICATED USER #================================================= +ynh_print_info "Configuring system user..." # Create a system user ynh_system_user_create $app @@ -129,12 +152,22 @@ ynh_system_user_create $app #================================================= # PHP-FPM CONFIGURATION #================================================= +ynh_print_info "Configuring php-fpm..." +### `ynh_add_fpm_config` is used to set up a PHP config. +### You can remove it if your app doesn't use PHP. +### `ynh_add_fpm_config` will use the files conf/php-fpm.conf and conf/php-fpm.ini +### If you're not using these lines: +### - You can remove these files in conf/. +### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script +### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script +### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script +### With the reload at the end of the script. +### - And the section "PHP-FPM CONFIGURATION" in the upgrade script # Create a dedicated php-fpm config ynh_add_fpm_config -# set permission sudo chown -R www-data:www-data $final_path # 3 - some extra folders @@ -147,9 +180,13 @@ ynh_replace_string "__USER__" "$app" ../conf/poller-cron sudo cp ../conf/poller-cron /etc/cron.d/$app #================================================= -# STORE THE CHECKSUM OF THE CONFIG FILE +# STORE THE CONFIG FILE CHECKSUM #================================================= +### `ynh_store_file_checksum` is used to store the checksum of a file. +### That way, during the upgrade script, by using `ynh_backup_if_checksum_is_different`, +### you can make a backup of this file before modifying it again if the admin had modified it. + # Calculate and store the config file checksum into the app settings ynh_store_file_checksum "$final_path/config/local.config.php" @@ -171,6 +208,12 @@ ynh_app_setting_set $app unprotected_uris "/" #================================================= # RELOAD NGINX #================================================= -sudo systemctl reload php5-fpm -sudo systemctl reload nginx -sudo yunohost app ssowatconf +ynh_print_info "Reloading nginx web server..." + +systemctl reload nginx + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 00c966e..365c59e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -21,6 +22,7 @@ db_name=$(ynh_app_setting_get $app db_name) #================================================= # REMOVE DEPENDENCIES #================================================= +ynh_print_info "Removing dependencies" # Remove metapackage and its dependencies ynh_remove_app_dependencies @@ -28,6 +30,7 @@ ynh_remove_app_dependencies #================================================= # REMOVE THE MYSQL DATABASE #================================================= +ynh_print_info "Removing the MySQL database" # Remove a database if it exists, along with the associated user ynh_mysql_remove_db $db_name $db_name @@ -35,6 +38,7 @@ ynh_mysql_remove_db $db_name $db_name #================================================= # REMOVE APP MAIN DIR #================================================= +ynh_print_info "Removing app main directory" # Remove the app directory securely ynh_secure_remove "/var/www/$app" @@ -42,6 +46,7 @@ ynh_secure_remove "/var/www/$app" #================================================= # REMOVE NGINX CONFIGURATION #================================================= +ynh_print_info "Removing nginx web server configuration" # Remove the dedicated nginx config ynh_remove_nginx_config @@ -49,6 +54,7 @@ ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= +ynh_print_info "Removing php-fpm configuration" # Remove the dedicated php-fpm config ynh_remove_fpm_config @@ -61,6 +67,13 @@ ynh_secure_remove "/etc/cron.d/$app" #================================================= # REMOVE DEDICATED USER #================================================= +ynh_print_info "Removing the dedicated system user" # Delete a system user ynh_system_user_delete $app + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index cd74c85..fb0e695 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,25 +6,28 @@ # IMPORT GENERIC HELPERS #================================================= -if [ ! -e _common.sh ]; then - # Get the _common.sh file if it's not in the current directory - cp ../settings/scripts/_common.sh ./_common.sh - chmod a+rx _common.sh -fi -source _common.sh +#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= +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 + #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading settings..." + app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) @@ -36,7 +39,9 @@ db_name=$(ynh_app_setting_get $app db_name) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \ +ynh_print_info "Validating restoration parameters..." + +ynh_webpath_available $domain $path_url \ || ynh_die "Path not available: ${domain}${path_url}" test ! -d $final_path \ || ynh_die "There is already a directory: $final_path " @@ -63,6 +68,7 @@ ynh_restore_file "$final_path" #================================================= # RECREATE THE DEDICATED USER #================================================= +ynh_print_info "Recreating the dedicated system user..." # Create the dedicated user (if not existing) ynh_system_user_create $app @@ -71,13 +77,14 @@ ynh_system_user_create $app # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf" +ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # SPECIFIC RESTORATION #================================================= # REINSTALL DEPENDENCIES #================================================= +ynh_print_info "Reinstalling dependencies..." ynh_install_app_dependencies 'php-mbstring|base-files(<<9.0)' php5-cli 'php5-imagick|php-imagick' php5-gd php5-mcrypt 'php-xml|base-files(<<9.0)' @@ -92,11 +99,25 @@ ynh_restore_file "/etc/cron.d/$app" # Run composer (cd $final_path && sudo php bin/composer.phar install) +(cd $final_path && sudo bin/console config system addon ldapauth) + +chown -R $app: $final_path # unprotected_uris allows SSO credentials to be passed anyway. ynh_app_setting_set $app unprotected_uris "/" -# And Reload services -sudo service php5-fpm reload -sudo service nginx reload -sudo yunohost app ssowatconf +#================================================= +# GENERIC FINALIZATION +#================================================= +# RELOAD NGINX AND PHP-FPM +#================================================= +ynh_print_info "Reloading nginx web server and php-fpm..." + +systemctl reload php7.0-fpm +systemctl reload nginx + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index b8c9a98..fee62b0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -23,9 +24,21 @@ db_pwd=$(ynh_app_setting_get $app mysqlpwd) admin_mail=$(ynh_app_setting_get $app email) admin=$(ynh_app_setting_get $app admin) +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_print_info "Ensuring downward compatibility..." + +# If db_name doesn't exist, create it +if [ -z $db_name ]; then + db_name=$(ynh_sanitize_dbid $app) + ynh_app_setting_set $app db_name $db_name +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= +ynh_print_info "Backing up the app before upgrading (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade @@ -52,11 +65,19 @@ if [ -z $final_path ]; then final_path=/var/www/$app ynh_app_setting_set $app final_path $final_path fi + +# Remove files for upgrade compatibilty from previous versions of Friendica if [ -f $final_path/.htconfig.php ]; then rm "$final_path/.htconfig.php" fi -if [ -z $admin_mail ]; then # If admin_mail setting doesn't exist +if [ -f $final_path/.htconfig.php ]; then + rm "$final_path/config/local.ini.php" +fi + + +# If admin_mail setting doesn't exist, create it +if [ -z $admin_mail ]; then admin_mail=$(sudo yunohost user info $admin | grep "mail:" | cut -d' ' -f2) ynh_app_setting_set $app email $admin_mail fi @@ -65,15 +86,15 @@ fi ynh_setup_source "$final_path" # Copy config file for correct place -cp -f "/var/www/$app/config/local-sample.ini.php" "/var/www/$app/config/local.ini.php" +cp -f "/var/www/$app/config/local-sample.config.php" "/var/www/$app/config/local.config.php" # Replace strings in config file -ynh_replace_string "your.mysqlhost.com" "localhost" "$final_path/config/local.ini.php" -ynh_replace_string "mysqlusername" "$db_name" "$final_path/config/local.ini.php" -ynh_replace_string "mysqldatabasename" "$db_name" "$final_path/config/local.ini.php" -ynh_replace_string "mysqlpassword" "$db_pwd" "$final_path/config/local.ini.php" -ynh_replace_string "admin_email =" "admin_email = $admin_mail" "$final_path/config/local.ini.php" -ynh_replace_string "register_policy = REGISTER_OPEN" "register_policy = REGISTER_CLOSED" "$final_path/config/local.ini.php" +ynh_replace_string "your.mysqlhost.com" "localhost" "$final_path/config/local.config.php" +ynh_replace_string "mysqlusername" "$db_name" "$final_path/config/local.config.php" +ynh_replace_string "mysqldatabasename" "$db_name" "$final_path/config/local.config.php" +ynh_replace_string "mysqlpassword" "$db_pwd" "$final_path/config/local.config.php" +ynh_replace_string "'admin_email' => ''," "'admin_email' => '$admin_mail'," "$final_path/config/local.config.php" +ynh_replace_string "REGISTER_OPEN" "REGISTER_CLOSED" "$final_path/config/local.config.php" #Copy Addons @@ -86,24 +107,33 @@ sudo chmod -R 775 $final_path/view/smarty3 #================================================= # CREATE DEDICATED USER #================================================= +ynh_print_info "Making sure dedicated system user exists..." -# Create a system user +# Create a dedicated user (if not existing) ynh_system_user_create $app +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_print_info "Upgrading nginx web server configuration..." + # Create a dedicated nginx config ynh_add_nginx_config #================================================= # PHP-FPM CONFIGURATION #================================================= +ynh_print_info "Upgrading php-fpm configuration..." # Create a dedicated php-fpm config ynh_add_fpm_config -# Verify the checksum and backup the file if it's different -ynh_backup_if_checksum_is_different "$final_path/config/local.ini.php" -# Recalculate and store the config file checksum into the app settings -ynh_store_file_checksum "$final_path/config/local.ini.php" + +### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. +### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. +ynh_backup_if_checksum_is_different "$final_path/local.config.php" +# Recalculate and store the checksum of the file for the next upgrade. +ynh_store_file_checksum "$final_path/local.config.php" # Set up cron job ynh_replace_string "__YNH_WWW_PATH__" "$final_path" ../conf/poller-cron @@ -112,6 +142,7 @@ sudo cp ../conf/poller-cron /etc/cron.d/$app # Run composer (cd $final_path && sudo php bin/composer.phar install) +(cd $final_path && sudo bin/console config system addon ldapauth) # Set app as owner chown -R $app: $final_path @@ -119,13 +150,21 @@ chown -R $app: $final_path #================================================= # SETUP SSOWAT #================================================= - +ynh_print_info "Upgrading SSOwat configuration..." # unprotected_uris allows SSO credentials to be passed anyway. ynh_app_setting_set $app skipped_uris "/" -# Reload services -sudo service php5-fpm reload || true -sudo service nginx reload || true -sudo yunohost app ssowatconf +#================================================= +# RELOAD NGINX +#================================================= +ynh_print_info "Reloading nginx web server..." + +systemctl reload nginx + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Upgrade of $app completed" From a440fe9d75dcaf9a74cd9e262761cad4a8dcfb2b Mon Sep 17 00:00:00 2001 From: anmol Date: Tue, 12 Mar 2019 16:32:06 +0530 Subject: [PATCH 8/9] Fixed checksum in Upgrad script --- check_process | 4 ++-- scripts/upgrade | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/check_process b/check_process index 29c8259..1cbbf2b 100644 --- a/check_process +++ b/check_process @@ -10,7 +10,7 @@ setup_private=0 setup_public=1 upgrade=1 - upgrade=0 from_commit=CommitHash + upgrade=1 from_commit=1c018b9ed379e25d5bcab4bd27e9833feee9da68 backup_restore=1 multi_instance=1 incorrect_path=1 @@ -31,4 +31,4 @@ Level 10=0 ;;; Options Email=anmol@datamol.org - Notification=none + Notification=change diff --git a/scripts/upgrade b/scripts/upgrade index fee62b0..8e0da3b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -131,9 +131,9 @@ ynh_add_fpm_config ### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. ### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. -ynh_backup_if_checksum_is_different "$final_path/local.config.php" +ynh_backup_if_checksum_is_different "$final_path/config/local.config.php" # Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum "$final_path/local.config.php" +ynh_store_file_checksum "$final_path/config/local.config.php" # Set up cron job ynh_replace_string "__YNH_WWW_PATH__" "$final_path" ../conf/poller-cron From 121f988b9b4ceb951e8abe6b100b533a234d45d6 Mon Sep 17 00:00:00 2001 From: anmol Date: Tue, 12 Mar 2019 16:39:25 +0530 Subject: [PATCH 9/9] Updated readme --- README.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d21cb71..b5c73a1 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ Current snapshot in *sources*: -* https://github.com/friendica/friendica: 2018.09 (commit c48fcd4a8f329946cdf09d214596ecf29e859cff) -* https://github.com/friendica/friendica-addons: 2018.09 (commit 9c275a4185956fb2ca790263fb72f6da6311742f) +* https://github.com/friendica/friendica: 2019.01 +* https://github.com/friendica/friendica-addons: 2018.01 ## Important Notes @@ -22,11 +22,8 @@ Before installing, read the [Friendica installation instructions](https://github Note:You can use accounts from YunoHost's LDAP. There are not yet active SSO.

# To-do -- [X] Installation and remove script. -- [X] Ldap integration. -- [X] Upgrade script -- [X] Backup and restore script. -- [X] Multi-instance +- [ ] Fail2Ban support + ## Installation