Merge pull request #5 from YunoHost-Apps/example

Apply last example_ynh
This commit is contained in:
yalh76 2022-06-04 01:18:14 +02:00 committed by GitHub
commit 08025b2ea6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 120 additions and 101 deletions

View file

@ -5,7 +5,7 @@ It shall NOT be edited by hand.
# Easy!Appointments for YunoHost # Easy!Appointments for YunoHost
[![Integration level](https://dash.yunohost.org/integration/easyappointments.svg)](https://dash.yunohost.org/appci/app/easyappointments) ![](https://ci-apps.yunohost.org/ci/badges/easyappointments.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/easyappointments.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/easyappointments.svg)](https://dash.yunohost.org/appci/app/easyappointments) ![Working status](https://ci-apps.yunohost.org/ci/badges/easyappointments.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/easyappointments.maintain.svg)
[![Install Easy!Appointments with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=easyappointments) [![Install Easy!Appointments with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=easyappointments)
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
@ -35,25 +35,26 @@ The application is designed to be flexible enough so that it can handle any ente
## Screenshots ## Screenshots
![](./doc/screenshots/screenshots.png) ![Screenshot of Easy!Appointments](./doc/screenshots/screenshots.png)
## Documentation and resources ## Documentation and resources
* Official app website: https://easyappointments.org/ * Official app website: <https://easyappointments.org/>
* Official admin documentation: https://easyappointments.org/docs.html#1.4.3/readme.md * Official admin documentation: <https://easyappointments.org/docs.html#1.4.3/readme.md>
* Upstream app code repository: https://github.com/alextselegidis/easyappointments * Upstream app code repository: <https://github.com/alextselegidis/easyappointments>
* YunoHost documentation for this app: https://yunohost.org/app_easyappointments * YunoHost documentation for this app: <https://yunohost.org/app_easyappointments>
* Report a bug: https://github.com/YunoHost-Apps/easyappointments_ynh/issues * Report a bug: <https://github.com/YunoHost-Apps/easyappointments_ynh/issues>
## Developer info ## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/easyappointments_ynh/tree/testing). Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/easyappointments_ynh/tree/testing).
To try the testing branch, please proceed like that. To try the testing branch, please proceed like that.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/easyappointments_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/easyappointments_ynh/tree/testing --debug
or or
sudo yunohost app upgrade easyappointments -u https://github.com/YunoHost-Apps/easyappointments_ynh/tree/testing --debug sudo yunohost app upgrade easyappointments -u https://github.com/YunoHost-Apps/easyappointments_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** https://yunohost.org/packaging_apps **More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View file

@ -1,10 +1,14 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# Easy!Appointments pour YunoHost # Easy!Appointments pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/easyappointments.svg)](https://dash.yunohost.org/appci/app/easyappointments) ![](https://ci-apps.yunohost.org/ci/badges/easyappointments.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/easyappointments.maintain.svg) [![Niveau d'intégration](https://dash.yunohost.org/integration/easyappointments.svg)](https://dash.yunohost.org/appci/app/easyappointments) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/easyappointments.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/easyappointments.maintain.svg)
[![Installer Easy!Appointments avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=easyappointments) [![Installer Easy!Appointments avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=easyappointments)
*[Read this readme in english.](./README.md)* *[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Easy!Appointments rapidement et simplement sur un serveur YunoHost. > *Ce package vous permet d'installer Easy!Appointments rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
@ -31,25 +35,26 @@ The application is designed to be flexible enough so that it can handle any ente
## Captures d'écran ## Captures d'écran
![](./doc/screenshots/screenshots.png) ![Capture d'écran de Easy!Appointments](./doc/screenshots/screenshots.png)
## Documentations et ressources ## Documentations et ressources
* Site officiel de l'app : https://easyappointments.org/ * Site officiel de l'app : <https://easyappointments.org/>
* Documentation officielle de l'admin : https://easyappointments.org/docs.html#1.4.3/readme.md * Documentation officielle de l'admin : <https://easyappointments.org/docs.html#1.4.3/readme.md>
* Dépôt de code officiel de l'app : https://github.com/alextselegidis/easyappointments * Dépôt de code officiel de l'app : <https://github.com/alextselegidis/easyappointments>
* Documentation YunoHost pour cette app : https://yunohost.org/app_easyappointments * Documentation YunoHost pour cette app : <https://yunohost.org/app_easyappointments>
* Signaler un bug : https://github.com/YunoHost-Apps/easyappointments_ynh/issues * Signaler un bug : <https://github.com/YunoHost-Apps/easyappointments_ynh/issues>
## Informations pour les développeurs ## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/easyappointments_ynh/tree/testing). Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/easyappointments_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit. Pour essayer la branche testing, procédez comme suit.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/easyappointments_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/easyappointments_ynh/tree/testing --debug
ou ou
sudo yunohost app upgrade easyappointments -u https://github.com/YunoHost-Apps/easyappointments_ynh/tree/testing --debug sudo yunohost app upgrade easyappointments -u https://github.com/YunoHost-Apps/easyappointments_ynh/tree/testing --debug
``` ```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps **Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>

View file

@ -1,10 +1,8 @@
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" domain="domain.tld"
path="/path"
admin="john"
language="english"
is_public=1 is_public=1
language="english"
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=0 setup_sub_dir=0
@ -13,14 +11,12 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
#upgrade=1 from_commit=CommitHash # 1.4.3~ynh1
upgrade=1 from_commit=e7afe099868faab80c14135cc4a11c1a82128f81
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=0
change_url=1 change_url=1
;;; Options ;;; Options
Email= Email=
Notification=none Notification=none
;;; Upgrade options
; commit=CommitHash
name=Name and date of the commit.
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&

View file

@ -1,10 +1,12 @@
location / { #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
# Path to source # Path to source
alias __FINALPATH__/; alias __FINALPATH__/ ;
index index.php index.html; index index.php;
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
#client_max_body_size 50M; #client_max_body_size 50M;
try_files $uri $uri/ index.php; try_files $uri $uri/ index.php;

View file

@ -1,55 +1,55 @@
{ {
"name": "Easy!Appointments", "name": "Easy!Appointments",
"id": "easyappointments", "id": "easyappointments",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "Open Source Appointment Scheduler", "en": "Open Source Appointment Scheduler",
"fr": "Planificateur de rendez-vous Open Source" "fr": "Planificateur de rendez-vous Open Source"
}, },
"version": "1.4.3~ynh1", "version": "1.4.3~ynh1",
"url": "https://easyappointments.org/", "url": "https://easyappointments.org/",
"upstream": { "upstream": {
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"website": "https://easyappointments.org/", "website": "https://easyappointments.org/",
"demo": "https://demo.easyappointments.org/", "demo": "https://demo.easyappointments.org/",
"admindoc": "https://easyappointments.org/docs.html#1.4.3/readme.md", "admindoc": "https://easyappointments.org/docs.html#1.4.3/readme.md",
"code": "https://github.com/alextselegidis/easyappointments" "code": "https://github.com/alextselegidis/easyappointments"
},
"license": "GPL-3.0-only",
"maintainer": {
"name": "eric_G",
"email": ""
},
"requirements": {
"yunohost": ">= 4.3.0"
},
"multi_instance": true,
"services": [
"nginx",
"php7.4-fpm",
"mysql"
],
"arguments": {
"install" : [
{
"name": "domain",
"type": "domain"
}, },
{ "license": "GPL-3.0-only",
"name": "is_public", "maintainer": {
"type": "boolean", "name": "eric_G",
"default": true "email": ""
}, },
{ "requirements": {
"name": "language", "yunohost": ">= 4.3.0"
"type": "string", },
"ask": { "multi_instance": true,
"en": "Choose the application language", "services": [
"fr": "Choisissez la langue de l'application" "nginx",
}, "php7.4-fpm",
"choices": ["french", "english"], "mysql"
"default": "english" ],
} "arguments": {
] "install": [
} {
"name": "domain",
"type": "domain"
},
{
"name": "is_public",
"type": "boolean",
"default": true
},
{
"name": "language",
"type": "string",
"ask": {
"en": "Choose the application language",
"fr": "Choisissez la langue de l'application"
},
"choices": ["french", "english"],
"default": "english"
}
]
}
} }

View file

@ -4,6 +4,18 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
YNH_PHP_VERSION="7.4" YNH_PHP_VERSION="7.3"
pkg_dependencies="php${YNH_PHP_VERSION}-curl" pkg_dependencies="php${YNH_PHP_VERSION}-curl"
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -26,14 +26,17 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 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) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Add settings here as needed by your application
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
language=$(ynh_app_setting_get --app=$app --key=language) language=$(ynh_app_setting_get --app=$app --key=language)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
@ -99,7 +102,9 @@ fi
#================================================= #=================================================
# SPECIFIC MODIFICATIONS # SPECIFIC MODIFICATIONS
#================================================= #=================================================
ynh_script_progression --message="Configuring $app..." --weight=1 # UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1
domain=$new_domain domain=$new_domain

View file

@ -22,9 +22,8 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url="/" path_url="/"
language=$YNH_APP_ARG_LANGUAGE
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
phpversion=$YNH_PHP_VERSION language=$YNH_APP_ARG_LANGUAGE
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -47,8 +46,9 @@ 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=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=language --value=$language ynh_app_setting_set --app=$app --key=language --value=$language
ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion
#=================================================
# STANDARD MODIFICATIONS
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
@ -56,15 +56,13 @@ ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#=================================================
# STANDARD MODIFICATIONS
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Configuring system user..." --weight=2 ynh_script_progression --message="Configuring system user..." --weight=2
# Create a system user # 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 # CREATE A MYSQL DATABASE

View file

@ -37,14 +37,6 @@ ynh_script_progression --message="Removing the MySQL database..." --weight=4
# Remove a database if it exists, along with the associated user # Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
@ -69,6 +61,14 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=3
# Remove the dedicated PHP-FPM config # Remove the dedicated PHP-FPM config
ynh_remove_fpm_config ynh_remove_fpm_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -20,7 +20,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading settings..." --weight=1 ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -44,7 +44,7 @@ test ! -d $final_path \
#================================================= #=================================================
# RESTORE THE NGINX CONFIGURATION # RESTORE THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restoring 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" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
@ -54,7 +54,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 ynh_script_progression --message="Recreating the dedicated system user..." --weight=3
# Create the dedicated user (if not existing) # 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 # RESTORE THE APP MAIN DIR

View file

@ -27,18 +27,19 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=7 ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=7
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
ynh_clean_setup () { ynh_clean_setup () {
# restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup ynh_restore_upgradebackup
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
@ -67,19 +68,18 @@ fi
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing) # Create a 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"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Upgrading source files..." --weight=1 ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --keep="$final_path/config.php" ynh_setup_source --dest_dir="$final_path" --keep="config.php storage/"
fi fi
chmod 750 "$final_path" chmod 750 "$final_path"