1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/petitesannonces_ynh.git synced 2024-09-03 19:56:31 +02:00

Merge pull request #11 from YunoHost-Apps/testing

Testing
This commit is contained in:
Éric Gaspar 2022-10-14 09:33:54 +02:00 committed by GitHub
commit 323e03d985
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 86 additions and 89 deletions

View file

@ -5,7 +5,7 @@ It shall NOT be edited by hand.
# PetitesAnnonces for YunoHost # PetitesAnnonces for YunoHost
[![Integration level](https://dash.yunohost.org/integration/petitesannonces.svg)](https://dash.yunohost.org/appci/app/petitesannonces) ![](https://ci-apps.yunohost.org/ci/badges/petitesannonces.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/petitesannonces.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/petitesannonces.svg)](https://dash.yunohost.org/appci/app/petitesannonces) ![Working status](https://ci-apps.yunohost.org/ci/badges/petitesannonces.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/petitesannonces.maintain.svg)
[![Install PetitesAnnonces with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=petitesannonces) [![Install PetitesAnnonces with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=petitesannonces)
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
@ -19,28 +19,27 @@ Make your own classified advertising website easily
**Shipped version:** 0.1.0~ynh2 **Shipped version:** 0.1.0~ynh2
## Screenshots ## Screenshots
![](./doc/screenshots/demo.png) ![Screenshot of PetitesAnnonces](./doc/screenshots/demo.png)
## Documentation and resources ## Documentation and resources
* Official app website: https://framagit.org/toitoinebzh/petitesannonces * Official app website: <https://framagit.org/toitoinebzh/petitesannonces>
* Upstream app code repository: https://framagit.org/toitoinebzh/petitesannonces * Upstream app code repository: <https://framagit.org/toitoinebzh/petitesannonces>
* YunoHost documentation for this app: https://yunohost.org/app_petitesannonces * YunoHost documentation for this app: <https://yunohost.org/app_petitesannonces>
* Report a bug: https://github.com/YunoHost-Apps/petitesannonces_ynh/issues * Report a bug: <https://github.com/YunoHost-Apps/petitesannonces_ynh/issues>
## Developer info ## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/petitesannonces_ynh/tree/testing). Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/petitesannonces_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/petitesannonces_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/petitesannonces_ynh/tree/testing --debug
or or
sudo yunohost app upgrade petitesannonces -u https://github.com/YunoHost-Apps/petitesannonces_ynh/tree/testing --debug sudo yunohost app upgrade petitesannonces -u https://github.com/YunoHost-Apps/petitesannonces_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.
-->
# PetitesAnnonces pour YunoHost # PetitesAnnonces pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/petitesannonces.svg)](https://dash.yunohost.org/appci/app/petitesannonces) ![](https://ci-apps.yunohost.org/ci/badges/petitesannonces.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/petitesannonces.maintain.svg) [![Niveau d'intégration](https://dash.yunohost.org/integration/petitesannonces.svg)](https://dash.yunohost.org/appci/app/petitesannonces) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/petitesannonces.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/petitesannonces.maintain.svg)
[![Installer PetitesAnnonces avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=petitesannonces) [![Installer PetitesAnnonces avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=petitesannonces)
*[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 PetitesAnnonces rapidement et simplement sur un serveur YunoHost. > *Ce package vous permet d'installer PetitesAnnonces 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.*
@ -15,28 +19,27 @@ Créer simplement et rapidement votre site de Petites Annonces
**Version incluse :** 0.1.0~ynh2 **Version incluse :** 0.1.0~ynh2
## Captures d'écran ## Captures d'écran
![](./doc/screenshots/demo.png) ![Capture d'écran de PetitesAnnonces](./doc/screenshots/demo.png)
## Documentations et ressources ## Documentations et ressources
* Site officiel de l'app : https://framagit.org/toitoinebzh/petitesannonces * Site officiel de l'app : <https://framagit.org/toitoinebzh/petitesannonces>
* Dépôt de code officiel de l'app : https://framagit.org/toitoinebzh/petitesannonces * Dépôt de code officiel de l'app : <https://framagit.org/toitoinebzh/petitesannonces>
* Documentation YunoHost pour cette app : https://yunohost.org/app_petitesannonces * Documentation YunoHost pour cette app : <https://yunohost.org/app_petitesannonces>
* Signaler un bug : https://github.com/YunoHost-Apps/petitesannonces_ynh/issues * Signaler un bug : <https://github.com/YunoHost-Apps/petitesannonces_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/petitesannonces_ynh/tree/testing). Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/petitesannonces_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/petitesannonces_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/petitesannonces_ynh/tree/testing --debug
ou ou
sudo yunohost app upgrade petitesannonces -u https://github.com/YunoHost-Apps/petitesannonces_ynh/tree/testing --debug sudo yunohost app upgrade petitesannonces -u https://github.com/YunoHost-Apps/petitesannonces_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>

21
conf/config.php Normal file
View file

@ -0,0 +1,21 @@
<?php
/* Réglages MySQL - Votre hébergeur doit vous fournir ces informations. */
/* Adresse de l'hébergement MySQL. */
define('DB_HOST', 'localhost');
/* Nom de la base de données de WordPress. */
define('DB_NAME', '__DB_NAME__');
//define('DB_NAME', 'bdd_test');
/* Utilisateur de la base de données MySQL. */
define('DB_USER', '__DB_USER__');
//define('DB_USER', 'antoine');
/* Mot de passe de la base de données MySQL. */
define('DB_PASSWORD', '__DB_PWD__');
//define('DB_PASSWORD', 'secret');
?>

View file

@ -4,16 +4,10 @@ location __PATH__/ {
# Path to source # Path to source
alias __FINALPATH__/ ; alias __FINALPATH__/ ;
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
### Example PHP configuration (remove it if not used)
index index.php; index index.php;
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file # 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;
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
@ -26,7 +20,6 @@ location __PATH__/ {
fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
### End of PHP configuration part
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;

View file

@ -419,8 +419,8 @@ chdir = __FINALPATH__
;php_admin_value[memory_limit] = 32M ;php_admin_value[memory_limit] = 32M
; Common values to change to increase file upload limit ; Common values to change to increase file upload limit
; php_admin_value[upload_max_filesize] = 50M php_admin_value[upload_max_filesize] = 50M
; php_admin_value[post_max_size] = 50M php_admin_value[post_max_size] = 50M
; php_admin_flag[mail.add_x_header] = Off ; php_admin_flag[mail.add_x_header] = Off
; Other common parameters ; Other common parameters

View file

@ -19,20 +19,19 @@
"email": "antoine@miaou.org" "email": "antoine@miaou.org"
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.2.4" "yunohost": ">= 4.3.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
"nginx", "nginx",
"php7.3-fpm", "php7.4-fpm",
"mysql" "mysql"
], ],
"arguments": { "arguments": {
"install" : [ "install" : [
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain"
"example": "example.com"
}, },
{ {
"name": "path", "name": "path",

View file

@ -4,7 +4,7 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
YNH_PHP_VERSION="7.3" YNH_PHP_VERSION="7.4"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -79,6 +79,14 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$final_path"
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
# Create a dedicated php-fpm config
ynh_add_fpm_config
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -88,12 +96,14 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1
ynh_add_nginx_config ynh_add_nginx_config
#================================================= #=================================================
# PHP-FPM CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 ynh_script_progression --message="Adding a configuration file..." --weight=1
# Create a dedicated php-fpm config ynh_add_config --template="../conf/config.php" --destination="$final_path/conf/config.php"
ynh_add_fpm_config
chmod 400 "$final_path/conf/config.php"
chown $app:$app "$final_path/conf/config.php"
#================================================= #=================================================
# SETUP APPLICATION WITH CURL # SETUP APPLICATION WITH CURL
@ -107,10 +117,6 @@ ynh_systemd_action --service_name=nginx --action=reload
# Installation with curl # Installation with curl
ynh_script_progression --message="Finalizing installation..." --weight=1 ynh_script_progression --message="Finalizing installation..." --weight=1
ynh_replace_string --match_string="votre_nom_de_bdd" --replace_string=$db_name --target_file="$final_path/conf/config.php"
ynh_replace_string --match_string="votre_utilisateur_de_bdd" --replace_string=$db_user --target_file="$final_path/conf/config.php"
ynh_replace_string --match_string="votre_mdp_de_bdd" --replace_string=$db_pwd --target_file="$final_path/conf/config.php"
ynh_local_curl "/install.php" ynh_local_curl "/install.php"
# Supprimer install.php # Supprimer install.php
@ -122,9 +128,11 @@ ynh_secure_remove --file=$final_path/install.php
ynh_script_progression --message="Configuring permissions..." --weight=1 ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary # Make app public if necessary
if [ $is_public -eq 0 ] if [ $is_public -eq 1 ]
then then
ynh_permission_update --permission="main" --remove="visitors" # Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
fi fi
#================================================= #=================================================

View file

@ -23,17 +23,6 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
# Remove the service from the list of services known by Yunohost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_script_progression --message="Removing $app service..." --weight=1
#yunohost service remove $app
fi
#================================================= #=================================================
# REMOVE THE MYSQL DATABASE # REMOVE THE MYSQL DATABASE
#================================================= #=================================================
@ -66,14 +55,6 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
# Remove the dedicated php-fpm config # Remove the dedicated php-fpm config
ynh_remove_fpm_config ynh_remove_fpm_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config
ynh_remove_logrotate
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -40,19 +40,11 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1 ynh_script_progression --message="Validating restoration parameters..." --weight=1
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \ test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path " || ynh_die --message="There is already a directory: $final_path "
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
@ -75,9 +67,17 @@ chown -R $app:www-data "$final_path"
#================================================= #=================================================
# RESTORE THE PHP-FPM CONFIGURATION # RESTORE THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================

View file

@ -77,21 +77,13 @@ 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" ynh_setup_source --dest_dir="$final_path" --keep="conf/config.php"
fi fi
chmod 750 "$final_path" chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated nginx config
ynh_add_nginx_config
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
@ -100,19 +92,20 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
# Create a dedicated php-fpm config # Create a dedicated php-fpm config
ynh_add_fpm_config ynh_add_fpm_config
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated nginx config
ynh_add_nginx_config
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#================================================= #=================================================
# Supprimer install.php # Supprimer install.php
ynh_secure_remove --file="$final_path/install.php" ynh_secure_remove --file="$final_path/install.php"
# Restaurer config.php
# ynh_restore_file $final_path/conf/config.php # pas autorisé dans upgrade
# autre piste
ynh_replace_string --match_string="votre_nom_de_bdd" --replace_string=$db_name --target_file="$final_path/conf/config.php"
ynh_replace_string --match_string="votre_utilisateur_de_bdd" --replace_string=$db_user --target_file="$final_path/conf/config.php"
ynh_replace_string --match_string="votre_mdp_de_bdd" --replace_string=$db_pwd --target_file="$final_path/conf/config.php"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX