1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/firefly-iii_ynh.git synced 2024-09-03 18:36:13 +02:00
This commit is contained in:
YunoHost Bot 2024-08-31 13:12:42 +02:00 committed by GitHub
commit 4c7fe52969
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 89 additions and 112 deletions

View file

@ -1,2 +1,2 @@
# cron job for __APP__ # 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

View file

@ -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

View file

@ -16,7 +16,7 @@ location __PATH__/ {
try_files $uri $uri/ index.php; try_files $uri $uri/ index.php;
location ~ '[^/]\.php$|^/update.php' { location ~ '[^/]\.php$|^/update.php' {
fastcgi_split_path_info ^(.+?\.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; fastcgi_index index.php;
include fastcgi_params; include fastcgi_params;

View file

@ -17,7 +17,8 @@ admindoc = "https://docs.firefly-iii.org/firefly-iii/about-firefly-iii/introduct
code = "https://github.com/firefly-iii/firefly-iii" code = "https://github.com/firefly-iii/firefly-iii"
[integration] [integration]
yunohost = ">= 11.2" yunohost = ">= 11.2.18"
helpers_version = "2.1"
architectures = "all" architectures = "all"
multi_instance = true multi_instance = true
@ -64,6 +65,7 @@ ram.runtime = "50M"
[resources.system_user] [resources.system_user]
[resources.install_dir] [resources.install_dir]
group = "www-data:r-x"
[resources.permissions] [resources.permissions]
main.url = "/" main.url = "/"

View file

@ -1,17 +1,5 @@
#!/bin/bash #!/bin/bash
#================================================= #=================================================
# COMMON VARIABLES # COMMON VARIABLES AND CUSTOM HELPERS
#=================================================
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#================================================= #=================================================

View file

@ -8,36 +8,33 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= ynh_print_info "Declaring files to be backed up..."
# 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_backup --src_path="$install_dir" ynh_backup "$install_dir"
#================================================= #=================================================
# SYSTEM CONFIGURATION # 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 # 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 # 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)."

View file

@ -10,29 +10,27 @@ source /usr/share/yunohost/helpers
email=$(ynh_user_get_info --username=$admin --key=mail) email=$(ynh_user_get_info --username=$admin --key=mail)
timezone="$(cat /etc/timezone)" timezone="$(cat /etc/timezone)"
#=================================================
# STANDARD MODIFICATIONS
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # 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 # MODIFY A CONFIG FILE
#================================================= #=================================================
ynh_script_progression --message="Modifying a config file..." ynh_script_progression "Updating configuration..."
domain="$new_domain" domain="$new_domain"
path="$new_path" path="$new_path"
ynh_add_config --template=".env" --destination="$install_dir/.env" ynh_config_add --template=".env" --destination="$install_dir/.env"
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 | 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 | chown $app "$install_dir/.env"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Change of URL completed for $app" ynh_script_progression "Change of URL completed for $app"

View file

@ -6,60 +6,59 @@ source /usr/share/yunohost/helpers
random_key=$(ynh_string_random --length=32) random_key=$(ynh_string_random --length=32)
email=$(ynh_user_get_info --username=$admin --key=mail) email=$(ynh_user_get_info --username=$admin --key=mail)
timezone=$(cat /etc/timezone) 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 # 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 ynh_setup_source --dest_dir=$install_dir
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 | 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 | chown -R $app:www-data "$install_dir"
chmod -R 775 $install_dir/storage chmod -R 775 $install_dir/storage
#================================================= #=================================================
# SYSTEL CONFIGURATIONS # 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" ynh_config_add --template="cron" --destination="/etc/cron.d/$app"
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 | chown root: "/etc/cron.d/$app"
chmod 644 "/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 # SPECIFIC SETUP
#================================================= #=================================================
# ADD A CONFIGURATION # 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" #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"
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 | chown $app "$install_dir/.env"
#================================================= #=================================================
# DEPLOY # DEPLOY
#================================================= #=================================================
ynh_script_progression --message="Deploying..." --weight=1 ynh_script_progression "Deploying..."
pushd "$install_dir" pushd "$install_dir"
php$phpversion artisan firefly-iii:upgrade-database php$php_version artisan firefly-iii:upgrade-database
php$phpversion artisan firefly-iii:correct-database php$php_version artisan firefly-iii:correct-database
php$phpversion artisan firefly-iii:report-integrity php$php_version artisan firefly-iii:report-integrity
php$phpversion artisan passport:keys || true php$php_version artisan passport:keys || true
popd 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 # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of $app completed" ynh_script_progression "Installation of $app completed"

View file

@ -10,17 +10,17 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# REMOVE SYSTEM CONFIGURATIONS # 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 # Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app" ynh_safe_rm "/etc/cron.d/$app"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Removal of $app completed" ynh_script_progression "Removal of $app completed"

View file

@ -7,43 +7,40 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # 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" ynh_restore "$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"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # 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 # 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" ynh_restore "/etc/cron.d/$app"
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 | chown root: "/etc/cron.d/$app"
chmod 644 "/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 "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_systemctl --service=php$php_version-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload ynh_systemctl --service=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Restoration completed for $app" ynh_script_progression "Restoration completed for $app"

View file

@ -6,64 +6,64 @@ source /usr/share/yunohost/helpers
email=$(ynh_user_get_info --username=$admin --key=mail) email=$(ynh_user_get_info --username=$admin --key=mail)
timezone="$(cat /etc/timezone)" timezone="$(cat /etc/timezone)"
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=language --value="en_US"
if [ -z "${language:-}" ]; then if [ -z "${language:-}" ]; then
language="en_US" language="en_US"
ynh_app_setting_set --app=$app --key=language --value=$language ynh_app_setting_set --key=language --value=$language
fi fi
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # 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" #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"
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"
chmod -R 775 $install_dir/storage chmod -R 775 $install_dir/storage
#================================================= #=================================================
# UPDATE A CONFIG FILE # 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" #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"
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 | chown $app "$install_dir/.env"
#================================================= #=================================================
# REAPPLY SYSTEM CONFIGURATIONS # 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" ynh_config_add --template="cron" --destination="/etc/cron.d/$app"
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 | chown root: "/etc/cron.d/$app"
chmod 644 "/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 # DEPLOYMENT
#================================================= #=================================================
ynh_script_progression --message="Upgrading database..." --weight=4 ynh_script_progression "Upgrading database..."
pushd "$install_dir" pushd "$install_dir"
php$phpversion artisan migrate --seed php$php_version artisan migrate --seed
php$phpversion artisan firefly-iii:decrypt-all php$php_version artisan firefly-iii:decrypt-all
php$phpversion artisan cache:clear php$php_version artisan cache:clear
php$phpversion artisan firefly-iii:upgrade-database php$php_version artisan firefly-iii:upgrade-database
php$phpversion artisan passport:keys || true php$php_version artisan passport:keys || true
php$phpversion artisan cache:clear php$php_version artisan cache:clear
php$phpversion artisan view:clear php$php_version artisan view:clear
popd 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 # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of $app completed" ynh_script_progression "Upgrade of $app completed"