Merge pull request #60 from YunoHost-Apps/testing

Testing
This commit is contained in:
Éric Gaspar 2021-04-23 22:54:01 +02:00 committed by GitHub
commit fbb29710c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 169 additions and 145 deletions

View file

@ -1,8 +1,15 @@
Changelog Changelog
========= =========
## Unreleased ## [1.0~ynh4](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/60) - 2021-04-23
- Nothing for now...
#### Added
* [Add a README_fr](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/60/commits/c84b7d4e97f00e2c7de10d949891cf660f1d8459)
#### Changed
* [Use php7.3](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/60/commits/b324c78780110e8eae05da47f8f151c1d50bf3c7)
* [New permissions](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/60/commits/a5cc8741477a0f37ffd1b84e08bb3dec8af34a46)
# [Normalization from example_ynh](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/60/commits/a5cc8741477a0f37ffd1b84e08bb3dec8af34a46)
## [1.0~ynh3](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/42) - 2020-01-01 ## [1.0~ynh3](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/42) - 2020-01-01

View file

@ -3,6 +3,8 @@
[![Integration level](https://dash.yunohost.org/integration/my_webapp.svg)](https://dash.yunohost.org/appci/app/my_webapp) ![](https://ci-apps.yunohost.org/ci/badges/my_webapp.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/my_webapp.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/my_webapp.svg)](https://dash.yunohost.org/appci/app/my_webapp) ![](https://ci-apps.yunohost.org/ci/badges/my_webapp.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/my_webapp.maintain.svg)
[![Install Custom Webapp with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=my_webapp) [![Install Custom Webapp with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=my_webapp)
*[Lire ce readme en français.](./README_fr.md)*
> *This package allow you to install Custom Webapp quickly and simply on a YunoHost server. > *This package allow you to install Custom Webapp quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
@ -22,10 +24,6 @@ of your custom Web application inside.
**Shipped version:** 1.0 **Shipped version:** 1.0
## Screenshots
## Demo
## Configuration ## Configuration
## Documentation ## Documentation
@ -38,8 +36,8 @@ of your custom Web application inside.
#### Supported architectures #### Supported architectures
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/my_webapp%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/my_webapp/) * x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/my_webapp.svg)](https://ci-apps.yunohost.org/ci/apps/my_webapp/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/my_webapp%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/my_webapp/) * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/my_webapp.svg)](https://ci-apps-arm.yunohost.org/ci/apps/my_webapp/)
## Limitations ## Limitations
@ -48,7 +46,7 @@ of your custom Web application inside.
#### SFTP port #### SFTP port
You may have change the SSH port as described You may have change the SSH port as described
[here (section "Modifier le port SSH"](https://yunohost.org/#/security_fr) ; [here section "Modifier le port SSH"](https://yunohost.org/#/security_fr) ;
then you should use this port to update your website with SFTP. then you should use this port to update your website with SFTP.
## Links ## Links
@ -58,10 +56,8 @@ then you should use this port to update your website with SFTP.
--- ---
Developers info ## Developers 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/my_webapp_ynh/tree/testing). Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/my_webapp_ynh/tree/testing).
To try the testing branch, please proceed like that. To try the testing branch, please proceed like that.

55
README_fr.md Normal file
View file

@ -0,0 +1,55 @@
# Application vide avec accès SFTP au répertoire Web personnalisé pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/my_webapp.svg)](https://dash.yunohost.org/appci/app/my_webapp) ![](https://ci-apps.yunohost.org/ci/badges/my_webapp.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/my_webapp.maintain.svg)
[![Installer Custom Webapp avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=my_webapp)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer une Application vide avec accès SFTP au répertoire Web personnalisé 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.*
## Vue d'ensemble
Cette application vous permet d'installer facilement une application vide personnalisée,
fourni un accès aux fichiers avec [SFTP](https://yunohost.org/#/filezilla). Elle peut également créer une base de données MySQL -
qui sera sauvegardée et restaurée avec votre application. Les détails de connexion
seront stockés dans le fichier `db_accesss.txt` situé dans le répertoire racine.
**Version incluse :** 1.0
## Configuration
## Documentation
* Documentation YunoHost : https://yunohost.org/#/app_my_webapp
## Caractéristiques spécifiques YunoHost
#### Support multi-utilisateurs
#### Architectures supportées
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/my_webapp.svg)](https://ci-apps.yunohost.org/ci/apps/my_webapp/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/my_webapp.svg)](https://ci-apps-arm.yunohost.org/ci/apps/my_webapp/)
## Limitations
## Informations additionnelles
## Liens
* Signaler un bug : https://github.com/YunoHost-Apps/my_webapp_ynh/issues
* Site web YunoHost : https://yunohost.org/
---
## Informations pour les développeurs
Merci de faire vos pull request dans la [branche testing](https://github.com/YunoHost-Apps/my_webapp_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/my_webapp_ynh/tree/testing --debug
ou
sudo yunohost app upgrade my_webapp -u https://github.com/YunoHost-Apps/my_webapp_ynh/tree/testing --debug
```

View file

@ -43,8 +43,6 @@
setup_sub_dir=1 setup_sub_dir=1
upgrade=1 upgrade=1
backup_restore=1 backup_restore=1
;;; Levels
Level 5=auto
;;; Options ;;; Options
Email= Email=
Notification=change Notification=change

View file

@ -32,7 +32,7 @@ location __PATH__/ {
# Execute and serve PHP files # Execute and serve PHP files
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.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; fastcgi_index index.php;
include fastcgi_params; include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user; fastcgi_param REMOTE_USER $remote_user;

View file

@ -8,7 +8,7 @@ name = "My webapp configuration"
name = "SFTP access" name = "SFTP access"
[main.sftp.sftp] [main.sftp.sftp]
ask = "Do you need a SFTP access ?" ask = "Do you need a SFTP access?"
type = "boolean" type = "boolean"
default = true default = true
@ -22,13 +22,13 @@ name = "My webapp configuration"
name = "Overwriting config files" name = "Overwriting config files"
[main.overwrite_files.overwrite_nginx] [main.overwrite_files.overwrite_nginx]
ask = "Overwrite the nginx config file ?" ask = "Overwrite the NGINX config file?"
type = "boolean" type = "boolean"
default = false default = false
help = "If the file is overwritten, a backup will be created." help = "If the file is overwritten, a backup will be created."
[main.overwrite_files.overwrite_phpfpm] [main.overwrite_files.overwrite_phpfpm]
ask = "Overwrite the php-fpm config file ?" ask = "Overwrite the PHP-FPM config file?"
type = "boolean" type = "boolean"
default = true default = true
help = "If the file is overwritten, a backup will be created." help = "If the file is overwritten, a backup will be created."
@ -38,19 +38,19 @@ name = "My webapp configuration"
name = "PHP-FPM configuration" name = "PHP-FPM configuration"
[main.php_fpm_config.footprint] [main.php_fpm_config.footprint]
ask = "Memory footprint of the service ?" ask = "Memory footprint of the service?"
choices = ["low", "medium", "high", "specific"] choices = ["low", "medium", "high", "specific"]
default = "low" default = "low"
help = "low <= 20Mb per pool. medium between 20Mb and 40Mb per pool. high > 40Mb per pool.<br>Use specific to set a value with the following option." help = "low <= 20Mb per pool. medium between 20Mb and 40Mb per pool. high > 40Mb per pool.<br>Use specific to set a value with the following option."
[main.php_fpm_config.free_footprint] [main.php_fpm_config.free_footprint]
ask = "Memory footprint of the service ?" ask = "Memory footprint of the service?"
type = "number" type = "number"
default = "0" default = "0"
help = "Free field to specify exactly the footprint in Mb if you don't want to use one of the three previous values." help = "Free field to specify exactly the footprint in Mb if you don't want to use one of the three previous values."
[main.php_fpm_config.usage] [main.php_fpm_config.usage]
ask = "Expected usage of the service ?" ask = "Expected usage of the service?"
choices = ["low", "medium", "high"] choices = ["low", "medium", "high"]
default = "low" default = "low"
help = "low: Personal usage, behind the sso. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.<br>medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.<br>high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding." help = "low: Personal usage, behind the sso. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.<br>medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.<br>high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding."

View file

@ -6,20 +6,24 @@
"en": "Custom Web app with SFTP access", "en": "Custom Web app with SFTP access",
"fr": "Application Web personnalisée avec accès SFTP" "fr": "Application Web personnalisée avec accès SFTP"
}, },
"version": "1.0~ynh3", "version": "1.0~ynh4",
"url": "https://github.com/YunoHost-Apps/my_webapp_ynh", "url": "https://github.com/YunoHost-Apps/my_webapp_ynh",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"maintainer": { "maintainer": {
"name": "None...",
"email": ""
},
"previous_maintainers": [{
"name": "Maniack Crudelis", "name": "Maniack Crudelis",
"email": "maniackc_dev@crudelis.fr" "email": "maniackc_dev@crudelis.fr"
}, }],
"requirements": { "requirements": {
"yunohost": ">= 3.8.0" "yunohost": ">= 4.1.7"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
"nginx", "nginx",
"php7.0-fpm", "php7.3-fpm",
"mysql" "mysql"
], ],
"arguments": { "arguments": {
@ -27,19 +31,11 @@
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain",
"ask": {
"en": "Choose a domain for your Webapp",
"fr": "Choisissez un domaine pour votre Webapp"
},
"example": "domain.org" "example": "domain.org"
}, },
{ {
"name": "path", "name": "path",
"type": "path", "type": "path",
"ask": {
"en": "Choose a path for your Webapp",
"fr": "Choisissez un chemin pour votre Webapp"
},
"example": "/site", "example": "/site",
"default": "/site" "default": "/site"
}, },
@ -56,19 +52,11 @@
"name": "password", "name": "password",
"type": "password", "type": "password",
"optional": true, "optional": true,
"ask": {
"en": "Set the password for the SFTP access.",
"fr": "Définissez le mot de passe pour l'accès SFTP."
},
"example": "myreallystrengthpassword" "example": "myreallystrengthpassword"
}, },
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
"ask": {
"en": "Is it a public website?",
"fr": "Est-ce un site public ?"
},
"default": true "default": true
}, },
{ {

View file

@ -11,14 +11,6 @@
- [ ] Upgrade from last version tested. - [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested. - [ ] Can be reviewed and tested.
## Validation ## Package_check results
--- ---
*Minor decision* * An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*
- **Upgrade previous version** :
- [ ] **Code review** :
- [ ] **Approval (LGTM)** :
- [ ] **Approval (LGTM)** :
- **CI succeeded** :
[![Build Status](https://ci-apps-hq.yunohost.org/jenkins/job/my_webapp_ynh%20PR-NUM-/badge/icon)](https://ci-apps-hq.yunohost.org/jenkins/job/my_webapp_ynh%20PR-NUM-/)
*Please replace '-NUM-' in this link by the PR number.*
When the PR is marked as ready to merge, you have to wait for 3 days before really merging it.

View file

@ -1,5 +1,11 @@
#!/bin/bash #!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
YNH_PHP_VERSION="7.3"
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================

View file

@ -40,10 +40,10 @@ fi
if [ $with_sftp -eq 1 ] if [ $with_sftp -eq 1 ]
then then
ynh_script_progression --message="Configuring ssh to add a SFTP access..." --weight=3 ynh_script_progression --message="Configuring SSH to add a SFTP access..." --weight=3
ynh_add_config --template="conf/ssh_regenconf_hook" --destination="/usr/share/yunohost/hooks/conf_regen/90-ssh_$app"
cp -R conf/ssh_regenconf_hook /usr/share/yunohost/hooks/conf_regen/90-ssh_$app
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file=/usr/share/yunohost/hooks/conf_regen/90-ssh_$app
else else
ynh_script_progression --message="Removing the custom ssh config for the SFTP access..." --weight=3 ynh_script_progression --message="Removing the custom ssh config for the SFTP access..." --weight=3

View file

@ -19,7 +19,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -28,29 +28,30 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql)
with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# STANDARD BACKUP STEPS # 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_script_progression --message="Backing up the main app directory..."
ynh_backup --src_path="$final_path" ynh_backup --src_path="$final_path"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Backing up nginx web server configuration..."
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# BACKUP THE PHP-FPM CONFIGURATION # BACKUP THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Backing up php-fpm configuration..."
ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#================================================= #=================================================
# BACKUP THE MYSQL DATABASE # BACKUP THE MYSQL DATABASE
@ -58,7 +59,7 @@ ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf"
if [ $with_mysql -eq 1 ] if [ $with_mysql -eq 1 ]
then then
ynh_script_progression --message="Backing up the MySQL database..." ynh_print_info --message="Backing up the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql ynh_mysql_dump_db --database="$db_name" > db.sql
fi fi
@ -68,7 +69,7 @@ fi
if [ $with_sftp -eq 1 ] if [ $with_sftp -eq 1 ]
then then
ynh_script_progression --message="Backup specific files..." ynh_print_info --message="Backup specific files..."
ynh_backup "/usr/share/yunohost/hooks/conf_regen/90-ssh_$app" ynh_backup "/usr/share/yunohost/hooks/conf_regen/90-ssh_$app"
fi fi
@ -77,4 +78,4 @@ fi
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=5 ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=5
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -76,25 +76,25 @@ fi
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
ynh_script_progression --message="Updating nginx web server configuration..." --weight=2 ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the nginx config file # Change the path in the NGINX config file
if [ $change_path -eq 1 ] if [ $change_path -eq 1 ]
then then
# Make a backup of the original nginx config file if modified # Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path" ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for nginx helper # Set global variables for NGINX helper
domain="$old_domain" domain="$old_domain"
path_url="$new_path" path_url="$new_path"
# Create a dedicated nginx config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
fi fi
# Change the domain for nginx # Change the domain for NGINX
if [ $change_domain -eq 1 ] if [ $change_domain -eq 1 ]
then then
# Delete file checksum for the old conf file location # Delete file checksum for the old conf file location
@ -110,7 +110,7 @@ fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload

View file

@ -45,20 +45,20 @@ else
fi fi
# Overwrite nginx configuration # Overwrite NGINX configuration
old_overwrite_nginx="$(ynh_app_setting_get --app=$app --key=overwrite_nginx)" old_overwrite_nginx="$(ynh_app_setting_get --app=$app --key=overwrite_nginx)"
overwrite_nginx="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX:-$old_overwrite_nginx}" overwrite_nginx="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX:-$old_overwrite_nginx}"
# Overwrite php-fpm configuration # Overwrite PHP-FPM configuration
old_overwrite_phpfpm="$(ynh_app_setting_get --app=$app --key=overwrite_phpfpm)" old_overwrite_phpfpm="$(ynh_app_setting_get --app=$app --key=overwrite_phpfpm)"
overwrite_phpfpm="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_PHPFPM:-$old_overwrite_phpfpm}" overwrite_phpfpm="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_PHPFPM:-$old_overwrite_phpfpm}"
# Footprint for php-fpm # Footprint for PHP-FPM
old_fpm_footprint="$(ynh_app_setting_get --app=$app --key=fpm_footprint)" old_fpm_footprint="$(ynh_app_setting_get --app=$app --key=fpm_footprint)"
fpm_footprint="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FOOTPRINT:-$old_fpm_footprint}" fpm_footprint="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FOOTPRINT:-$old_fpm_footprint}"
# Free footprint value for php-fpm # Free footprint value for PHP-FPM
# Check if fpm_footprint is an integer # Check if fpm_footprint is an integer
if [ "$fpm_footprint" -eq "$fpm_footprint" ] 2> /dev/null if [ "$fpm_footprint" -eq "$fpm_footprint" ] 2> /dev/null
then then
@ -69,7 +69,7 @@ else
fi fi
free_footprint="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FREE_FOOTPRINT:-$old_free_footprint}" free_footprint="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FREE_FOOTPRINT:-$old_free_footprint}"
# Usage for php-fpm # Usage for PHP-FPM
old_fpm_usage="$(ynh_app_setting_get --app=$app --key=fpm_usage)" old_fpm_usage="$(ynh_app_setting_get --app=$app --key=fpm_usage)"
fpm_usage="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_USAGE:-$old_fpm_usage}" fpm_usage="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_USAGE:-$old_fpm_usage}"

View file

@ -49,7 +49,6 @@ ynh_script_progression --message="Storing installation settings..."
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=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=with_mysql --value=$with_mysql ynh_app_setting_set --app=$app --key=with_mysql --value=$with_mysql
ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
@ -76,9 +75,9 @@ fi
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring nginx web server..." --weight=2 ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated nginx config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#================================================= #=================================================
@ -102,11 +101,9 @@ fi
#================================================= #=================================================
if [ $with_sftp -eq 1 ] if [ $with_sftp -eq 1 ]
then then
ynh_script_progression --message="Configuring ssh..." ynh_script_progression --message="Configuring SSH..."
cp -R ../conf/ssh_regenconf_hook /usr/share/yunohost/hooks/conf_regen/90-ssh_$app ynh_add_config --template="../conf/ssh_regenconf_hook" --destination="/usr/share/yunohost/hooks/conf_regen/90-ssh_$app"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file=/usr/share/yunohost/hooks/conf_regen/90-ssh_$app
yunohost tools regen-conf ssh yunohost tools regen-conf ssh
fi fi
@ -119,11 +116,9 @@ mkdir -p "$final_path/www"
if [ $with_sftp -eq 1 ] if [ $with_sftp -eq 1 ]
then then
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file=../sources/www/index.html
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file=../sources/www/index.html
# Copy files to the right place ynh_add_config --template="../sources/www/index.html" --destination="$final_path/www/index.html"
cp "../sources/www/index.html" "$final_path/www/index.html"
else else
# Copy files to the right place # Copy files to the right place
cp "../sources/www/index_no_sftp.html" "$final_path/www/index.html" cp "../sources/www/index_no_sftp.html" "$final_path/www/index.html"
@ -141,10 +136,11 @@ fi
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring php-fpm..." --weight=2 ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
# Create a dedicated php-fpm config # Create a dedicatedPHP-FPM config
ynh_add_fpm_config --usage=low --footprint=low ynh_add_fpm_config --usage=low --footprint=low
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
@ -160,18 +156,18 @@ chown root: "$final_path"
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring SSOwat..." ynh_script_progression --message="Configuring permissions..."
# Make app public if necessary # Make app public if necessary
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]
then then
ynh_app_setting_set --app=$app --key=skipped_uris --value="/" ynh_permission_update --permission="main" --add="visitors"
fi fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
@ -194,7 +190,7 @@ fi
if [ $with_sftp -eq 1 ] if [ $with_sftp -eq 1 ]
then then
sftp_infos="You can connect to this repository by using sftp with the following credentials. sftp_infos="You can connect to this repository by using SFTP with the following credentials.
Domain: $domain Domain: $domain
Port: $(grep "^Port" /etc/ssh/sshd_config | awk '{print $2}') Port: $(grep "^Port" /etc/ssh/sshd_config | awk '{print $2}')
User: $app User: $app

View file

@ -48,17 +48,17 @@ ynh_secure_remove --file="$final_path"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing nginx web server configuration..." --weight=2 ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2
# Remove the dedicated nginx config # Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE PHP-FPM CONFIGURATION # REMOVE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing php-fpm configuration..." ynh_script_progression --message="Removing PHP-FPM configuration..."
# Remove the dedicated php-fpm config # Remove the dedicated PHP-FPM config
ynh_remove_fpm_config ynh_remove_fpm_config
#================================================= #=================================================
@ -69,7 +69,7 @@ ynh_remove_fpm_config
if [ $with_sftp -eq 1 ] if [ $with_sftp -eq 1 ]
then then
ynh_script_progression --message="Removing the custom ssh config..." ynh_script_progression --message="Removing the custom SSH config..."
ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/90-ssh_$app" ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/90-ssh_$app"
yunohost tools regen-conf ssh yunohost tools regen-conf ssh
fi fi

View file

@ -30,6 +30,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql)
with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp)
password=$(ynh_app_setting_get --app=$app --key=password) password=$(ynh_app_setting_get --app=$app --key=password)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
@ -95,7 +96,7 @@ chown root: "$final_path"
# RESTORE THE PHP-FPM CONFIGURATION # 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"
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
@ -105,7 +106,7 @@ ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf"
if [ $with_sftp -eq 1 ] if [ $with_sftp -eq 1 ]
then then
ynh_script_progression --message="Configuring ssh..." ynh_script_progression --message="Configuring SSH..."
ynh_restore_file "/usr/share/yunohost/hooks/conf_regen/90-ssh_$app" ynh_restore_file "/usr/share/yunohost/hooks/conf_regen/90-ssh_$app"
@ -117,9 +118,9 @@ fi
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server and php-fpm..." ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
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 ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================

View file

@ -18,7 +18,6 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql)
@ -43,15 +42,6 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." ynh_script_progression --message="Ensuring downward compatibility..."
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
fi
# Delete old user # Delete old user
if [ -n "$(ynh_app_setting_get --app=$app --key=user)" ] if [ -n "$(ynh_app_setting_get --app=$app --key=user)" ]
then then
@ -107,6 +97,13 @@ if [ -z "$with_sftp" ]; then
ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp
fi fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
@ -121,13 +118,6 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#=================================================
# CHECK THE PATH
#=================================================
# Normalize the URL path syntax
path_url=$(ynh_normalize_url_path --path_url=$path_url)
#================================================= #=================================================
# ACTIVATE MAINTENANCE MODE # ACTIVATE MAINTENANCE MODE
#================================================= #=================================================
@ -141,12 +131,12 @@ ynh_maintenance_mode_ON
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
# Overwrite the nginx configuration only if it's allowed # Overwrite the NGINX configuration only if it's allowed
if [ $overwrite_nginx -eq 1 ] if [ $overwrite_nginx -eq 1 ]
then then
ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2 ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
# Create a dedicated nginx config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
fi fi
@ -171,12 +161,12 @@ usermod -g "$app" "$app"
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
# Overwrite the php-fpm configuration only if it's allowed # Overwrite the PHP-FPM configuration only if it's allowed
if [ $overwrite_phpfpm -eq 1 ] if [ $overwrite_phpfpm -eq 1 ]
then then
ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=2 ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
# Create a dedicated php-fpm config # Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
fi fi
@ -188,11 +178,9 @@ fi
if [ $with_sftp -eq 1 ] if [ $with_sftp -eq 1 ]
then then
ynh_script_progression --message="Configuring ssh..." --weight=1 ynh_script_progression --message="Configuring SSH..." --weight=1
cp -R ../conf/ssh_regenconf_hook /usr/share/yunohost/hooks/conf_regen/90-ssh_$app ynh_add_config --template="../conf/ssh_regenconf_hook" --destination="/usr/share/yunohost/hooks/conf_regen/90-ssh_$app"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file=/usr/share/yunohost/hooks/conf_regen/90-ssh_$app
yunohost tools regen-conf ssh yunohost tools regen-conf ssh
fi fi
@ -208,21 +196,10 @@ chown -R $app: "$final_path"
# SFTP connections # SFTP connections
chown root: "$final_path" chown root: "$final_path"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Upgrading SSOwat configuration..."
# Make app public if necessary
if [ $is_public -eq 1 ]
then
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload

View file

@ -7,10 +7,12 @@
<h1>It works!</h1> <h1>It works!</h1>
<p>Congratulation, you have just installed your custom web app.</p> <p>Congratulation, you have just installed your custom web app.</p>
<h2>Access your site</h2> <h2>Edit this site</h2>
<p> <p>
You can access to your site - e.g. to put content, change this wonderful First way to edit this site is by putting your files in /var/www/__APP__/www using SSH/SCP.
page - using SFTP. You can use a client application for that such as </p>
<p>
Alternatively you can achieve the same thing using SFTP. To do so, you can use a client application such as
<a href="https://filezilla-project.org/download.php?type=client" target="_blank">FileZilla</a>. <a href="https://filezilla-project.org/download.php?type=client" target="_blank">FileZilla</a>.
Here are the SFTP connection details: Here are the SFTP connection details:
</p> </p>
@ -18,7 +20,7 @@
<dt>Domain</dt> <dt>Domain</dt>
<dd>__DOMAIN__</dd> <dd>__DOMAIN__</dd>
<dt>Port</dt> <dt>Port</dt>
<dd>22 (or the port you defined <a href="https://yunohost.org/#/security_fr">if you change the ssh port</a>)</dd> <dd>22 (or the port you defined <a href="https://yunohost.org/#/security_fr">if you changed the ssh port</a>)</dd>
<dt>User</dt> <dt>User</dt>
<dd>__APP__</dd> <dd>__APP__</dd>
<dt>Password</dt> <dt>Password</dt>

View file

@ -7,6 +7,11 @@
<h1>It works!</h1> <h1>It works!</h1>
<p>Congratulation, you have just installed your custom web app.</p> <p>Congratulation, you have just installed your custom web app.</p>
<h2>Edit this site</h2>
<p>
To edit this site, put your files in /var/www/__APP__/www using SSH/SCP.
</p>
<p>As a reward, here is a random cat picture:</p> <p>As a reward, here is a random cat picture:</p>
<img src="https://thecatapi.com/api/images/get?format=src&type=gif"> <img src="https://thecatapi.com/api/images/get?format=src&type=gif">
</body> </body>