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

Apply last example_ynh

This commit is contained in:
yalh76 2022-09-01 02:13:26 +02:00
parent 903a9369cd
commit a54eb33431
17 changed files with 215 additions and 120 deletions

View file

@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Create and email invoices, track payments and expenses
**Shipped version:** 4.5.47~ynh1
**Shipped version:** 4.5.50~ynh1
**Demo:** https://app.invoiceninja.com/dashboard

View file

@ -17,7 +17,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
Créez et envoyez des factures par e-mail, suivez les paiements
**Version incluse :** 4.5.47~ynh1
**Version incluse :** 4.5.50~ynh1
**Démo :** https://app.invoiceninja.com/dashboard

View file

@ -2,8 +2,8 @@
; Manifest
domain="domain.tld"
path="/path"
admin="john"
language="fr"
admin="john"
; Checks
pkg_linter=1
setup_sub_dir=1

View file

@ -29,7 +29,7 @@ MAILGUN_SECRET=
#POSTMARK_API_TOKEN=
PHANTOMJS_BIN_PATH=/usr/bin/phantomjs
PHANTOMJS_BIN_PATH=/usr/local/bin/phantomjs
PHANTOMJS_SECRET=__PHANTOMJS_KEY__
LOG=single

View file

@ -1,6 +1,6 @@
SOURCE_URL=https://download.invoiceninja.com/ninja-v4.5.47.zip
SOURCE_SUM=851e7a546ba1ccb8699dd818c14ce4a3192b521c82aef90e695681818649da71
SOURCE_URL=https://download.invoiceninja.com/ninja-v4.5.50.zip
SOURCE_SUM=54ba1cd5747892b346684294dc3512541dc86c6d67bc28126bcd3bf6c206b0d2
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=invoiceninja-v4.5.47.zip
SOURCE_FILENAME=invoiceninja-v4.5.50.zip

View file

