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 #4 from YunoHost-Apps/testing

Fix install in private mode
This commit is contained in:
antoine 2020-06-13 08:37:17 +02:00 committed by GitHub
commit f9f53fe0e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 133 additions and 74 deletions

View file

@ -1,6 +1,11 @@
# PetitesAnnonces for YunoHost
[![Integration level](https://dash.yunohost.org/integration/petitesannonces.svg)](https://dash.yunohost.org/appci/app/petitesannonces)
[
![](https://dash.yunohost.org/integration/petitesannonces.svg)
![](https://ci-apps.yunohost.org/ci/badges/petitesannonces.status.svg)
![](https://ci-apps.yunohost.org/ci/badges/petitesannonces.maintain.svg)
](https://dash.yunohost.org/appci/app/petitesannonces)
[![Install petitesannonces with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=petitesannonces)
*[Lire ce readme en français.](./README_fr.md)*
@ -12,7 +17,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to
Make your own classified advertising website easily.
**Shipped version:** 0.1.0-ynh1
**Shipped version:** 0.1.0~ynh2
## Screenshots
@ -22,12 +27,10 @@ Make your own classified advertising website easily.
## Demo
* [Official demo](Link to a demo site for this app)
-->
## Configuration
How to configure this app: by an admin panel, a plain file with SSH, or any other way.
-->
How to configure this app: From an admin panel, a plain file with SSH, or any other way.
## Documentation
@ -36,14 +39,14 @@ How to configure this app: by an admin panel, a plain file with SSH, or any othe
## YunoHost specific features
#### Multi-users support
#### Multi-user support
Are LDAP and HTTP auth supported? : No
Can the app be used by multiple users? : No
#### Supported architectures
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/petitesannonces%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/petitesannonces/)
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/petitesannonces%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/petitesannonces/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/petitesannonces%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/petitesannonces/)
## Limitations
@ -52,9 +55,9 @@ Can the app be used by multiple users? : No
## Additional information
* Other information you would add about this application
* Other info you would like to add about this app.
**More information on the documentation page:**
**More info on the documentation page:**
https://yunohost.org/packaging_apps
## Links
@ -66,11 +69,11 @@ https://yunohost.org/packaging_apps
---
Developers info
Developer info
----------------
**Only if you want to use a testing branch for coding, instead of merging directly into master.**
Please do 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.
```

View file

@ -1,12 +1,17 @@
# PetitesAnnonces pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/petitesannonces.svg)](https://dash.yunohost.org/appci/app/petitesannonces)
[
![](https://dash.yunohost.org/integration/petitesannonces.svg)
![](https://ci-apps.yunohost.org/ci/badges/petitesannonces.status.svg)
![](https://ci-apps.yunohost.org/ci/badges/petitesannonces.maintain.svg)
](https://dash.yunohost.org/appci/app/petitesannonces)
[![Installer petitesannonces avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=petitesannonces)
*[Read this readme in english.](./README.md)*
> *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, consultez [le guide](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble
@ -19,7 +24,7 @@ Les fonctionnalités de cette outils sont :
* Possibilité d'envoyer un message à celui qui a déposé l'annonce
**Version incluse:** 0.1.0-ynh1
**Version incluse:** 0.1.0~ynh2
## Captures d'écran
@ -28,15 +33,12 @@ Les fonctionnalités de cette outils sont :
<!--
## Démo
* [Démo officielle](Lien vers un site de démonstration pour cette application)
* [Démo officielle](Lien vers un site de démonstration de cette application)
-->
## Configuration
Comment configurer cette application: via le panneau d'administration, un fichier brut en SSH ou tout autre moyen.
-->
## Documentation
* Documentation officielle: https://framagit.org/anto1ne/petitesannonces
@ -44,7 +46,7 @@ Comment configurer cette application: via le panneau d'administration, un fichie
## Caractéristiques spécifiques YunoHost
#### Support multi-utilisateurs
#### Support multi-utilisateur
L'authentification LDAP et HTTP est-elle prise en charge? : Non
L'application peut-elle être utilisée par plusieurs utilisateurs? : Non
@ -53,7 +55,6 @@ L'application peut-elle être utilisée par plusieurs utilisateurs? : Non
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/petitesannonces%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/petitesannonces/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/petitesannonces%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/petitesannonces/)
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/petitesannonces%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/petitesannonces/)
## Limitations
@ -61,7 +62,7 @@ L'application peut-elle être utilisée par plusieurs utilisateurs? : Non
## Informations additionnelles
* Autres informations à ajouter sur cette application : RAS
* Autres informations que vous souhaitez ajouter sur cette application : RAS
**Plus d'informations sur la page de documentation:**
https://yunohost.org/packaging_apps

View file

@ -18,7 +18,7 @@ location __PATH__/ {
try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_index index.php;
include fastcgi_params;

View file

@ -33,7 +33,7 @@ group = __USER__
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock
listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock
; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD)

46
issue_template.md Normal file
View file

@ -0,0 +1,46 @@
---
name: Bug report
about: Create a report to help us debug, it would be nice to fill the template as much as you can to help us, help you and help us all.
---
**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 PetitesAnnonces itself. Refer to its documentation or repository for help.*
- *If you have a doubt, post here, 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.*
**Versions**
- 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`*
**To Reproduce**
*Steps to reproduce the behavior.*
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install PetitesAnnonces
```
- *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**
*After a failed command, YunoHost makes the log available to you, but also to others, thanks to `yunohost log display [log name] --share`. The actual command, with the correct log name, is displayed at the end of the failed attempt in the CLI. Execute it and copy here the share link it outputs.*
*If applicable and useful, add screenshots to help explain your problem.*

View file

@ -5,7 +5,7 @@
#=================================================
# dependencies used by the app
pkg_dependencies="deb1 deb2"
pkg_dependencies="deb1 deb2 php$YNH_DEFAULT_PHP_VERSION-deb1 php$YNH_DEFAULT_PHP_VERSION-deb2"
#=================================================
# PERSONAL HELPERS

View file

@ -24,55 +24,46 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --time --weight=1
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# STANDARD BACKUP STEPS
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --time --weight=1
ynh_print_info --message="Declaring files to be backed up..."
#ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs
### to be backuped and not an actual copy of any file. The actual backup that
### creates and fill the archive with the files happens in the core after this
### script is called. Hence ynh_backups calls takes basically 0 seconds to run.
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Backing up the main app directory..." --time --weight=1
ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Backing up nginx web server configuration..." --time --weight=1
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Backing up php-fpm configuration..." --time --weight=1
ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Backing up the MySQL database..." --time --weight=1
ynh_mysql_dump_db --database="$db_name" > db.sql
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# BACKUP FAIL2BAN CONFIGURATION
#=================================================
ynh_script_progression --message="Backing up fail2ban configuration..." --time --weight=1
#ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
#ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
@ -82,32 +73,35 @@ ynh_script_progression --message="Backing up fail2ban configuration..." --time -
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_script_progression --message="Backing up logrotate configuration..." --time --weight=1
#ynh_backup --src_path="/etc/logrotate.d/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_script_progression --message="Backing up systemd configuration..." --time --weight=1
#ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# BACKUP A CRON FILE
# BACKUP VARIOUS FILES
#=================================================
#ynh_backup --src_path="/etc/cron.d/$app"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
#ynh_backup --src_path="/etc/$app/"
#ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_print_info --message="Backing up the MySQL database..."
### (However, things like mysql dumps *do* take some time to run, though the
### copy of the generated dump to the archive still happens later)
ynh_mysql_dump_db --database="$db_name" > db.sql
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -231,7 +231,12 @@ ynh_systemd_action --service_name=nginx --action=reload
# Installation with curl
ynh_script_progression --message="Finalizing installation..." --time --weight=1
#ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3"
#ynh_local_curl "/install.php"
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"
# Remove the public access
if [ $is_public -eq 0 ]
@ -247,11 +252,6 @@ fi
### (It's compatible with sed regular expressions syntax)
#ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$final_path/CONFIG_FILE"
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"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
@ -309,17 +309,26 @@ ynh_script_progression --message="Configuring log rotation..." --time --weight=1
### If you're not using these lines:
### - You can remove these files in conf/.
### - Remove the section "REMOVE SERVICE FROM ADMIN PANEL" in the remove script
### - As well as the section "ADVERTISE SERVICE IN ADMIN PANEL" in the restore script
### - As well as the section "INTEGRATE SERVICE IN YUNOHOST" in the restore script
#yunohost service add $app --description "A short description of the app" --log "/var/log/$app/$app.log"
### With YunoHost 3.8 you will then be able to:
### - specify a list of ports that needs to be publicly exposed (c.f. --needs_exposed_ports)
### which will then be checked by YunoHost's diagnosis system
### - specify a custom command to check the status of the service (c.f. --test_status)
### though it's only needed for weird cases where 'systemctl status' doesn't do a good job
### - specify a custom command to check / validate the configuration of the service (c.f. --test_conf)
### for example, the command to check the configuration of nginx is "nginx -t"
### Additional options starting with 3.8:
###
### --needs_exposed_ports "$port" a list of ports that needs to be publicly exposed
### which will then be checked by YunoHost's diagnosis system
### (N.B. DO NOT USE THIS is the port is only internal !!!)
###
### --test_status "some command" a custom command to check the status of the service
### (only relevant if 'systemctl status' doesn't do a good job)
###
### --test_conf "some command" some command similar to "nginx -t" that validates the conf of the service
###
### Re-calling 'yunohost service add' during the upgrade script is the right way
### to proceed if you later realize that you need to enable some flags that
### weren't enabled on old installs (be careful it'll override the existing
### service though so you should re-provide all relevant flags when doing so)
###
#=================================================
# START SYSTEMD SERVICE

View file

@ -97,7 +97,7 @@ ynh_remove_logrotate
if yunohost firewall list | grep -q "\- $port$"
then
ynh_script_progression --message="Closing port $port..."
ynh_script_progression --message="Closing port $port..." --time --weight=1
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
@ -112,7 +112,7 @@ ynh_script_progression --message="Removing fail2ban configuration..." --time --w
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE THE CRON FILE
# REMOVE VARIOUS FILES
#=================================================
# Remove a cron file

View file

@ -24,7 +24,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..." --time --weight=1
ynh_script_progression --message="Loading installation settings..." --time --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -33,6 +33,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -78,7 +79,7 @@ chown -R root: $final_path
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf"
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# RESTORE FAIL2BAN CONFIGURATION
@ -130,11 +131,13 @@ ynh_script_progression --message="Starting a systemd service..." --time --weight
#ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# RESTORE THE CRON FILE
# RESTORE VARIOUS FILES
#=================================================
#ynh_restore_file --origin_path="/etc/cron.d/$app"
#ynh_restore_file --origin_path="/etc/$app/"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
@ -148,7 +151,7 @@ ynh_script_progression --message="Starting a systemd service..." --time --weight
#=================================================
ynh_script_progression --message="Reloading nginx web server and php-fpm..." --time --weight=1
ynh_systemd_action --service_name=php7.0-fpm --action=reload
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
#=================================================

View file

@ -160,12 +160,15 @@ ynh_replace_string --match_string="votre_mdp_de_bdd" --replace_string=$db_pwd --
#=================================================
# STORE THE CONFIG FILE CHECKSUM
# MODIFY A CONFIG FILE
#=================================================
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
#ynh_backup_if_checksum_is_different --file="$final_path/CONFIG_FILE"
#ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$final_path/CONFIG_FILE"
# Recalculate and store the checksum of the file for the next upgrade.
#ynh_store_file_checksum --file="$final_path/CONFIG_FILE"