mirror of
https://github.com/YunoHost-Apps/my_webapp_ynh.git
synced 2024-09-03 19:46:26 +02:00
commit
fbb29710c0
19 changed files with 169 additions and 145 deletions
11
CHANGELOG.md
11
CHANGELOG.md
|
@ -1,8 +1,15 @@
|
|||
Changelog
|
||||
=========
|
||||
|
||||
## Unreleased
|
||||
- Nothing for now...
|
||||
## [1.0~ynh4](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/60) - 2021-04-23
|
||||
|
||||
#### 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
|
||||
|
||||
|
|
16
README.md
16
README.md
|
@ -3,6 +3,8 @@
|
|||
[](https://dash.yunohost.org/appci/app/my_webapp)  
|
||||
[](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.
|
||||
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
|
||||
|
||||
## Screenshots
|
||||
|
||||
## Demo
|
||||
|
||||
## Configuration
|
||||
|
||||
## Documentation
|
||||
|
@ -38,8 +36,8 @@ of your custom Web application inside.
|
|||
|
||||
#### Supported architectures
|
||||
|
||||
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/my_webapp/)
|
||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/my_webapp/)
|
||||
* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/my_webapp/)
|
||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/my_webapp/)
|
||||
|
||||
## Limitations
|
||||
|
||||
|
@ -48,7 +46,7 @@ of your custom Web application inside.
|
|||
#### SFTP port
|
||||
|
||||
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.
|
||||
|
||||
## 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).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
|
|
55
README_fr.md
Normal file
55
README_fr.md
Normal file
|
@ -0,0 +1,55 @@
|
|||
# Application vide avec accès SFTP au répertoire Web personnalisé pour YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/my_webapp)  
|
||||
[](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 - [](https://ci-apps.yunohost.org/ci/apps/my_webapp/)
|
||||
* ARMv8-A - [](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
|
||||
```
|
|
@ -43,8 +43,6 @@
|
|||
setup_sub_dir=1
|
||||
upgrade=1
|
||||
backup_restore=1
|
||||
;;; Levels
|
||||
Level 5=auto
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=change
|
||||
|
|
|
@ -32,7 +32,7 @@ location __PATH__/ {
|
|||
# Execute and serve PHP files
|
||||
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;
|
||||
fastcgi_param REMOTE_USER $remote_user;
|
||||
|
|
|
@ -8,7 +8,7 @@ name = "My webapp configuration"
|
|||
name = "SFTP access"
|
||||
|
||||
[main.sftp.sftp]
|
||||
ask = "Do you need a SFTP access ?"
|
||||
ask = "Do you need a SFTP access?"
|
||||
type = "boolean"
|
||||
default = true
|
||||
|
||||
|
@ -22,13 +22,13 @@ name = "My webapp configuration"
|
|||
name = "Overwriting config files"
|
||||
|
||||
[main.overwrite_files.overwrite_nginx]
|
||||
ask = "Overwrite the nginx config file ?"
|
||||
ask = "Overwrite the NGINX config file?"
|
||||
type = "boolean"
|
||||
default = false
|
||||
help = "If the file is overwritten, a backup will be created."
|
||||
|
||||
[main.overwrite_files.overwrite_phpfpm]
|
||||
ask = "Overwrite the php-fpm config file ?"
|
||||
ask = "Overwrite the PHP-FPM config file?"
|
||||
type = "boolean"
|
||||
default = true
|
||||
help = "If the file is overwritten, a backup will be created."
|
||||
|
@ -38,19 +38,19 @@ name = "My webapp configuration"
|
|||
name = "PHP-FPM configuration"
|
||||
|
||||
[main.php_fpm_config.footprint]
|
||||
ask = "Memory footprint of the service ?"
|
||||
ask = "Memory footprint of the service?"
|
||||
choices = ["low", "medium", "high", "specific"]
|
||||
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."
|
||||
|
||||
[main.php_fpm_config.free_footprint]
|
||||
ask = "Memory footprint of the service ?"
|
||||
ask = "Memory footprint of the service?"
|
||||
type = "number"
|
||||
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."
|
||||
|
||||
[main.php_fpm_config.usage]
|
||||
ask = "Expected usage of the service ?"
|
||||
ask = "Expected usage of the service?"
|
||||
choices = ["low", "medium", "high"]
|
||||
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."
|
||||
|
|
|
@ -6,20 +6,24 @@
|
|||
"en": "Custom Web app with SFTP access",
|
||||
"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",
|
||||
"license": "GPL-3.0-only",
|
||||
"maintainer": {
|
||||
"name": "None...",
|
||||
"email": ""
|
||||
},
|
||||
"previous_maintainers": [{
|
||||
"name": "Maniack Crudelis",
|
||||
"email": "maniackc_dev@crudelis.fr"
|
||||
},
|
||||
}],
|
||||
"requirements": {
|
||||
"yunohost": ">= 3.8.0"
|
||||
"yunohost": ">= 4.1.7"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
"nginx",
|
||||
"php7.0-fpm",
|
||||
"php7.3-fpm",
|
||||
"mysql"
|
||||
],
|
||||
"arguments": {
|
||||
|
@ -27,19 +31,11 @@
|
|||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"ask": {
|
||||
"en": "Choose a domain for your Webapp",
|
||||
"fr": "Choisissez un domaine pour votre Webapp"
|
||||
},
|
||||
"example": "domain.org"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"ask": {
|
||||
"en": "Choose a path for your Webapp",
|
||||
"fr": "Choisissez un chemin pour votre Webapp"
|
||||
},
|
||||
"example": "/site",
|
||||
"default": "/site"
|
||||
},
|
||||
|
@ -56,19 +52,11 @@
|
|||
"name": "password",
|
||||
"type": "password",
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Is it a public website?",
|
||||
"fr": "Est-ce un site public ?"
|
||||
},
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
|
|
|
@ -11,14 +11,6 @@
|
|||
- [ ] Upgrade from last version tested.
|
||||
- [ ] Can be reviewed and tested.
|
||||
|
||||
## Validation
|
||||
## Package_check results
|
||||
---
|
||||
*Minor decision*
|
||||
- **Upgrade previous version** :
|
||||
- [ ] **Code review** :
|
||||
- [ ] **Approval (LGTM)** :
|
||||
- [ ] **Approval (LGTM)** :
|
||||
- **CI succeeded** :
|
||||
[](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.
|
||||
* 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!"*
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
YNH_PHP_VERSION="7.3"
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -40,10 +40,10 @@ fi
|
|||
|
||||
if [ $with_sftp -eq 1 ]
|
||||
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
|
||||
|
||||
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
|
||||
ynh_add_config --template="conf/ssh_regenconf_hook" --destination="/usr/share/yunohost/hooks/conf_regen/90-ssh_$app"
|
||||
|
||||
else
|
||||
ynh_script_progression --message="Removing the custom ssh config for the SFTP access..." --weight=3
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
ynh_print_info --message="Loading installation settings..."
|
||||
|
||||
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)
|
||||
with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql)
|
||||
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
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the main app directory..."
|
||||
|
||||
ynh_backup --src_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# 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"
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
|
@ -58,7 +59,7 @@ ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf"
|
|||
|
||||
if [ $with_mysql -eq 1 ]
|
||||
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
|
||||
fi
|
||||
|
||||
|
@ -68,7 +69,7 @@ fi
|
|||
|
||||
if [ $with_sftp -eq 1 ]
|
||||
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"
|
||||
fi
|
||||
|
@ -77,4 +78,4 @@ fi
|
|||
# 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)."
|
||||
|
|
|
@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||
#=================================================
|
||||
# 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
|
||||
ynh_backup_before_upgrade
|
||||
|
@ -76,25 +76,25 @@ fi
|
|||
#=================================================
|
||||
# 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
|
||||
|
||||
# Change the path in the nginx config file
|
||||
# Change the path in the NGINX config file
|
||||
if [ $change_path -eq 1 ]
|
||||
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"
|
||||
|
||||
# Set global variables for nginx helper
|
||||
# Set global variables for NGINX helper
|
||||
domain="$old_domain"
|
||||
path_url="$new_path"
|
||||
|
||||
# Create a dedicated nginx config
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
fi
|
||||
|
||||
# Change the domain for nginx
|
||||
# Change the domain for NGINX
|
||||
if [ $change_domain -eq 1 ]
|
||||
then
|
||||
# Delete file checksum for the old conf file location
|
||||
|
@ -110,7 +110,7 @@ fi
|
|||
#=================================================
|
||||
# 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
|
||||
|
||||
|
|
|
@ -45,20 +45,20 @@ else
|
|||
fi
|
||||
|
||||
|
||||
# Overwrite nginx configuration
|
||||
# Overwrite NGINX configuration
|
||||
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 php-fpm configuration
|
||||
# Overwrite PHP-FPM configuration
|
||||
old_overwrite_phpfpm="$(ynh_app_setting_get --app=$app --key=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)"
|
||||
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
|
||||
if [ "$fpm_footprint" -eq "$fpm_footprint" ] 2> /dev/null
|
||||
then
|
||||
|
@ -69,7 +69,7 @@ else
|
|||
fi
|
||||
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)"
|
||||
fpm_usage="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_USAGE:-$old_fpm_usage}"
|
||||
|
||||
|
|
|
@ -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=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_sftp --value=$with_sftp
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
|
@ -76,9 +75,9 @@ fi
|
|||
#=================================================
|
||||
# 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
|
||||
|
||||
#=================================================
|
||||
|
@ -102,11 +101,9 @@ fi
|
|||
#=================================================
|
||||
if [ $with_sftp -eq 1 ]
|
||||
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_replace_string --match_string="__APP__" --replace_string="$app" --target_file=/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"
|
||||
|
||||
yunohost tools regen-conf ssh
|
||||
fi
|
||||
|
@ -119,11 +116,9 @@ mkdir -p "$final_path/www"
|
|||
|
||||
if [ $with_sftp -eq 1 ]
|
||||
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
|
||||
cp "../sources/www/index.html" "$final_path/www/index.html"
|
||||
ynh_add_config --template="../sources/www/index.html" --destination="$final_path/www/index.html"
|
||||
|
||||
else
|
||||
# Copy files to the right place
|
||||
cp "../sources/www/index_no_sftp.html" "$final_path/www/index.html"
|
||||
|
@ -141,10 +136,11 @@ fi
|
|||
#=================================================
|
||||
# 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
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -160,18 +156,18 @@ chown root: "$final_path"
|
|||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring SSOwat..."
|
||||
ynh_script_progression --message="Configuring permissions..."
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
then
|
||||
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
|
||||
|
@ -194,7 +190,7 @@ fi
|
|||
|
||||
if [ $with_sftp -eq 1 ]
|
||||
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
|
||||
Port: $(grep "^Port" /etc/ssh/sshd_config | awk '{print $2}')
|
||||
User: $app
|
||||
|
|
|
@ -48,17 +48,17 @@ ynh_secure_remove --file="$final_path"
|
|||
#=================================================
|
||||
# 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
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
|
||||
#=================================================
|
||||
|
@ -69,7 +69,7 @@ ynh_remove_fpm_config
|
|||
|
||||
if [ $with_sftp -eq 1 ]
|
||||
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"
|
||||
yunohost tools regen-conf ssh
|
||||
fi
|
||||
|
|
|
@ -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_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp)
|
||||
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
|
||||
|
@ -95,7 +96,7 @@ chown 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"
|
||||
|
||||
#=================================================
|
||||
# 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 ]
|
||||
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"
|
||||
|
||||
|
@ -117,9 +118,9 @@ fi
|
|||
#=================================================
|
||||
# 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
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -18,7 +18,6 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
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)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
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..."
|
||||
|
||||
# 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
|
||||
if [ -n "$(ynh_app_setting_get --app=$app --key=user)" ]
|
||||
then
|
||||
|
@ -107,6 +97,13 @@ if [ -z "$with_sftp" ]; then
|
|||
ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp
|
||||
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
|
||||
#=================================================
|
||||
|
@ -121,13 +118,6 @@ ynh_clean_setup () {
|
|||
# Exit if an error occurs during the execution of the script
|
||||
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
|
||||
#=================================================
|
||||
|
@ -141,12 +131,12 @@ ynh_maintenance_mode_ON
|
|||
# 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 ]
|
||||
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
|
||||
fi
|
||||
|
||||
|
@ -171,12 +161,12 @@ usermod -g "$app" "$app"
|
|||
# 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 ]
|
||||
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
|
||||
fi
|
||||
|
||||
|
@ -188,11 +178,9 @@ fi
|
|||
|
||||
if [ $with_sftp -eq 1 ]
|
||||
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_replace_string --match_string="__APP__" --replace_string="$app" --target_file=/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"
|
||||
|
||||
yunohost tools regen-conf ssh
|
||||
fi
|
||||
|
@ -208,21 +196,10 @@ chown -R $app: "$final_path"
|
|||
# SFTP connections
|
||||
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
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server..."
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
|
|
@ -7,10 +7,12 @@
|
|||
<h1>It works!</h1>
|
||||
<p>Congratulation, you have just installed your custom web app.</p>
|
||||
|
||||
<h2>Access your site</h2>
|
||||
<h2>Edit this site</h2>
|
||||
<p>
|
||||
You can access to your site - e.g. to put content, change this wonderful
|
||||
page - using SFTP. You can use a client application for that such as
|
||||
First way to edit this site is by putting your files in /var/www/__APP__/www using SSH/SCP.
|
||||
</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>.
|
||||
Here are the SFTP connection details:
|
||||
</p>
|
||||
|
@ -18,7 +20,7 @@
|
|||
<dt>Domain</dt>
|
||||
<dd>__DOMAIN__</dd>
|
||||
<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>
|
||||
<dd>__APP__</dd>
|
||||
<dt>Password</dt>
|
||||
|
|
|
@ -7,6 +7,11 @@
|
|||
<h1>It works!</h1>
|
||||
<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>
|
||||
<img src="https://thecatapi.com/api/images/get?format=src&type=gif">
|
||||
</body>
|
||||
|
|
Loading…
Add table
Reference in a new issue