mirror of
https://github.com/YunoHost-Apps/chatonsinfos_ynh.git
synced 2024-09-03 18:15:58 +02:00
Merge branch 'testing' of https://github.com/YunoHost-Apps/chatonsInfo_ynh into testing
This commit is contained in:
commit
5df582efe4
9 changed files with 49 additions and 351 deletions
40
README.md
40
README.md
|
@ -1,28 +1,17 @@
|
|||
# Packaging an app, starting from this example
|
||||
|
||||
* Copy this app before working on it, using the ['Use this template'](https://github.com/YunoHost/example_ynh/generate) button on the Github repo.
|
||||
* Edit the `manifest.json` with app specific info.
|
||||
* Edit the `install`, `upgrade`, `remove`, `backup`, and `restore` scripts, and any relevant conf files in `conf/`.
|
||||
* Using the [script helpers documentation.](https://yunohost.org/packaging_apps_helpers)
|
||||
* Add a `LICENSE` file for the package.
|
||||
* Edit `doc/DISCLAIMER*.md`
|
||||
* The `README.md` files are to be automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
||||
|
||||
---
|
||||
<!--
|
||||
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
||||
It shall NOT be edited by hand.
|
||||
-->
|
||||
|
||||
# Example app for YunoHost
|
||||
# Chatons Infos for YunoHost
|
||||
|
||||
[![Integration level](https://dash.yunohost.org/integration/example.svg)](https://dash.yunohost.org/appci/app/example) ![Working status](https://ci-apps.yunohost.org/ci/badges/example.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/example.maintain.svg)
|
||||
[![Integration level](https://dash.yunohost.org/integration/chatons_infos.svg)](https://dash.yunohost.org/appci/app/chatons_infos) ![Working status](https://ci-apps.yunohost.org/ci/badges/chatons_infos.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/chatons_infos.maintain.svg)
|
||||
|
||||
[![Install Example app with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=example)
|
||||
[![Install Chatons Infos with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=chatons_infos)
|
||||
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
> *This package allows you to install Example app quickly and simply on a YunoHost server.
|
||||
> *This package allows you to install Chatons Infos quickly and simply on a YunoHost server.
|
||||
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
|
||||
|
||||
## Overview
|
||||
|
@ -32,31 +21,30 @@ This is a dummy description of this app features
|
|||
|
||||
**Shipped version:** 1.0~ynh1
|
||||
|
||||
**Demo:** https://demo.example.com
|
||||
**Demo:** https://stats.chatons.org/index.xhtml
|
||||
|
||||
## Screenshots
|
||||
|
||||
![Screenshot of Example app](./doc/screenshots/example.jpg)
|
||||
![Screenshot of Chatons Infos](./doc/screenshots/example.jpg)
|
||||
|
||||
## Documentation and resources
|
||||
|
||||
* Official app website: <https://example.com>
|
||||
* Official user documentation: <https://yunohost.org/apps>
|
||||
* Official admin documentation: <https://yunohost.org/packaging_apps>
|
||||
* Upstream app code repository: <https://some.forge.com/example/example>
|
||||
* YunoHost documentation for this app: <https://yunohost.org/app_example>
|
||||
* Report a bug: <https://github.com/YunoHost-Apps/example_ynh/issues>
|
||||
* Official app website: <https://framagit.org/chatons/chatonsinfos/-/blob/master/>
|
||||
* Official admin documentation: <https://framagit.org/chatons/chatonsinfos/-/blob/master/README.md>
|
||||
* Upstream app code repository: <https://framagit.org/chatons/chatonsinfos>
|
||||
* YunoHost documentation for this app: <https://yunohost.org/app_chatons_infos>
|
||||
* Report a bug: <https://github.com/YunoHost-Apps/chatons_infos_ynh/issues>
|
||||
|
||||
## Developer info
|
||||
|
||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/example_ynh/tree/testing).
|
||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/chatons_infos_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
|
||||
``` bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/example_ynh/tree/testing --debug
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/chatons_infos_ynh/tree/testing --debug
|
||||
or
|
||||
sudo yunohost app upgrade example -u https://github.com/YunoHost-Apps/example_ynh/tree/testing --debug
|
||||
sudo yunohost app upgrade chatons_infos -u https://github.com/YunoHost-Apps/chatons_infos_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>
|
||||
|
|
29
README_fr.md
29
README_fr.md
|
@ -3,15 +3,15 @@ N.B.: This README was automatically generated by https://github.com/YunoHost/app
|
|||
It shall NOT be edited by hand.
|
||||
-->
|
||||
|
||||
# Example app pour YunoHost
|
||||
# Chatons Infos pour YunoHost
|
||||
|
||||
[![Niveau d’intégration](https://dash.yunohost.org/integration/example.svg)](https://dash.yunohost.org/appci/app/example) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/example.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/example.maintain.svg)
|
||||
[![Niveau d’intégration](https://dash.yunohost.org/integration/chatons_infos.svg)](https://dash.yunohost.org/appci/app/chatons_infos) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/chatons_infos.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/chatons_infos.maintain.svg)
|
||||
|
||||
[![Installer Example app avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=example)
|
||||
[![Installer Chatons Infos avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=chatons_infos)
|
||||
|
||||
*[Read this readme in english.](./README.md)*
|
||||
|
||||
> *Ce package vous permet d’installer Example app rapidement et simplement sur un serveur YunoHost.
|
||||
> *Ce package vous permet d’installer Chatons Infos 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
|
||||
|
@ -21,31 +21,30 @@ Ceci est une fausse description des fonctionalités de l'app
|
|||
|
||||
**Version incluse :** 1.0~ynh1
|
||||
|
||||
**Démo :** https://demo.example.com
|
||||
**Démo :** https://stats.chatons.org/index.xhtml
|
||||
|
||||
## Captures d’écran
|
||||
|
||||
![Capture d’écran de Example app](./doc/screenshots/example.jpg)
|
||||
![Capture d’écran de Chatons Infos](./doc/screenshots/example.jpg)
|
||||
|
||||
## Documentations et ressources
|
||||
|
||||
* Site officiel de l’app : <https://example.com>
|
||||
* Documentation officielle utilisateur : <https://yunohost.org/apps>
|
||||
* Documentation officielle de l’admin : <https://yunohost.org/packaging_apps>
|
||||
* Dépôt de code officiel de l’app : <https://some.forge.com/example/example>
|
||||
* Documentation YunoHost pour cette app : <https://yunohost.org/app_example>
|
||||
* Signaler un bug : <https://github.com/YunoHost-Apps/example_ynh/issues>
|
||||
* Site officiel de l’app : <https://framagit.org/chatons/chatonsinfos/-/blob/master/>
|
||||
* Documentation officielle de l’admin : <https://framagit.org/chatons/chatonsinfos/-/blob/master/README.md>
|
||||
* Dépôt de code officiel de l’app : <https://framagit.org/chatons/chatonsinfos>
|
||||
* Documentation YunoHost pour cette app : <https://yunohost.org/app_chatons_infos>
|
||||
* Signaler un bug : <https://github.com/YunoHost-Apps/chatons_infos_ynh/issues>
|
||||
|
||||
## Informations pour les développeurs
|
||||
|
||||
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/example_ynh/tree/testing).
|
||||
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/chatons_infos_ynh/tree/testing).
|
||||
|
||||
Pour essayer la branche testing, procédez comme suit.
|
||||
|
||||
``` bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/example_ynh/tree/testing --debug
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/chatons_infos_ynh/tree/testing --debug
|
||||
ou
|
||||
sudo yunohost app upgrade example -u https://github.com/YunoHost-Apps/example_ynh/tree/testing --debug
|
||||
sudo yunohost app upgrade chatons_infos -u https://github.com/YunoHost-Apps/chatons_infos_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Plus d’infos sur le packaging d’applications :** <https://yunohost.org/packaging_apps>
|
105
manifest.toml
105
manifest.toml
|
@ -1,94 +1,45 @@
|
|||
packaging_format = 2
|
||||
|
||||
id = "example"
|
||||
name = "Example app"
|
||||
description.en = "Explain in *a few (10~15) words* the purpose of the app or what it actually does (it is meant to give a rough idea to users browsing a catalog of 100+ apps)"
|
||||
description.fr = "Expliquez en *quelques* (10~15) mots l'utilité de l'app ou ce qu'elle fait (l'objectif est de donner une idée grossière pour des utilisateurs qui naviguent dans un catalogue de 100+ apps)"
|
||||
id = "chatons_infos"
|
||||
name = "Chatons Infos"
|
||||
description.en = "create stats files Chatons compliant and enable configuration in config pannel"
|
||||
description.fr = "génère automatiquement les fichiers de statistiques Chatons et permet leur configuration dans le panneau de configuration"
|
||||
|
||||
version = "1.0~ynh1"
|
||||
|
||||
maintainers = ["johndoe"]
|
||||
maintainers = ["oiseauroch", "ljf"]
|
||||
|
||||
[upstream]
|
||||
# NB: Only the "license" key is mandatory. Remove entries for which there's no relevant data
|
||||
license = "free"
|
||||
website = "https://example.com"
|
||||
demo = "https://demo.example.com"
|
||||
admindoc = "https://yunohost.org/packaging_apps"
|
||||
userdoc = "https://yunohost.org/apps"
|
||||
code = "https://some.forge.com/example/example"
|
||||
# FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, YunoHost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
|
||||
cpe = "???"
|
||||
# FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
|
||||
fund = "???"
|
||||
license = "agpl-3.0"
|
||||
website = "https://framagit.org/chatons/chatonsinfos/-/blob/master/"
|
||||
demo = "https://stats.chatons.org/index.xhtml"
|
||||
admindoc = "https://framagit.org/chatons/chatonsinfos/-/blob/master/README.md"
|
||||
code = "https://framagit.org/chatons/chatonsinfos"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.1.21"
|
||||
# FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
# FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key: the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
|
||||
ldap = "?"
|
||||
# FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key: the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
|
||||
sso = "?"
|
||||
# FIXME: replace with an **estimate** minimum disk and RAM requirements. e.g. 20M, 400M, 1G...
|
||||
multi_instance = "not_relevant"
|
||||
ldap = "not_relevant"
|
||||
sso = "not_relevant"
|
||||
disk = "50M"
|
||||
ram.build = "50M"
|
||||
ram.runtime = "50M"
|
||||
|
||||
[install]
|
||||
[install.domain]
|
||||
# this is a generic question - ask strings are automatically handled by YunoHost's core
|
||||
type = "domain"
|
||||
|
||||
[install.path]
|
||||
# this is a generic question - ask strings are automatically handled by YunoHost's core
|
||||
type = "path"
|
||||
default = "/example"
|
||||
|
||||
[install.init_main_permission]
|
||||
# this is a generic question - ask strings are automatically handled by YunoHost's core
|
||||
# This won't be saved as setting and will instead be used to initialize the SSOwat permission
|
||||
type = "group"
|
||||
default = "visitors"
|
||||
|
||||
[install.language]
|
||||
ask.en = "Choose the application language"
|
||||
ask.fr = "Choisissez la langue de l'application"
|
||||
type = "select"
|
||||
choices = ["fr", "en"]
|
||||
default = "fr"
|
||||
|
||||
[install.admin]
|
||||
# this is a generic question - ask strings are automatically handled by YunoHost's core
|
||||
type = "user"
|
||||
|
||||
[install.password]
|
||||
# this is a generic question - ask strings are automatically handled by YunoHost's core
|
||||
# Note that user-provided passwords questions are not automatically saved as setting
|
||||
help.en = "Use the help field to add an information for the admin about this question."
|
||||
help.fr = "Utilisez le champ aide pour ajouter une information à l'intention de l'administrateur à propos de cette question."
|
||||
type = "password"
|
||||
|
||||
[resources]
|
||||
# See the packaging documentation for the full set
|
||||
# of explanation regarding the behavior and properties for each of those
|
||||
|
||||
[resources.sources]
|
||||
|
||||
[resources.sources.main]
|
||||
# This will pre-fetch the asset which can then be deployed during the install/upgrade scripts with :
|
||||
# ynh_setup_source --dest_dir="$install_dir"
|
||||
# You can also define other assets than "main" and add --source_id="foobar" in the previous command
|
||||
url = "https://github.com/foo/bar/archive/refs/tags/v1.2.3.tar.gz"
|
||||
sha256 = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
|
||||
|
||||
# These infos are used by https://github.com/YunoHost/apps/blob/master/tools/autoupdate_app_sources/autoupdate_app_sources.py
|
||||
# to auto-update the previous asset urls and sha256sum + manifest version
|
||||
# assuming the upstream's code repo is on github and relies on tags or releases
|
||||
# See the 'sources' resource documentation for more details
|
||||
|
||||
# autoupdate.strategy = "latest_github_tag"
|
||||
[resourrces.sources.main]
|
||||
url = "https://framagit.org/chatons/chatonsinfos/-/archive/master/chatonsinfos-master.tar.gz?path=MODELES"
|
||||
sha256 = "664e1c934ea2fd0b5ee4ff55bbabbc81227a256ee12fd7d18319d13c095690bb"
|
||||
in_subdir = true
|
||||
|
||||
[resources.system_user]
|
||||
# This will provision/deprovision a unix system user
|
||||
|
@ -96,24 +47,4 @@ ram.runtime = "50M"
|
|||
[resources.install_dir]
|
||||
# This will create/remove the install dir as /var/www/$app
|
||||
# and store the corresponding setting $install_dir
|
||||
|
||||
[resources.data_dir]
|
||||
# This will create/remove the data dir as /home/yunohost.app/$app
|
||||
# and store the corresponding setting $data_dir
|
||||
|
||||
[resources.permissions]
|
||||
# This will configure SSOwat permission for $domain/$path/
|
||||
# The initial allowed group of user is configured via the init_main_permission question (public=visitors, private=all_users)
|
||||
main.url = "/"
|
||||
|
||||
[resources.ports]
|
||||
# This will pick a random port for reverse-proxying and store it as the $port setting
|
||||
|
||||
[resources.apt]
|
||||
# This will automatically install/uninstall the following apt packages
|
||||
# and implicitly define the $phpversion setting as 8.0 (if phpX.Y-foobar dependencies are listed)
|
||||
packages = "deb1, deb2, php8.0-foo, php8.0-bar"
|
||||
|
||||
[resources.database]
|
||||
# This will automatically provision/deprovison a MySQL DB and store the corresponding credentials in settings $db_user, $db_name, $db_pwd
|
||||
type = "mysql"
|
||||
dir = "/var/www/__APP__/sources/"
|
||||
|
|
|
@ -26,32 +26,12 @@ ynh_print_info --message="Declaring files to be backed up..."
|
|||
|
||||
ynh_backup --src_path="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE DATA DIR
|
||||
#=================================================
|
||||
|
||||
# Only relevant if there is a "data_dir" resource for this app
|
||||
ynh_backup --src_path="$data_dir" --is_big
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP FAIL2BAN CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
#=================================================
|
||||
|
@ -74,16 +54,6 @@ ynh_backup --src_path="/etc/cron.d/$app"
|
|||
|
||||
ynh_backup --src_path="/etc/$app/"
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
#=================================================
|
||||
|
|
|
@ -18,84 +18,6 @@ source /usr/share/yunohost/helpers
|
|||
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC GETTERS FOR TOML SHORT KEY
|
||||
#=================================================
|
||||
|
||||
get__amount() {
|
||||
# Here we can imagine to have an API call to stripe to know the amount of donation during a month
|
||||
local amount = 200
|
||||
|
||||
# It's possible to change some properties of the question by overriding it:
|
||||
if [ $amount -gt 100 ]
|
||||
then
|
||||
cat << EOF
|
||||
style: success
|
||||
value: $amount
|
||||
ask:
|
||||
en: A lot of donation this month: **$amount €**
|
||||
EOF
|
||||
else
|
||||
cat << EOF
|
||||
style: danger
|
||||
value: $amount
|
||||
ask:
|
||||
en: Not so much donation this month: $amount €
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
get__prices() {
|
||||
local prices = "$(grep "DONATION\['" "$install_dir/settings.py" | sed -r "s@^DONATION\['([^']*)'\]\['([^']*)'\] = '([^']*)'@\1/\2/\3@g" | sed -z 's/\n/,/g;s/,$/\n/')"
|
||||
if [ "$prices" == "," ];
|
||||
then
|
||||
# Return YNH_NULL if you prefer to not return a value at all.
|
||||
echo YNH_NULL
|
||||
else
|
||||
echo $prices
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC VALIDATORS FOR TOML SHORT KEYS
|
||||
#=================================================
|
||||
validate__publishable_key() {
|
||||
|
||||
# We can imagine here we test if the key is really a publisheable key
|
||||
(is_secret_key $publishable_key) &&
|
||||
echo 'This key seems to be a secret key'
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETTERS FOR TOML SHORT KEYS
|
||||
#=================================================
|
||||
set__prices() {
|
||||
|
||||
#---------------------------------------------
|
||||
# IMPORTANT: setter are trigger only if a change is detected
|
||||
#---------------------------------------------
|
||||
for price in $(echo $prices | sed "s/,/ /"); do
|
||||
frequency=$(echo $price | cut -d/ -f1)
|
||||
currency=$(echo $price | cut -d/ -f2)
|
||||
price_id=$(echo $price | cut -d/ -f3)
|
||||
sed "d/DONATION\['$frequency'\]\['$currency'\]" "$install_dir/settings.py"
|
||||
|
||||
echo "DONATION['$frequency']['$currency'] = '$price_id'" >> "$install_dir/settings.py"
|
||||
done
|
||||
|
||||
#---------------------------------------------
|
||||
# IMPORTANT: to be able to upgrade properly, you have to saved the value in settings too
|
||||
#---------------------------------------------
|
||||
ynh_app_setting_set $app prices $prices
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
|
@ -9,27 +9,6 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
# Install parameters are automatically saved as settings
|
||||
#
|
||||
# Settings are automatically loaded as bash variables
|
||||
# in every app script context, therefore typically these will exist:
|
||||
# - $domain
|
||||
# - $path
|
||||
# - $language
|
||||
# ... etc
|
||||
#
|
||||
# Resources defined in the manifest are provisioned prior to this script
|
||||
# and corresponding settings are also available, such as:
|
||||
# - $install_dir
|
||||
# - $port
|
||||
# - $db_name
|
||||
# ...
|
||||
|
||||
#
|
||||
# $app is the app id (i.e. 'example' for first install,
|
||||
# or 'example__2', '__3', ... for multi-instance installs)
|
||||
#
|
||||
|
||||
#=================================================
|
||||
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
|
||||
#=================================================
|
||||
|
@ -54,34 +33,6 @@ chown -R $app:www-data "$install_dir"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
||||
|
||||
### `ynh_add_fpm_config` is used to set up a PHP config.
|
||||
### You can remove it if your app doesn't use PHP.
|
||||
### `ynh_add_fpm_config` will use the files conf/php-fpm.conf
|
||||
### If you're not using these lines:
|
||||
### - You can remove these files in conf/.
|
||||
### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script
|
||||
### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script
|
||||
### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script
|
||||
### with the reload at the end of the script.
|
||||
### - And the section "PHP-FPM CONFIGURATION" in the upgrade script
|
||||
|
||||
# Create a dedicated PHP-FPM config using the conf/php-fpm.conf or conf/extra_php-fpm.conf
|
||||
ynh_add_fpm_config
|
||||
|
||||
# Create a dedicated NGINX config using the conf/nginx.conf template
|
||||
ynh_add_nginx_config
|
||||
|
||||
### `ynh_systemd_config` is used to configure a systemd script for an app.
|
||||
### It can be used for apps that use sysvinit (with adaptation) or systemd.
|
||||
### Have a look at the app to be sure this app needs a systemd script.
|
||||
### `ynh_systemd_config` will use the file conf/systemd.service
|
||||
### If you're not using these lines:
|
||||
### - You can remove those files in conf/.
|
||||
### - Remove the section "BACKUP SYSTEMD" in the backup script
|
||||
### - Remove also the section "STOP AND REMOVE SERVICE" in the remove script
|
||||
### - As well as the section "RESTORE SYSTEMD" in the restore script
|
||||
### - And the section "SETUP SYSTEMD" in the upgrade script
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
|
@ -96,22 +47,6 @@ ynh_add_systemd_config
|
|||
|
||||
yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log"
|
||||
|
||||
### 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)
|
||||
|
||||
### `ynh_use_logrotate` is used to configure a logrotate configuration for the logs of this app.
|
||||
### Use this helper only if there is effectively a log file for this app.
|
||||
### If you're not using this helper:
|
||||
|
@ -123,9 +58,6 @@ yunohost service add $app --description="A short description of the app" --log="
|
|||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate
|
||||
|
||||
# Create a dedicated Fail2Ban config
|
||||
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
|
||||
|
||||
#=================================================
|
||||
# APP INITIAL CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -160,19 +92,6 @@ chown $app:$app "$install_dir/some_config_file"
|
|||
### ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$install_dir/some_config_file"
|
||||
### ynh_store_file_checksum --file="$install_dir/some_config_file"
|
||||
|
||||
#=================================================
|
||||
# SETUP APPLICATION WITH CURL
|
||||
#=================================================
|
||||
|
||||
### Use these lines only if the app installation needs to be finalized through
|
||||
### web forms. We generally don't want to ask the final user,
|
||||
### so we're going to use curl to automatically fill the fields and submit the
|
||||
### forms.
|
||||
|
||||
# Installation with curl
|
||||
ynh_script_progression --message="Finalizing installation..." --weight=1
|
||||
ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
|
@ -42,12 +42,8 @@ ynh_remove_systemd_config
|
|||
|
||||
ynh_remove_nginx_config
|
||||
|
||||
ynh_remove_fpm_config
|
||||
|
||||
ynh_remove_logrotate
|
||||
|
||||
ynh_remove_fail2ban_config
|
||||
|
||||
# Remove other various files specific to the app... such as :
|
||||
|
||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||
|
|
|
@ -22,22 +22,6 @@ ynh_restore_file --origin_path="$install_dir"
|
|||
# ownership to all files such as after the ynh_setup_source step
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
||||
|
||||
# (Same as for install dir)
|
||||
chown -R $app:www-data "$data_dir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
|
||||
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
|
@ -46,9 +30,6 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./
|
|||
#=================================================
|
||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||
|
||||
# This should be a symetric version of what happens in the install script
|
||||
|
||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
|
@ -59,10 +40,6 @@ yunohost service add $app --description="A short description of the app" --log="
|
|||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
|
||||
ynh_systemd_action --action=restart --service_name=fail2ban
|
||||
|
||||
# Other various files...
|
||||
|
||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||
|
|
|
@ -46,7 +46,7 @@ upgrade_type=$(ynh_check_app_version_changed)
|
|||
# If db_name doesn't exist, create it
|
||||
#if [ -z "$db_name" ]; then
|
||||
# db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
# ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
#REMOVEME? # ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
#fi
|
||||
|
||||
# If install_dir doesn't exist, create it
|
||||
|
@ -88,8 +88,6 @@ ynh_script_progression --message="Upgrading system configurations related to $ap
|
|||
|
||||
# This should be a literal copypasta of what happened in the install's "System configuration" section
|
||||
|
||||
ynh_add_fpm_config
|
||||
|
||||
ynh_add_nginx_config
|
||||
|
||||
ynh_add_systemd_config
|
||||
|
@ -98,8 +96,6 @@ yunohost service add $app --description="A short description of the app" --log="
|
|||
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
|
||||
|
||||
#=================================================
|
||||
# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue