diff --git a/conf/cron b/conf/cron index 96f8048..c829a51 100644 --- a/conf/cron +++ b/conf/cron @@ -1,2 +1,2 @@ # cron job for __APP__ -0 3 * * * __APP__ /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/artisan firefly-iii:cron +0 3 * * * __APP__ /usr/bin/php__PHP_VERSION__ __INSTALL_DIR__/artisan firefly-iii:cron diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf deleted file mode 100644 index 14c8d27..0000000 --- a/conf/extra_php-fpm.conf +++ /dev/null @@ -1,4 +0,0 @@ -; Additional php.ini defines, specific to this pool of workers. - -php_admin_value[upload_max_filesize] = 50M -php_admin_value[post_max_size] = 50M \ No newline at end of file diff --git a/conf/nginx.conf b/conf/nginx.conf index db6b0ba..016eacb 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -16,7 +16,7 @@ location __PATH__/ { try_files $uri $uri/ index.php; location ~ '[^/]\.php$|^/update.php' { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock; fastcgi_index index.php; include fastcgi_params; diff --git a/manifest.toml b/manifest.toml index 098f556..1da5112 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,8 @@ admindoc = "https://docs.firefly-iii.org/firefly-iii/about-firefly-iii/introduct code = "https://github.com/firefly-iii/firefly-iii" [integration] -yunohost = ">= 11.2" +yunohost = ">= 11.2.18" +helpers_version = "2.1" architectures = "all" multi_instance = true @@ -64,6 +65,7 @@ ram.runtime = "50M" [resources.system_user] [resources.install_dir] + group = "www-data:r-x" [resources.permissions] main.url = "/" diff --git a/scripts/_common.sh b/scripts/_common.sh index 944a65e..3d7f008 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,17 +1,5 @@ #!/bin/bash #================================================= -# COMMON VARIABLES -#================================================= - -#================================================= -# PERSONAL HELPERS -#================================================= - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= - -#================================================= -# FUTURE OFFICIAL HELPERS +# COMMON VARIABLES AND CUSTOM HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 1ae48d8..8fbccdd 100755 --- a/scripts/backup +++ b/scripts/backup @@ -8,36 +8,33 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# DECLARE DATA AND CONF FILES TO BACKUP -#================================================= -ynh_print_info --message="Declaring files to be backed up..." +ynh_print_info "Declaring files to be backed up..." #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$install_dir" +ynh_backup "$install_dir" #================================================= # SYSTEM CONFIGURATION #================================================= -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf" -ynh_backup --src_path="/etc/cron.d/$app" +ynh_backup "/etc/cron.d/$app" #================================================= # BACKUP THE MYSQL DATABASE #================================================= -ynh_print_info --message="Backing up the MySQL database..." +ynh_print_info "Backing up the MySQL database..." -ynh_mysql_dump_db --database="$db_name" > db.sql +ynh_mysql_dump_db > db.sql #================================================= # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index 0088de8..a4ffdac 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -10,29 +10,27 @@ source /usr/share/yunohost/helpers email=$(ynh_user_get_info --username=$admin --key=mail) timezone="$(cat /etc/timezone)" -#================================================= -# STANDARD MODIFICATIONS #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." +ynh_script_progression "Updating NGINX web server configuration..." -ynh_change_url_nginx_config +ynh_config_change_url_nginx #================================================= # MODIFY A CONFIG FILE #================================================= -ynh_script_progression --message="Modifying a config file..." +ynh_script_progression "Updating configuration..." domain="$new_domain" path="$new_path" -ynh_add_config --template=".env" --destination="$install_dir/.env" -chmod 400 "$install_dir/.env" -chown $app "$install_dir/.env" +ynh_config_add --template=".env" --destination="$install_dir/.env" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/.env" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app "$install_dir/.env" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" +ynh_script_progression "Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index 3db167a..4c1d2e0 100755 --- a/scripts/install +++ b/scripts/install @@ -6,60 +6,59 @@ source /usr/share/yunohost/helpers random_key=$(ynh_string_random --length=32) email=$(ynh_user_get_info --username=$admin --key=mail) timezone=$(cat /etc/timezone) -ynh_app_setting_set --app=$app --key=random_key --value=$random_key +ynh_app_setting_set --key=random_key --value=$random_key #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=1 +ynh_script_progression "Setting up source files..." ynh_setup_source --dest_dir=$install_dir -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" chmod -R 775 $install_dir/storage #================================================= # SYSTEL CONFIGURATIONS #================================================= -ynh_script_progression --message="Add system configurations related to $app..." --weight=1 +ynh_script_progression "Add system configurations related to $app..." -ynh_add_fpm_config +ynh_config_add_phpfpm -ynh_add_nginx_config +ynh_config_add_nginx -ynh_add_config --template="cron" --destination="/etc/cron.d/$app" -chown root: "/etc/cron.d/$app" -chmod 644 "/etc/cron.d/$app" +ynh_config_add --template="cron" --destination="/etc/cron.d/$app" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown root: "/etc/cron.d/$app" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 644 "/etc/cron.d/$app" #================================================= # SPECIFIC SETUP #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding $app configuration..." --weight=1 +ynh_script_progression "Adding $app configuration..." -ynh_add_config --template=".env" --destination="$install_dir/.env" +ynh_config_add --template=".env" --destination="$install_dir/.env" -chmod 400 "$install_dir/.env" -chown $app "$install_dir/.env" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/.env" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app "$install_dir/.env" #================================================= # DEPLOY #================================================= -ynh_script_progression --message="Deploying..." --weight=1 +ynh_script_progression "Deploying..." pushd "$install_dir" - php$phpversion artisan firefly-iii:upgrade-database - php$phpversion artisan firefly-iii:correct-database - php$phpversion artisan firefly-iii:report-integrity - php$phpversion artisan passport:keys || true + php$php_version artisan firefly-iii:upgrade-database + php$php_version artisan firefly-iii:correct-database + php$php_version artisan firefly-iii:report-integrity + php$php_version artisan passport:keys || true popd -chown -R $app:www-data "$install_dir" - +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" +ynh_script_progression "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 6f3e553..e12cefd 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,17 +10,17 @@ source /usr/share/yunohost/helpers #================================================= # REMOVE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 +ynh_script_progression "Removing system configurations related to $app..." -ynh_remove_nginx_config +ynh_config_remove_nginx -ynh_remove_fpm_config +ynh_config_remove_phpfpm # Remove a cron file -ynh_secure_remove --file="/etc/cron.d/$app" +ynh_safe_rm "/etc/cron.d/$app" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" +ynh_script_progression "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index d029f10..d7b1cd9 100755 --- a/scripts/restore +++ b/scripts/restore @@ -7,43 +7,40 @@ source /usr/share/yunohost/helpers #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=1 +ynh_script_progression "Restoring the app main directory..." -ynh_restore_file --origin_path="$install_dir" - -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +ynh_restore "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." --weight=1 +ynh_script_progression "Restoring the MySQL database..." -ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql +ynh_mysql_db_shell < ./db.sql #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 +ynh_script_progression "Restoring system configurations related to $app..." -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf" -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_restore_file --origin_path="/etc/cron.d/$app" -chown root: "/etc/cron.d/$app" -chmod 644 "/etc/cron.d/$app" +ynh_restore "/etc/cron.d/$app" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown root: "/etc/cron.d/$app" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 644 "/etc/cron.d/$app" #================================================= -# GENERIC FINALIZATION -#================================================= -ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 +ynh_script_progression "Reloading NGINX web server and PHP-FPM..." -ynh_systemd_action --service_name=php$phpversion-fpm --action=reload -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemctl --service=php$php_version-fpm --action=reload +ynh_systemctl --service=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" +ynh_script_progression "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 8914f92..bb7649c 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -6,64 +6,64 @@ source /usr/share/yunohost/helpers email=$(ynh_user_get_info --username=$admin --key=mail) timezone="$(cat /etc/timezone)" +# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=language --value="en_US" if [ -z "${language:-}" ]; then language="en_US" - ynh_app_setting_set --app=$app --key=language --value=$language + ynh_app_setting_set --key=language --value=$language fi #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Upgrading source files..." --weight=1 +ynh_script_progression "Upgrading source files..." -ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep=".env storage" +ynh_setup_source --dest_dir="$install_dir" --full_replace --keep=".env storage" -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" chmod -R 775 $install_dir/storage #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Updating $app configuration..." --weight=1 +ynh_script_progression "Updating $app configuration..." -ynh_add_config --template=".env" --destination="$install_dir/.env" +ynh_config_add --template=".env" --destination="$install_dir/.env" -chmod 400 "$install_dir/.env" -chown $app "$install_dir/.env" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/.env" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app "$install_dir/.env" #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 +ynh_script_progression "Upgrading system configurations related to $app..." -ynh_add_fpm_config +ynh_config_add_phpfpm -ynh_add_nginx_config +ynh_config_add_nginx -ynh_add_config --template="cron" --destination="/etc/cron.d/$app" -chown root: "/etc/cron.d/$app" -chmod 644 "/etc/cron.d/$app" +ynh_config_add --template="cron" --destination="/etc/cron.d/$app" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown root: "/etc/cron.d/$app" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 644 "/etc/cron.d/$app" #================================================= # DEPLOYMENT #================================================= -ynh_script_progression --message="Upgrading database..." --weight=4 +ynh_script_progression "Upgrading database..." pushd "$install_dir" - php$phpversion artisan migrate --seed - php$phpversion artisan firefly-iii:decrypt-all - php$phpversion artisan cache:clear - php$phpversion artisan firefly-iii:upgrade-database - php$phpversion artisan passport:keys || true - php$phpversion artisan cache:clear - php$phpversion artisan view:clear + php$php_version artisan migrate --seed + php$php_version artisan firefly-iii:decrypt-all + php$php_version artisan cache:clear + php$php_version artisan firefly-iii:upgrade-database + php$php_version artisan passport:keys || true + php$php_version artisan cache:clear + php$php_version artisan view:clear popd -chown -R $app:www-data "$install_dir" - +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" +ynh_script_progression "Upgrade of $app completed"