1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/grocy_ynh.git synced 2024-09-03 19:25:54 +02:00

Automated testing -> master (#73)

* Auto-update READMEs

* Update manifest.toml

* Auto-update READMEs

* cleaning

* remove config panel

* Enable LDAP (#72)

* Allow for LDAP authentication

* Change filter

---------

Co-authored-by: ericgaspar <junk.eg@free.fr>

* [autopatch] TEST BEFORE MERGE ynh_setup_source --full_replace=1 (#69)

* [autopatch] TEST BEFORE MERGE ynh_setup_source --full_replace=1

* Auto-update README

* Auto-update READMEs

---------

Co-authored-by: Yunohost-Bot <>
Co-authored-by: eric_G <46165813+ericgaspar@users.noreply.github.com>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: ericgaspar <junk.eg@free.fr>

* Update manifest.toml

* Auto-update READMEs

* Helpers 2.1 (#74)

* Update READMEs

* cleaning

* cleaning

---------

Co-authored-by: Alexandre Aubin <4533074+alexAubin@users.noreply.github.com>
Co-authored-by: Félix Piédallu <felix@piedallu.me>

* Update tests.toml

---------

Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: ericgaspar <junk.eg@free.fr>
Co-authored-by: spaced <spaced@eksoh.net>
Co-authored-by: eric_G <46165813+ericgaspar@users.noreply.github.com>
Co-authored-by: Alexandre Aubin <4533074+alexAubin@users.noreply.github.com>
This commit is contained in:
Salamandar 2024-06-24 11:39:49 +02:00 committed by GitHub
parent 7292bcef7e
commit 1e626a64ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 59 additions and 262 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
*~
*.sw[op]
.DS_Store

View file

@ -18,7 +18,7 @@ It shall NOT be edited by hand.
grocy is a web-based self-hosted groceries & household management solution for your home. grocy is a web-based self-hosted groceries & household management solution for your home.
**Shipped version:** 4.2.0~ynh1 **Shipped version:** 4.2.0~ynh2
**Demo:** <https://en.demo.grocy.info/stockoverview> **Demo:** <https://en.demo.grocy.info/stockoverview>

View file

@ -18,7 +18,7 @@ No se debe editar a mano.
grocy is a web-based self-hosted groceries & household management solution for your home. grocy is a web-based self-hosted groceries & household management solution for your home.
**Versión actual:** 4.2.0~ynh1 **Versión actual:** 4.2.0~ynh2
**Demo:** <https://en.demo.grocy.info/stockoverview> **Demo:** <https://en.demo.grocy.info/stockoverview>

View file

@ -18,7 +18,7 @@ EZ editatu eskuz.
grocy is a web-based self-hosted groceries & household management solution for your home. grocy is a web-based self-hosted groceries & household management solution for your home.
**Paketatutako bertsioa:** 4.2.0~ynh1 **Paketatutako bertsioa:** 4.2.0~ynh2
**Demoa:** <https://en.demo.grocy.info/stockoverview> **Demoa:** <https://en.demo.grocy.info/stockoverview>

View file

@ -18,7 +18,7 @@ Il NE doit PAS être modifié à la main.
grocy is a web-based self-hosted groceries & household management solution for your home. grocy is a web-based self-hosted groceries & household management solution for your home.
**Version incluse:** 4.2.0~ynh1 **Version incluse:** 4.2.0~ynh2
**Démo:** <https://en.demo.grocy.info/stockoverview> **Démo:** <https://en.demo.grocy.info/stockoverview>

View file

@ -18,7 +18,7 @@ NON debe editarse manualmente.
grocy is a web-based self-hosted groceries & household management solution for your home. grocy is a web-based self-hosted groceries & household management solution for your home.
**Versión proporcionada:** 4.2.0~ynh1 **Versión proporcionada:** 4.2.0~ynh2
**Demo:** <https://en.demo.grocy.info/stockoverview> **Demo:** <https://en.demo.grocy.info/stockoverview>

View file

@ -18,7 +18,7 @@
grocy is a web-based self-hosted groceries & household management solution for your home. grocy is a web-based self-hosted groceries & household management solution for your home.
**分发版本:** 4.2.0~ynh1 **分发版本:** 4.2.0~ynh2
**演示:** <https://en.demo.grocy.info/stockoverview> **演示:** <https://en.demo.grocy.info/stockoverview>

View file

@ -81,7 +81,7 @@ Setting('DISABLE_AUTH', false);
// Either "Grocy\Middleware\DefaultAuthMiddleware", "Grocy\Middleware\ReverseProxyAuthMiddleware" // Either "Grocy\Middleware\DefaultAuthMiddleware", "Grocy\Middleware\ReverseProxyAuthMiddleware"
// or any class that implements Grocy\Middleware\AuthMiddleware // or any class that implements Grocy\Middleware\AuthMiddleware
Setting('AUTH_CLASS', 'Grocy\Middleware\DefaultAuthMiddleware'); Setting('AUTH_CLASS', 'Grocy\Middleware\LdapAuthMiddleware');
// Options when using ReverseProxyAuthMiddleware // Options when using ReverseProxyAuthMiddleware
Setting('REVERSE_PROXY_AUTH_HEADER', 'REMOTE_USER'); // The name of the HTTP header which your reverse proxy uses to pass the username (on successful authentication) Setting('REVERSE_PROXY_AUTH_HEADER', 'REMOTE_USER'); // The name of the HTTP header which your reverse proxy uses to pass the username (on successful authentication)
@ -92,8 +92,8 @@ Setting('LDAP_ADDRESS', 'ldap://127.0.0.1:389'); // Example value "ldap://vm-dc2
Setting('LDAP_BASE_DN', 'ou=users,dc=yunohost,dc=org'); // Example value "DC=local,DC=berrnd,DC=net" Setting('LDAP_BASE_DN', 'ou=users,dc=yunohost,dc=org'); // Example value "DC=local,DC=berrnd,DC=net"
Setting('LDAP_BIND_DN', ''); // Example value "CN=grocy_bind_account,OU=service_accounts,DC=local,DC=berrnd,DC=net" Setting('LDAP_BIND_DN', ''); // Example value "CN=grocy_bind_account,OU=service_accounts,DC=local,DC=berrnd,DC=net"
Setting('LDAP_BIND_PW', ''); // Password for the above account Setting('LDAP_BIND_PW', ''); // Password for the above account
Setting('LDAP_USER_FILTER', ''); // Example value "(OU=grocy_users)" Setting('LDAP_USER_FILTER', '(&(|(objectclass=posixAccount))(permission=cn=__APP__.main,ou=permission,dc=yunohost,dc=org))'); // Example value "(OU=grocy_users)"
Setting('LDAP_UID_ATTR', ''); // Windows AD: "sAMAccountName", OpenLDAP: "uid", GLAuth: "cn" Setting('LDAP_UID_ATTR', 'uid'); // Windows AD: "sAMAccountName", OpenLDAP: "uid", GLAuth: "cn"
// Default permissions for new users // Default permissions for new users
// the array needs to contain the technical/constant names // the array needs to contain the technical/constant names

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

@ -12,7 +12,7 @@ location __PATH__/ {
location ~ [^/]\.php(/|$) { location ~ [^/]\.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;
include /etc/nginx/fastcgi_params; include /etc/nginx/fastcgi_params;

View file

@ -5,7 +5,7 @@ name = "Grocy"
description.en = "Web-based groceries & household management solution for your home" description.en = "Web-based groceries & household management solution for your home"
description.fr = "Solution Web de gestion d'épicerie et de gestion de la maison" description.fr = "Solution Web de gestion d'épicerie et de gestion de la maison"
version = "4.2.0~ynh1" version = "4.2.0~ynh2"
maintainers = [] maintainers = []
@ -16,11 +16,12 @@ demo = "https://en.demo.grocy.info/stockoverview"
code = "https://github.com/grocy/grocy" code = "https://github.com/grocy/grocy"
[integration] [integration]
yunohost = ">= 11.2" yunohost = ">= 11.2.16"
helpers_version = "2.1"
architectures = "all" architectures = "all"
multi_instance = true multi_instance = true
ldap = true ldap = false
sso = false sso = false
@ -64,4 +65,4 @@ ram.runtime = "50M"
api.protected = true api.protected = true
[resources.apt] [resources.apt]
packages = "php8.2-ldap, php8.2-mbstring, php8.2-fileinfo, php8.2-sqlite3, php8.2-gd, php8.2-intl" packages = "php8.3-ldap, php8.3-mbstring, php8.3-fileinfo, php8.3-sqlite3, php8.3-gd, php8.3-intl"

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

@ -1,40 +1,27 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts #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
#================================================= 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"
#================================================= #=================================================
# BACKUP THE NGINX 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 "/etc/php/$php_version/fpm/pool.d/$app.conf"
# BACKUP THE PHP-FPM CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#================================================= #=================================================
# 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

@ -1,25 +1,17 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# STANDARD MODIFICATIONS
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 ynh_script_progression "Updating NGINX web server configuration..."
ynh_change_url_nginx_config ynh_config_change_url_nginx
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Change of URL completed for $app" --last ynh_script_progression "Change of URL completed for $app"

View file

@ -1,95 +0,0 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
#=================================================
# SPECIFIC GETTERS FOR TOML SHORT KEY
#=================================================
get__fpm_footprint() {
# Free footprint value for php-fpm
# Check if current_fpm_footprint is an integer
if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
then
echo "specific"
else
echo "$current_fpm_footprint"
fi
}
get__free_footprint() {
# Free footprint value for php-fpm
# Check if current_fpm_footprint is an integer
if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
then
# If current_fpm_footprint is an integer, that's a numeric value for the footprint
echo "$current_fpm_footprint"
else
echo "0"
fi
}
#=================================================
# SPECIFIC SETTERS FOR TOML SHORT KEYS
#=================================================
set__fpm_footprint() {
if [ "$fpm_footprint" != "specific" ]
then
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_footprint"
fi
}
set__fpm_free_footprint() {
if [ "$fpm_footprint" = "specific" ]
then
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_free_footprint"
fi
}
#=================================================
# GENERIC FINALIZATION
#=================================================
ynh_app_config_validate() {
_ynh_app_config_validate
if [ "${changed[fpm_usage]}" == "true" ] || [ "${changed[fpm_footprint]}" == "true" ] || [ "${changed[fpm_free_footprint]}" == "true" ]; then
# If fpm_footprint is set to 'specific', use $fpm_free_footprint value.
if [ "$fpm_footprint" = "specific" ]
then
fpm_footprint=$fpm_free_footprint
fi
if [ "$fpm_footprint" == "0" ]
then
ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below."
exit 0
fi
fi
}
ynh_app_config_apply() {
_ynh_app_config_apply
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
}
ynh_app_config_run $1

View file

@ -1,34 +1,12 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
fpm_footprint="low"
fpm_free_footprint=0
fpm_usage="low"
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
#================================================= #=================================================
# 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"
@ -38,18 +16,18 @@ chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=10 ynh_script_progression "Configuring NGINX web server..."
ynh_add_nginx_config ynh_config_add_nginx
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint ynh_config_add_phpfpm
#================================================= #=================================================
# MODIFY A CONFIG FILE # MODIFY A CONFIG FILE
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_script_progression "Adding $app's configuration..."
ynh_add_config --template="config-dist.php" --destination="$install_dir/data/config.php" ynh_config_add --template="config-dist.php" --destination="$install_dir/data/config.php"
chmod 400 "$install_dir/data/config.php" chmod 400 "$install_dir/data/config.php"
chown $app "$install_dir/data/config.php" chown $app "$install_dir/data/config.php"
@ -58,4 +36,4 @@ chown $app "$install_dir/data/config.php"
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of $app completed" --last ynh_script_progression "Installation of $app completed"

View file

@ -1,25 +1,19 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 ynh_script_progression "Removing NGINX web server configuration..."
ynh_remove_nginx_config ynh_config_remove_nginx
ynh_remove_fpm_config ynh_config_remove_phpfpm
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Removal of $app completed" --last ynh_script_progression "Removal of $app completed"

View file

@ -1,11 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts #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
@ -13,9 +7,9 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring $app main directory..." --weight=5 ynh_script_progression "Restoring $app main directory..."
ynh_restore_file --origin_path="$install_dir" ynh_restore "$install_dir"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir" chown -R $app:www-data "$install_dir"
@ -23,24 +17,22 @@ chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# RESTORE THE PHP-FPM CONFIGURATION # RESTORE THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restoring PHP-FPM configuration..." --weight=1 ynh_script_progression "Restoring PHP-FPM configuration..."
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"
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM
#================================================= #=================================================
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_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" --last ynh_script_progression "Restoration completed for $app"

View file

@ -1,54 +1,16 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If fpm_footprint doesn't exist, create it
if [ -z "${fpm_footprint:-}" ]; then
fpm_footprint=low
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
fi
# If fpm_free_footprint doesn't exist, create it
if [ -z "${fpm_free_footprint:-}" ]; then
fpm_free_footprint=0
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
fi
# If fpm_usage doesn't exist, create it
if [ -z "${fpm_usage:-}" ]; then
fpm_usage=low
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
fi
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression "Upgrading source files..."
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=5
ynh_setup_source --dest_dir="$install_dir" --keep="data" ynh_setup_source --dest_dir="$install_dir" --keep="data"
ynh_secure_remove --file="$install_dir/data/viewcache/*"
fi ynh_safe_rm "$install_dir/data/viewcache/*"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir" chown -R $app:www-data "$install_dir"
@ -56,23 +18,22 @@ chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 ynh_script_progression "Upgrading NGINX web server configuration..."
ynh_add_nginx_config ynh_config_add_nginx
# Create a dedicated php-fpm config ynh_config_add_phpfpm
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
#================================================= #=================================================
# MODIFY A CONFIG FILE # MODIFY A CONFIG FILE
#================================================= #=================================================
#ynh_add_config --template="../conf/config-dist.php" --destination="$install_dir/data/config.php" ynh_config_add --template="config-dist.php" --destination="$install_dir/data/config.php"
#chmod 400 "$install_dir/data/config.php" chmod 400 "$install_dir/data/config.php"
#chown $app "$install_dir/data/config.php" chown $app "$install_dir/data/config.php"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of $app completed" --last ynh_script_progression "Upgrade of $app completed"

View file

@ -4,4 +4,4 @@ test_format = 1.0
exclude = ["install.subdir"] exclude = ["install.subdir"]
test_upgrade_from.b9c2675f.name = "Upgrade from 3.2.0" #test_upgrade_from.b9c2675f.name = "Upgrade from 3.2.0"