Aligner le paquet sur le modèle YunoHost

This commit is contained in:
Alexandre NOEL 2026-09-04 12:23:03 +02:00
commit 7ae2307abf
16 changed files with 302 additions and 35 deletions

11
.editorconfig Normal file
View file

@ -0,0 +1,11 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
[*.toml]
indent_size = 4

2
.gitattributes vendored Normal file
View file

@ -0,0 +1,2 @@
* text=auto eol=lf
*.png binary

55
.github/ISSUE_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,55 @@
---
name: Bug report
about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
---
**How to post a meaningful bug report**
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
### Describe the bug
*A clear and concise description of what the bug is.*
### Context
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
- If yes, please explain:
- Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
### Steps to reproduce
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install the_app
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*
1. *Go to '...'*
2. *Click on '...'*
3. *Scroll down to '...'*
4. *See error*
### Expected behavior
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
### Logs
*When an operation fails, YunoHost provides a simple way to share the logs.*
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
*If applicable and useful, add screenshots to help explain your problem.*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished and ready to be reviewed/tested
- [ ] The fix/enhancement were manually tested (if applicable)
## Automatic tests
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

View file

@ -1,25 +1,46 @@
# Globinours pour YunoHost — 1.0.0-rc.3
<!--
N.B.: This README was automatically generated by <https://github.com/YunoHost/apps_tools/blob/main/readme_generator>
It shall NOT be edited by hand.
-->
<p align="center">
<img src="logo.png" alt="Logo de Globinours" width="160">
</p>
<h1>
<img src="https://raw.githubusercontent.com/YunoHost/apps/main/logos/globinours.png" width="32px" alt="Logo of Globinours">
Globinours, packaged for YunoHost
</h1>
Ce paquet installe Globinours sur un domaine ou sous-domaine dédié. Il télécharge une archive immuable de lapplication depuis le dépôt Forgejo officiel, puis vérifie son empreinte SHA-256 avant installation.
Lightweight animal shelter management
## Installation de test
[![🌐 Official app website](https://img.shields.io/badge/Official_app_website-darkgreen?style=for-the-badge)](https://globinours.fr)
[![App Demo](https://img.shields.io/badge/App_Demo-blue?style=for-the-badge)](https://demo.globinours.fr)
[![Version: 1.0.0-rc.3~ynh11](https://img.shields.io/badge/Version-1.0.0--rc.3~ynh11-rgb(18,138,11)?style=for-the-badge)](https://ci-apps.yunohost.org/ci/apps/globinours/)
Depuis un clone du paquet présent sur le serveur YunoHost :
<div align="center">
<a href="https://apps.yunohost.org/app/globinours"><img height="100px" src="https://github.com/YunoHost/yunohost-artwork/raw/refs/heads/main/badges/neopossum-badges/badge_more_info_on_the_appstore.svg"/></a>
<a href="https://github.com/YunoHost-Apps/globinours_ynh/issues"><img height="100px" src="https://github.com/YunoHost/yunohost-artwork/raw/refs/heads/main/badges/neopossum-badges/badge_report_an_issue.svg"/></a>
</div>
```bash
sudo yunohost app install /root/globinours_ynh --debug --force --no-remove-on-failure
## 📦 Developer info
[![Automatic tests level](https://apps.yunohost.org/badge/cilevel/globinours)](https://ci-apps.yunohost.org/ci/apps/globinours/)
🛠️ Upstream Globinours repository: <https://nnsprod.com/git/oversu/Globinours>
Pull request are welcome and should target the [`testing` branch](https://github.com/YunoHost-Apps/globinours_ynh/tree/testing).
The `testing` branch can be tested using:
```
# fresh install:
sudo yunohost app install https://github.com/YunoHost-Apps/globinours_ynh/tree/testing
# upgrade an existing install:
sudo yunohost app upgrade globinours -u https://github.com/YunoHost-Apps/globinours_ynh/tree/testing
```
Choisir un domaine ou sous-domaine libre. Après linstallation, ouvrir son URL et terminer la création du premier administrateur dans lassistant Globinours.
Pour tester une mise à niveau du paquet :
You can also switch to the testing branch to update from testing by default (as same as for APT when you chose to use a testing repos) with this command:
```bash
sudo yunohost app upgrade globinours -u /root/globinours_ynh --debug
sudo yunohost app setting globinours upgrade_channel -v testing
```
Globinours utilise ses propres comptes applicatifs : lintégration LDAP et lauthentification SSO YunoHost ne sont donc pas utilisées.
### 📚 App packaging documentation
Please see <https://doc.yunohost.org/dev/packaging/> for more information.

3
doc/ADMIN.md Normal file
View file

@ -0,0 +1,3 @@
Globinours stores its persistent data in `__DATA_DIR__` and its application files in `__INSTALL_DIR__`.
The application uses its own user accounts. Open the application settings to manage users, backups and maintenance operations.

3
doc/ADMIN_fr.md Normal file
View file

@ -0,0 +1,3 @@
Globinours conserve ses données persistantes dans `__DATA_DIR__` et ses fichiers applicatifs dans `__INSTALL_DIR__`.
Lapplication utilise ses propres comptes. Ouvrez ses paramètres pour gérer les utilisateurs, les sauvegardes et les opérations de maintenance.

View file

@ -5,11 +5,13 @@ id = "globinours"
name = "Globinours"
description.en = "Lightweight animal shelter management"
description.fr = "Gestion légère et complète pour refuges animaliers"
version = "1.0.0-rc.3~ynh10"
version = "1.0.0-rc.3~ynh11"
maintainers = ["OverSu"]
[upstream]
license = "AGPL-3.0-or-later"
website = "https://globinours.fr"
demo = "https://demo.globinours.fr"
code = "https://nnsprod.com/git/oversu/Globinours"
[integration]
@ -40,6 +42,7 @@ ram.runtime = "100M"
[resources.system_user]
[resources.install_dir]
[resources.data_dir]
subdirs = ["association", "grants", "medical-documents", "private-media", "media", "storage/logs", "storage/backups", "storage/releases"]
[resources.permissions]
main.url = "/"
[resources.apt]

View file

@ -1,31 +1,29 @@
#!/bin/bash
#=================================================
# COMMON VARIABLES AND CUSTOM HELPERS
#=================================================
source /usr/share/yunohost/helpers
php_upload_max_filesize="250M"
install_yunohost_logo() {
install -D -m 0644 "$YNH_APP_BASEDIR/logo.png" "/usr/share/yunohost/applogos/$app.png"
if ! yunohost app config set "$app" _core.permission_main.permission_main_logo \
--value="$YNH_APP_BASEDIR/logo.png" \
--core; then
ynh_print_warn --message="Le logo du portail YunoHost n'a pas pu être enregistré. L'installation de Globinours continue."
fi
}
prepare_persistent_paths() {
mkdir -p "$data_dir/association" "$data_dir/grants" "$data_dir/medical-documents" \
"$data_dir/private-media" "$data_dir/media" "$data_dir/storage/logs" \
"$data_dir/storage/backups" "$data_dir/storage/releases"
ynh_safe_rm "$install_dir/data"
ynh_safe_rm "$install_dir/storage"
ynh_safe_rm "$install_dir/public/media"
for path_to_replace in "$install_dir/data" "$install_dir/storage" "$install_dir/public/media"; do
if [[ -e "$path_to_replace" || -L "$path_to_replace" ]]; then
ynh_safe_rm "$path_to_replace"
fi
done
ln -s "$data_dir" "$install_dir/data"
ln -s "$data_dir/storage" "$install_dir/storage"
ln -s "$data_dir/media" "$install_dir/public/media"
chown -R "$app:www-data" "$install_dir"
chown -R "$app:$app" "$data_dir"
chmod -R u=rwX,g=rX,o= "$install_dir"
chmod -R u=rwX,g=,o= "$data_dir"
chown "$app:www-data" "$data_dir"
chmod 0710 "$data_dir"
chown -R "$app:www-data" "$data_dir/media"

View file

@ -1,6 +1,21 @@
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# DECLARE DATA TO BACK UP
#=================================================
ynh_print_info "Declaring files to be backed up..."
ynh_backup "$install_dir"
ynh_backup "$data_dir"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
ynh_print_info "Backup script completed for $app"

View file

@ -1,4 +1,23 @@
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression "Updating NGINX web server configuration..."
ynh_config_change_url_nginx
ynh_systemctl --service=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Change of URL completed for $app"

View file

@ -1,10 +1,47 @@
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
ynh_script_progression --message="Installation de Globinours..."
source /usr/share/yunohost/helpers
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Setting up source files..."
ynh_setup_source --dest_dir="$install_dir"
#=================================================
# APP INITIAL CONFIGURATION
#=================================================
prepare_persistent_paths
install_yunohost_logo
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression "Adding system configurations related to $app..."
ynh_config_add_phpfpm
ynh_config_add_nginx
#=================================================
# INITIALIZE THE APPLICATION
#=================================================
ynh_script_progression "Initializing the database..."
ynh_exec_as_app php "$install_dir/scripts/migrate.php"
ynh_systemctl --service="php$php_version-fpm" --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Installation of $app completed"

View file

@ -1,5 +1,23 @@
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
ynh_safe_rm "/usr/share/yunohost/applogos/$app.png"
source /usr/share/yunohost/helpers
#=================================================
# REMOVE SYSTEM CONFIGURATION
#=================================================
ynh_script_progression "Removing system configurations related to $app..."
ynh_config_remove_nginx
ynh_config_remove_phpfpm
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Removal of $app completed"

View file

@ -1,11 +1,38 @@
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# RESTORE FILES AND DATA
#=================================================
ynh_script_progression "Restoring application files..."
ynh_restore "$install_dir"
ynh_restore "$data_dir"
#=================================================
# RESTORE SYSTEM CONFIGURATION
#=================================================
ynh_script_progression "Restoring system configurations related to $app..."
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
prepare_persistent_paths
install_yunohost_logo
ynh_exec_as_app php "$install_dir/scripts/migrate.php"
ynh_systemctl --service="php$php_version-fpm" --action=reload
ynh_systemctl --service=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Restoration completed for $app"

View file

@ -1,19 +1,54 @@
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# CREATE AN APPLICATION BACKUP
#=================================================
if [[ -f "$install_dir/scripts/backup.php" && -f "$data_dir/refuge.sqlite" ]] && \
php -l "$install_dir/app/Services/BackupService.php" >/dev/null 2>&1; then
ynh_exec_as_app php "$install_dir/scripts/backup.php" pre-upgrade-yunohost
elif [[ -f "$data_dir/refuge.sqlite" ]]; then
ynh_print_warn --message="La sauvegarde applicative préalable est ignorée car l'ancienne version n'est pas compatible avec PHP $php_version. La sauvegarde de sécurité YunoHost reste active."
fi
#=================================================
# ENABLE MAINTENANCE MODE
#=================================================
touch "$data_dir/storage/maintenance.flag"
trap 'rm -f "$data_dir/storage/maintenance.flag"' EXIT
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Upgrading source files..."
ynh_setup_source --dest_dir="$install_dir" --full_replace --keep="data storage public/media"
#=================================================
# UPDATE APPLICATION AND SYSTEM CONFIGURATION
#=================================================
prepare_persistent_paths
install_yunohost_logo
ynh_config_add_phpfpm
ynh_config_add_nginx
ynh_exec_as_app php "$install_dir/scripts/migrate.php"
rm -f "$data_dir/storage/maintenance.flag"
trap - EXIT
ynh_systemctl --service="php$php_version-fpm" --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Upgrade of $app completed"

View file

@ -1,6 +1,10 @@
test_format = 1.0
[default]
args.init_main_permission = "visitors"
test_upgrade_from.1a45355.name = "Upgrade from 1.0.0-rc.3~ynh10"
[default.curl_tests]
home.path = "/"
home.expect_title = "Globinours"