@ -1,9 +1,8 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location ^~ __PATH__/ {
# Path to source
alias __FINALPATH__/public/ ;
alias __FINALPATH__/public/;
location __PATH__/ {
rewrite ^ __PATH__/index.php;

7
conf/phantomjs.src Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=https://github.com/ariya/phantomjs/archive/0a0b0facb16acfbabb7804822ecaf4f4b9dce3d2.tar.gz
SOURCE_SUM=5fa3d4be85f3aecc066fa2d5bbf55f856957f4fb329da52ec63398195ad9ceaa
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
Invoice Ninja is the #1 open-source platform to create & email invoices, track payments and expenses, and time billable tasks & projects for clients.

1
doc/DESCRIPTION_fr.md Normal file
View file

@ -0,0 +1 @@
Invoice Ninja est la plate-forme open source n°1 pour créer et envoyer des factures par e-mail, suivre les paiements et les dépenses, ainsi que les tâches et projets facturables pour les clients.

9
doc/DISCLAIMER_fr.md Normal file
View file

@ -0,0 +1,9 @@
:warning: Vous êtes invité à regarder [InvoiceNinja 5](https://github.com/YunoHost-Apps/invoiceninja5_ynh) :warning:
* Toutes les limitations, contraintes ou choses connues qui ne fonctionnent pas, telles que (mais sans s'y limiter) :
* Il n'y a pas de support LDAP officiel
* Le premier utilisateur est créé après l'installation d'Invoice Ninja
* D'autres utilisateurs peuvent être créés depuis l'intérieur de l'application
* Autres informations que les utilisateurs doivent connaître, telles que :
* La configuration se produit dans l'application elle-même.

View file

@ -6,7 +6,7 @@
"en": "Create and email invoices, track payments and expenses",
"fr": "Créez et envoyez des factures par e-mail, suivez les paiements"
},
"version": "4.5.47~ynh1",
"version": "4.5.50~ynh1",
"url": "https://invoiceninja.org",
"upstream": {
"license": "AAL",
@ -31,7 +31,7 @@
"mysql"
],
"arguments": {
"install" : [
"install": [
{
"name": "domain",
"type": "domain"
@ -42,10 +42,6 @@
"example": "/invoiceninja",
"default": "/invoiceninja"
},
{
"name": "admin",
"type": "user"
},
{
"name": "language",
"type": "string",
@ -53,8 +49,15 @@
"en": "Choose the application language",
"fr": "Choisissez la langue de l'application"
},
"choices": ["fr", "en"],
"choices": [
"fr",
"en"
],
"default": "en"
},
{
"name": "admin",
"type": "user"
}
]
}

View file

@ -4,11 +4,17 @@
# COMMON VARIABLES
#=================================================
# dependencies used by the app
pkg_dependencies="phantomjs"
YNH_PHP_VERSION="7.3"
php_dependencies="php$YNH_PHP_VERSION-gd php$YNH_PHP_VERSION-gmp php$YNH_PHP_VERSION-json php$YNH_PHP_VERSION-zip"
# dependencies used by the app (must be on a single line)
pkg_dependencies="$php_dependencies"
build_pkg_dependencies="g++ cmake libqt5webkit5-dev"
# qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
#=================================================
# PERSONAL HELPERS
#=================================================

View file

@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
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)
@ -37,7 +37,7 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
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
@ -73,7 +73,7 @@ fi
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..."
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@ -104,7 +104,7 @@ fi
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Modifying a config file..."
ynh_script_progression --message="Modifying a config file..." --weight=1
config="$final_path/.env"
ynh_backup_if_checksum_is_different --file="$final_path/CONFIG_FILE"
@ -119,7 +119,7 @@ ynh_store_file_checksum --file="$config"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
@ -127,4 +127,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app"
ynh_script_progression --message="Change of URL completed for $app" --last

View file

@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
true
ynh_secure_remove --file="$tmpdir"
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -25,8 +25,8 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
language=$YNH_APP_ARG_LANGUAGE
admin=$YNH_APP_ARG_ADMIN
app=$YNH_APP_INSTANCE_NAME
@ -39,7 +39,7 @@ mail_from_name="$(ynh_user_get_info $admin firstname) $(ynh_user_get_info $admin
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..."
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"
@ -50,13 +50,12 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..."
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
ynh_app_setting_set --app=$app --key=language --value=$language
ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=api_secret --value=$api_secret
ynh_app_setting_set --app=$app --key=app_key --value=$app_key
ynh_app_setting_set --app=$app --key=phantomjs_key --value=$phantomjs_key
@ -66,35 +65,35 @@ ynh_app_setting_set --app=$app --key=mail_from_name --value=$mail_from_name
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# CREATE A MYSQL DATABASE
#=================================================
ynh_script_progression --message="Creating a MySQL database..."
ynh_script_progression --message="Creating a MySQL database..." --weight=1
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
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..."
ynh_script_progression --message="Setting up source files..." --weight=1
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
@ -104,29 +103,45 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..."
ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
# INSTALL PHANTOMJS
#=================================================
ynh_script_progression --message="Installing PhantomJS..." --weight=1
ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
tmpdir="$(mktemp -d)"
ynh_setup_source --dest_dir="$tmpdir" --source_id="phantomjs"
pushd "$tmpdir"
ynh_exec_warn_less ./configure && make
ynh_exec_warn_less make install
popd
ynh_secure_remove --file="$tmpdir"
ynh_install_app_dependencies $pkg_dependencies
ynh_package_autoremove
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..."
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
@ -136,7 +151,7 @@ chown $app:$app "$final_path/.env"
#=================================================
# BUILD THE APPLICATION
#=================================================
ynh_script_progression --message="Building the application..."
ynh_script_progression --message="Building the application..." --weight=1
pushd "$final_path"
# Run the database migrations and initially fill the db
@ -152,7 +167,7 @@ popd
#=================================================
# ADD A CRON JOB
#=================================================
ynh_script_progression --message="Adding a cron job..."
ynh_script_progression --message="Adding a cron job..." --weight=1
ynh_add_config --template="../conf/invoiceninja.cron" --destination="/etc/cron.d/$app"
@ -164,7 +179,7 @@ chown root: "/etc/cron.d/$app"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
@ -172,4 +187,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed"
ynh_script_progression --message="Installation of $app completed" --last

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -27,23 +27,15 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Removing the MySQL database..."
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
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..."
ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
@ -51,7 +43,7 @@ ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..."
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config
@ -59,17 +51,41 @@ ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Removing PHP-FPM configuration..."
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
#=================================================
# UNINSTALL PHANTOMJS
#=================================================
ynh_script_progression --message="Uninstalling PhantomJS..." --weight=1
ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
tmpdir="$(mktemp -d)"
ynh_setup_source --dest_dir="$tmpdir" --source_id="phantomjs"
pushd "$tmpdir"
ynh_exec_warn_less ./configure && make
ynh_exec_warn_less make uninstall
popd
ynh_secure_remove --file="$tmpdir"
ynh_install_app_dependencies $pkg_dependencies
ynh_package_autoremove
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..."
ynh_script_progression --message="Removing various files..." --weight=1
# Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app"
@ -78,4 +94,4 @@ ynh_secure_remove --file="/etc/cron.d/$app"
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed"
ynh_script_progression --message="Removal of $app completed" --last

View file

@ -14,13 +14,16 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
ynh_secure_remove --file="$tmpdir"
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -36,31 +39,24 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..."
ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..."
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
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$final_path"
@ -68,43 +64,68 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..."
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the MySQL database..."
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
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# REINSTALL DEPENDENCIES
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE CRON FILE
#=================================================
ynh_script_progression --message="Restoring various files..."
ynh_script_progression --message="Restoring various files..." --weight=1
ynh_restore_file --origin_path="/etc/cron.d/$app"
#=================================================
# INSTALL PHANTOMJS
#=================================================
ynh_script_progression --message="Installing PhantomJS..." --weight=1
ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
tmpdir="$(mktemp -d)"
ynh_setup_source --dest_dir="$tmpdir" --source_id="phantomjs"
pushd "$tmpdir"
ynh_exec_warn_less ./configure && make
ynh_exec_warn_less make install
popd
ynh_secure_remove --file="$tmpdir"
ynh_install_app_dependencies $pkg_dependencies
ynh_package_autoremove
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
@ -113,4 +134,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app"
ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -12,15 +12,15 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
language=$(ynh_app_setting_get --app=$app --key=language)
admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
language=$(ynh_app_setting_get --app=$app --key=language)
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)
@ -33,18 +33,19 @@ mail_from_name=$(ynh_app_setting_get --app=$app --key=mail_from_name)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
ynh_script_progression --message="Checking version..." --weight=1
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)..."
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_secure_remove --file="$tmpdir"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
@ -56,7 +57,7 @@ ynh_abort_if_errors
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
@ -79,7 +80,7 @@ fi
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
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
@ -90,7 +91,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..."
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="$final_path" --keep=".env"
@ -103,36 +104,52 @@ chown -R $app:www-data "$final_path"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..."
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
#=================================================
# SPECIFIC UPGRADE
#=================================================
# INSTALL PHANTOMJS
#=================================================
ynh_script_progression --message="Installing PhantomJS..." --weight=1
ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
tmpdir="$(mktemp -d)"
ynh_setup_source --dest_dir="$tmpdir" --source_id="phantomjs"
pushd "$tmpdir"
ynh_exec_warn_less ./configure && make
ynh_exec_warn_less make install
popd
ynh_secure_remove --file="$tmpdir"
ynh_install_app_dependencies $pkg_dependencies
ynh_package_autoremove
#=================================================
# UPDATE A CONFIG FILE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Updating a configuration file..."
ynh_script_progression --message="Updating a configuration file..." --weight=1
ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
@ -143,7 +160,7 @@ fi
#=================================================
# UPGRADE DATABASE
#=================================================
ynh_script_progression --message="Upgrading the database..."
ynh_script_progression --message="Upgrading the database..." --weight=1
pushd "$final_path"
# Put the application into maintenance mode
@ -165,7 +182,7 @@ popd
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
@ -173,4 +190,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed"
ynh_script_progression --message="Upgrade of $app completed" --last