1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hubzilla_ynh.git synced 2024-09-03 19:26:21 +02:00

Small Fixes

This commit is contained in:
ericgaspar 2020-11-13 11:25:58 +01:00
parent c267cb589e
commit 2f65d50fb3
No known key found for this signature in database
GPG key ID: 574F281483054D44
11 changed files with 38 additions and 134 deletions

View file

@ -1,26 +1,25 @@
# Hubzilla for YunoHost # Hubzilla for YunoHost
[![Integration level](https://dash.yunohost.org/integration/hubzilla.svg)](https://dash.yunohost.org/appci/app/hubzilla) ![](https://ci-apps.yunohost.org/ci/badges/hubzilla.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/hubzilla.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/hubzilla.svg)](https://dash.yunohost.org/appci/app/hubzilla) ![](https://ci-apps.yunohost.org/ci/badges/hubzilla.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/hubzilla.maintain.svg)
[![Install Hubzilla with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=hubzilla) [![Install Hubzilla with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=hubzilla)
> *This package allow you to install Hubzilla quickly and simply on a YunoHost server. > *This package allow you to install Hubzilla quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
Version: **5.0.1**
## Overview ## Overview
[Hubzilla](https://hub.libranet.de/directory?f=&global=1&pubforums=1) is a social networking platform built with control of your privacy at center stage. Your online communications can be as public as you wish or as private as you require. Private conversations, private photos, private videos. Your media isn't hidden behind an obscure URL which can be guessed, it is protected by state-of-the-art cross-domain authentication. What this all means for you: **less drama**. [Hubzilla](https://hub.libranet.de/directory?f=&global=1&pubforums=1) is a social networking platform built with control of your privacy at center stage. Your online communications can be as public as you wish or as private as you require. Private conversations, private photos, private videos. Your media isn't hidden behind an obscure URL which can be guessed, it is protected by state-of-the-art cross-domain authentication. What this all means for you: **less drama**.
**Shipped version:** 5.0.1
## Screenshots ## Screenshots
![](https://fediverse.party/img/screenshots/hubzilla-1.png) ![](https://fediverse.party/img/screenshots/hubzilla-1.png)
## This app claims following features: ## This app claims following features:
- [X] Ldap integration - [X] LDAP integration
- [X] Multi-instance - [X] Multi-instance
- [X] Adeed php.log in the root folder for debugging php, with logrotate applied on it (can be accesssed by **admin->logs** and entering the **php.log**). - [X] Adeed php.log in the root folder for debugging PHP, with logrotate applied on it (can be accesssed by **admin->logs** and entering the **php.log**).
- [X] Fail2ban - [X] Fail2Ban
- [X] Choose between **Mysql** and **PostgreSQL** database to be used for the Hubzilla while installation. - [X] Choose between **Mysql** and **PostgreSQL** database to be used for the Hubzilla while installation.
## Installation ## Installation
@ -33,13 +32,13 @@ Before installing, read the [Hubzilla installation instructions](https://framagi
- **For admin rights**: When installation is complete, you will need to visit your new hub's page and login with the **admin account username** which was entered at the time of installation process. You should then be able to create your first channel and have the **admin rights** for the hub. - **For admin rights**: When installation is complete, you will need to visit your new hub's page and login with the **admin account username** which was entered at the time of installation process. You should then be able to create your first channel and have the **admin rights** for the hub.
- **For normal YunoHost users :** Normal LDAP users can login through Ldap authentication and create there channels. - **For normal YunoHost users**: Normal LDAP users can login through LDAP authentication and create there channels.
- **Failing to get admin rights :** If the admin cannot access the admin settings at `https://hubzilla.example.com/admin` or you want to grant admin rights to any other user(s) on the hub, then you have to **manually add 4096** to the **account_roles** under **accounts** for that user in the **database through phpMYAdmin**. - **Failing to get admin rights**: If the admin cannot access the admin settings at `https://hubzilla.example.com/admin` or you want to grant admin rights to any other user(s) on the hub, then you have to **manually add 4096** to the **account_roles** under **accounts** for that user in the **database through phpMyAdmin**.
- **For logs :** Go to **admin->logs** and enter the file name **php.log**. - **For logs**: Go to **admin->logs** and enter the file name **php.log**.
- **Failed Database after Upgrade :** Some times databse upgrade fails after version upgrade. You can go to hub eg. `https://hubzilla.example.com/admin/dbsync/` and check the numbers of failled update. These updates will have to be ran manually by **phpMYAdmin**. - **Failed Database after Upgrade:** Some times databse upgrade fails after version upgrade. You can go to hub eg. `https://hubzilla.example.com/admin/dbsync/` and check the numbers of failled update. These updates will have to be ran manually by **phpMyAdmin**.
#### Supported architectures #### Supported architectures

View file

@ -23,18 +23,7 @@
port_already_use=0 port_already_use=0
change_url=0 change_url=0
;;; Levels ;;; Levels
Level 1=auto
Level 2=auto
Level 3=auto
# Level 4: If the app supports LDAP and SSOwat, turn level 4 to '1' and add a link to an issue or a part of your code to show it.
# If the app does not use LDAP nor SSOwat, and can't use them, turn level 4 to 'na' and explain as well.
Level 4=1
Level 5=auto Level 5=auto
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0
;;; Options ;;; Options
Email=anmol@datamol.org Email=anmol@datamol.org
Notification=change Notification=change

View file

@ -33,7 +33,7 @@ group = __USER__
; (IPv6 and IPv4-mapped) on a specific port; ; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket. ; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory. ; Note: This value is mandatory.
listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock
; Set listen(2) backlog. ; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD) ; Default Value: 511 (-1 on FreeBSD and OpenBSD)

View file

@ -3,8 +3,8 @@
"id": "hubzilla", "id": "hubzilla",
"name": "Hubzilla", "name": "Hubzilla",
"description": { "description": {
"en": "A decentralized publication platform and social network.", "en": "Decentralized publication platform and social network.",
"fr": "Une plateforme de publication décentralisée et un réseau social." "fr": "Plateforme de publication décentralisée et un réseau social."
}, },
"url": "https://zotlabs.org/page/hubzilla/hubzilla-project", "url": "https://zotlabs.org/page/hubzilla/hubzilla-project",
"license": "MIT", "license": "MIT",
@ -50,7 +50,7 @@
"type": "string", "type": "string",
"ask": { "ask": {
"en": "Choose the database to be used for the Hubzilla [mysql:1,postgresql:2]", "en": "Choose the database to be used for the Hubzilla [mysql:1,postgresql:2]",
"fr": "Choisissez la database de l'Hubzilla [mysql:1,postgresql:2]" "fr": "Choisissez la database de Hubzilla [mysql:1,postgresql:2]"
}, },
"choices": ["1", "2"], "choices": ["1", "2"],
"default": "1" "default": "1"

View file

@ -15,4 +15,4 @@
--- ---
*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results* *If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results*
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/REPLACEBYYOURAPP_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/REPLACEBYYOURAPP_ynh%20PR-NUM-%20(USERNAME)/) [![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/hubzilla_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/hubzilla_ynh%20PR-NUM-%20(USERNAME)/)

View file

@ -8,6 +8,7 @@
YNH_PHP_VERSION="7.3" YNH_PHP_VERSION="7.3"
extra_php_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-pgsql php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-gd" extra_php_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-pgsql php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-gd"
# dependencies used by the app # dependencies used by the app
pkg_dependencies="postgresql postgresql-contrib" pkg_dependencies="postgresql postgresql-contrib"
@ -42,7 +43,7 @@ ynh_smart_mktemp () {
ynh_die "Insufficient free space to continue..." ynh_die "Insufficient free space to continue..."
fi fi
echo "$(sudo mktemp --directory --tmpdir="$tmpdir")" echo "$(mktemp --directory --tmpdir="$tmpdir")"
} }
#================================================= #=================================================
# FUTURE OFFICIAL HELPERS # FUTURE OFFICIAL HELPERS

View file

@ -6,7 +6,6 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -34,49 +33,47 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
database=$(ynh_app_setting_get --app=$app --key=database) database=$(ynh_app_setting_get --app=$app --key=database)
#================================================= #=================================================
# STANDARD BACKUP STEPS # DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Backing up the main app directory..."
ynh_backup --src_path="$final_path" ynh_backup --src_path="$final_path"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Backing up nginx web server configuration..."
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# BACKUP THE PHP-FPM CONFIGURATION # BACKUP THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Backing up php-fpm configuration..."
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#================================================= #=================================================
# BACKUP OF THE DATABASE # BACKUP OF THE DATABASE
#================================================= #=================================================
ynh_script_progression --message="Backing up the MySQL database..."
if [ $database -eq 1 ]; then if [ $database -eq 1 ]; then
ynh_script_progression --message="Backup of the MySQL database..." # Backup MySQL database
ynh_print_info --message="Backup of the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql ynh_mysql_dump_db --database="$db_name" > db.sql
elif [ $database -eq 2 ]; then elif [ $database -eq 2 ]; then
# Removing postgresql database # Backup PostgreSQL database
ynh_script_progression --message="Backup of the postgresql database..." ynh_print_info --message="Backup of the PostgreSQL database..."
ynh_psql_dump_db --database="$db_name" > db.sql ynh_psql_dump_db --database="$db_name" > db.sql
fi fi
#================================================= #=================================================
# SPECIFIC BACKUP # SPECIFIC BACKUP
#================================================= #=================================================
# BACKUP LOGROTATE # BACKUP LOGROTATE
#================================================= #=================================================
ynh_script_progression --message="Backing up logrotate configuration..."
ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/logrotate.d/$app"
@ -89,7 +86,6 @@ ynh_backup --src_path="/etc/cron.d/$app"
#================================================= #=================================================
# BACKUP FAIL2BAN CONFIGURATION # BACKUP FAIL2BAN CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Backing up fail2ban configuration..."
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
@ -98,4 +94,4 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -32,33 +32,13 @@ upload="256M"
random_string="$(ynh_string_random)$(ynh_string_random)$(ynh_string_random)" random_string="$(ynh_string_random)$(ynh_string_random)$(ynh_string_random)"
database=`expr $YNH_APP_ARG_DATABASE` database=`expr $YNH_APP_ARG_DATABASE`
### If it's a multi-instance app, meaning it can be installed several times independently
### The id of the app as stated in the manifest is available as $YNH_APP_ID
### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
### The app instance name is available as $YNH_APP_INSTANCE_NAME
### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
### - ynhexample__{N} for the subsequent installations, with N=3,4, ...
### The app instance name is probably what interests you most, since this is
### guaranteed to be unique. This is a good unique identifier to define installation path,
### db names, ...
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
### About --weight and --time
### ynh_script_progression will show to your final users the progression of each scripts.
### In order to do that, --weight will represent the relative time of execution compared to the other steps in the script.
### --time is a packager option, it will show you the execution time since the previous call.
### This option should be removed before releasing your app.
### Use the execution time, given by --time, to estimate the weight of a step.
### A common way to do it is to set a weight equal to the execution time in second +1.
### The execution time is given for the duration since the previous call. So the weight should be applied to this previous call.
ynh_script_progression --message="Validating installation parameters..." ynh_script_progression --message="Validating installation parameters..."
### 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 final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
@ -85,14 +65,6 @@ ynh_app_setting_set --app=$app --key=random_string --value=$random_string
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." ynh_script_progression --message="Installing dependencies..."
### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package.
### Those deb packages will be installed as dependencies of this package.
### If you're not using this helper:
### - Remove the section "REMOVE DEPENDENCIES" in the remove script
### - Remove the variable "pkg_dependencies" in _common.sh
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
if [ $database -eq 2 ]; then if [ $database -eq 2 ]; then
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
fi fi
@ -104,10 +76,6 @@ fi
# 1 - Hubzilla # 1 - Hubzilla
ynh_script_progression --message="Setting up Hubzilla source files..." ynh_script_progression --message="Setting up Hubzilla 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=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$final_path"
@ -121,14 +89,12 @@ ynh_script_progression --message="Setting up Hubzilla addons source files..."
ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons" ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons"
# 3 - Some extra folders # 3 - Some extra folders
ynh_script_progression --message="Creating smarty3 folder for personal data..." ynh_script_progression --message="Creating smarty3 folder for personal data..."
mkdir -p "${final_path}/store/[data]/smarty3" mkdir -p "${final_path}/store/[data]/smarty3"
chmod -R 777 $final_path/store chmod -R 777 $final_path/store
# Copy the template install/htconfig.sample.php to .htconfig.php # Copy the template install/htconfig.sample.php to .htconfig.php
ynh_script_progression --message="Moving .htconfig.php to root of Hubzilla ..." ynh_script_progression --message="Moving .htconfig.php to root of Hubzilla ..."
config="$final_path/.htconfig.php" config="$final_path/.htconfig.php"
@ -142,16 +108,6 @@ touch "$final_path/php.log"
# CREATE A DATABASE # CREATE A 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
if [ $database -eq 1 ]; then if [ $database -eq 1 ]; then
ynh_script_progression --message="Creating a MySQL database..." ynh_script_progression --message="Creating a MySQL database..."
db_name=$(ynh_sanitize_dbid --db_name=$app) db_name=$(ynh_sanitize_dbid --db_name=$app)
@ -180,8 +136,6 @@ fi
# MODIFY A CONFIG FILE # MODIFY A CONFIG FILE
#================================================= #=================================================
### `ynh_replace_string` is used to replace a string in a file.
### (It's compatible with sed regular expressions syntax)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
ynh_replace_string --match_string="your.mysqlhost.com" --replace_string="localhost" --target_file="$config" ynh_replace_string --match_string="your.mysqlhost.com" --replace_string="localhost" --target_file="$config"
ynh_replace_string --match_string= "mysqlpassword" --replace_string="$db_pwd" --target_file="$config" ynh_replace_string --match_string= "mysqlpassword" --replace_string="$db_pwd" --target_file="$config"
@ -201,7 +155,6 @@ ynh_script_progression --message="Push Ldap configuration to .htconfig.php..."
cat ../conf/ldap_conf.php >> $final_path/.htconfig.php cat ../conf/ldap_conf.php >> $final_path/.htconfig.php
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -224,17 +177,6 @@ ynh_system_user_create --username=$app
#================================================= #=================================================
ynh_script_progression --message="Configuring php-fpm..." ynh_script_progression --message="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
### 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 # Create a dedicated php-fpm config
ynh_add_fpm_config --package="$extra_php_dependencies" ynh_add_fpm_config --package="$extra_php_dependencies"
@ -253,10 +195,6 @@ cp ../conf/poller-cron /etc/cron.d/$app
# STORE THE CONFIG FILE CHECKSUM # 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 # Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$config" ynh_store_file_checksum --file="$config"
@ -265,14 +203,6 @@ ynh_store_file_checksum --file="$config"
#================================================= #=================================================
ynh_script_progression --message="Configuring log rotation..." ynh_script_progression --message="Configuring log rotation..."
### `ynh_use_logrotate` is used to configure a logrotate configuration for the logs of this app.
### Use this helper only if there is effectively a log file for this app.
### If you're not using this helper:
### - Remove the section "BACKUP LOGROTATE" in the backup script
### - Remove also the section "REMOVE LOGROTATE CONFIGURATION" in the remove script
### - As well as the section "RESTORE THE LOGROTATE CONFIGURATION" in the restore script
### - And the section "SETUP LOGROTATE" in the upgrade script
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
ynh_use_logrotate "$final_path/php.log" ynh_use_logrotate "$final_path/php.log"

View file

@ -22,24 +22,22 @@ db_user="$db_name"
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
database=$(ynh_app_setting_get --app=$app --key=database) database=$(ynh_app_setting_get --app=$app --key=database)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
#=================================================
#================================================= #=================================================
# REMOVE THE DATABASE # REMOVE THE DATABASE
#================================================= #=================================================
if [ $database -eq 1 ]; then if [ $database -eq 1 ]; then
# Removing MySQL database
ynh_script_progression --message="Removing MySQL database..." ynh_script_progression --message="Removing MySQL database..."
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
elif [ $database -eq 2 ]; then elif [ $database -eq 2 ]; then
# Removing postgresql database # Removing PostgreSQL database
ynh_script_progression --message="Removing postgresql database..." ynh_script_progression --message="Removing postgresql database..."
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
fi fi
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================
@ -87,7 +85,6 @@ ynh_remove_logrotate
# Remove a cron file # Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app" ynh_secure_remove --file="/etc/cron.d/$app"
#================================================= #=================================================
# REMOVE FAIL2BAN CONFIGURATION # REMOVE FAIL2BAN CONFIGURATION
#================================================= #=================================================

View file

@ -84,9 +84,6 @@ elif [ $database -eq 2 ]; then
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name" ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
fi fi
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
@ -108,7 +105,6 @@ ynh_add_fpm_config --package="$extra_php_dependencies"
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
#================================================= #=================================================
#=================================================
# RESTORE THE CRON FILE # RESTORE THE CRON FILE
#================================================= #=================================================

View file

@ -35,7 +35,6 @@ if [ -z "$db_name" ]; then
ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
@ -50,13 +49,13 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_print_info "Upgrading source files..." ynh_print_info "Upgrading source files..."
# Create a temporary directory # Create a temporary directory
tmpdir="$(ynh_smart_mktemp 6000)" tmpdir="$(ynh_smart_mktemp 6000)"
# Backup the config file in the temp dir # Backup the config file in the temp dir
@ -64,7 +63,6 @@ cp -a "$final_path/.htconfig.php" "$tmpdir/.htconfig.php"
cp -a "$final_path/store" "$tmpdir/store" cp -a "$final_path/store" "$tmpdir/store"
cp -a "$final_path/php.log" "$tmpdir/php.log" cp -a "$final_path/php.log" "$tmpdir/php.log"
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove "$final_path" ynh_secure_remove "$final_path"
@ -79,11 +77,10 @@ fi
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." ynh_script_progression --message="Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$final_path"
cp -a "$tmpdir/store" "${final_path}" cp -a "$tmpdir/store" "${final_path}"
cp -a "$tmpdir/.htconfig.php" "${final_path}" cp -a "$tmpdir/.htconfig.php" "${final_path}"
@ -93,13 +90,12 @@ chmod -R 777 $final_path/store
mkdir $final_path/addon mkdir $final_path/addon
ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons" ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Upgrading nginx web server configuration..." ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated nginx config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#================================================= #=================================================
@ -116,7 +112,7 @@ chown -R $app: $final_path
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_print_info "Upgrading php-fpm configuration..." ynh_print_info "Upgrading PHP-FPM configuration..."
# Create a dedicated php-fpm config # Create a dedicated php-fpm config
ynh_add_fpm_config --package="$extra_php_dependencies" ynh_add_fpm_config --package="$extra_php_dependencies"
@ -137,7 +133,7 @@ ynh_use_logrotate --non-append
# UPGRADE FAIL2BAN # UPGRADE FAIL2BAN
#================================================= #=================================================
ynh_script_progression --message="Re-configure fail2ban..." ynh_script_progression --message="Re-configure Fail2Ban..."
ynh_add_fail2ban_config --logpath="$final_path/php.log" --failregex="^.*auth\.php.*failed login attempt.*from IP <HOST>.*$" --max_retry="5" ynh_add_fail2ban_config --logpath="$final_path/php.log" --failregex="^.*auth\.php.*failed login attempt.*from IP <HOST>.*$" --max_retry="5"
@ -146,7 +142,7 @@ ynh_print_info "Setting up cron job..."
ynh_replace_string --match_string="YNH_WWW_PATH" --replace_string="$final_path" --target_file="../conf/poller-cron" ynh_replace_string --match_string="YNH_WWW_PATH" --replace_string="$final_path" --target_file="../conf/poller-cron"
ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="../conf/poller-cron" ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="../conf/poller-cron"
ynh_replace_string --match_string="__PHP_VERSION__" --replace_string="$phpversion" --target_file="../conf/poller-cron" ynh_replace_string --match_string="__PHP_VERSION__" --replace_string="$phpversion" --target_file="../conf/poller-cron"
sudo cp -f ../conf/poller-cron /etc/cron.d/$app cp -f ../conf/poller-cron /etc/cron.d/$app
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
@ -186,7 +182,7 @@ ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload