mirror of
https://github.com/YunoHost-Apps/13ft_ynh.git
synced 2024-09-03 18:06:03 +02:00
Merge pull request #1 from YunoHost-Apps/testing
Fix install + Backup&Restore + Upgrade + fix dependencies + cleanup
This commit is contained in:
commit
bc54801a5d
14 changed files with 76 additions and 298 deletions
65
README.md
65
README.md
|
@ -1,85 +1,48 @@
|
||||||
# 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)
|
|
||||||
* Edit the `change_url` and `config` scripts too, or remove them if you have no use of them
|
|
||||||
* Add a `LICENSE` file for the package. NB: this LICENSE file is not meant to necessarily be the LICENSE of the upstream app - it is only the LICENSE you want this package's code to published with ;). We recommend to use [the AGPL-3](https://www.gnu.org/licenses/agpl-3.0.txt).
|
|
||||||
* 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
|
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.
|
It shall NOT be edited by hand.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
# Example app for YunoHost
|
# 13ft for YunoHost
|
||||||
|
|
||||||
[](https://dash.yunohost.org/appci/app/example)  
|
[](https://dash.yunohost.org/appci/app/13ft)  
|
||||||
[](https://install-app.yunohost.org/?app=example)
|
[](https://install-app.yunohost.org/?app=13ft)
|
||||||
|
|
||||||
*[Lire ce readme en français.](./README_fr.md)*
|
*[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 13ft 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.*
|
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
Some long and extensive description of what the app is and does, lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
13ft is an [12ft ladder](https://12ft.io) selfhosted alternative that allows you to bypass some paywalls and read the article content anyway.
|
||||||
|
https://github.com/wasi-master/13ft
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
- Provide *some* web articles that are normally protected by paywalls.
|
||||||
- Ut enim ad minim veniam, quis nostrud exercitation ullamco ;
|
|
||||||
- Laboris nisi ut aliquip ex ea commodo consequat ;
|
|
||||||
- Duis aute irure dolor in reprehenderit in voluptate ;
|
|
||||||
- Velit esse cillum dolore eu fugiat nulla pariatur ;
|
|
||||||
- Excepteur sint occaecat cupidatat non proident, sunt in culpa."
|
|
||||||
|
|
||||||
|
|
||||||
**Shipped version:** 1.0~ynh1
|
**Shipped version:** 0.1.1~ynh2
|
||||||
|
|
||||||
**Demo:** https://demo.example.com
|
|
||||||
|
|
||||||
## Screenshots
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Disclaimers / important information
|
## Disclaimers / important information
|
||||||
|
|
||||||
* Any known limitations, constrains or stuff not working, such as (but not limited to):
|
|
||||||
* requiring a full dedicated domain ?
|
|
||||||
* architectures not supported ?
|
|
||||||
* not-working single-sign on or LDAP integration ?
|
|
||||||
* the app requires an important amount of RAM / disk / .. to install or to work properly
|
|
||||||
* etc...
|
|
||||||
|
|
||||||
* Other infos that people should be aware of, such as:
|
|
||||||
* any specific step to perform after installing (such as manually finishing the install, specific admin credentials, ...)
|
|
||||||
* how to configure / administrate the application if it ain't obvious
|
|
||||||
* upgrade process / specificities / things to be aware of ?
|
|
||||||
* security considerations ?
|
|
||||||
|
|
||||||
## Documentation and resources
|
## Documentation and resources
|
||||||
|
|
||||||
* Official app website: <https://example.com>
|
* Official app website: <https://github.com/wasi-master/13ft>
|
||||||
* Official user documentation: <https://yunohost.org/apps>
|
* YunoHost documentation for this app: <https://yunohost.org/app_13ft>
|
||||||
* Official admin documentation: <https://yunohost.org/packaging_apps>
|
* Report a bug: <https://github.com/YunoHost-Apps/13ft_ynh/issues>
|
||||||
* 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>
|
|
||||||
|
|
||||||
## Developer info
|
## 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/13ft_ynh/tree/testing).
|
||||||
|
|
||||||
To try the testing branch, please proceed like that.
|
To try the testing branch, please proceed like that.
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
sudo yunohost app install https://github.com/YunoHost-Apps/example_ynh/tree/testing --debug
|
sudo yunohost app install https://github.com/YunoHost-Apps/13ft_ynh/tree/testing --debug
|
||||||
or
|
or
|
||||||
sudo yunohost app upgrade example -u https://github.com/YunoHost-Apps/example_ynh/tree/testing --debug
|
sudo yunohost app upgrade 13ft -u https://github.com/YunoHost-Apps/13ft_ynh/tree/testing --debug
|
||||||
```
|
```
|
||||||
|
|
||||||
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>
|
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>
|
||||||
|
|
53
README_fr.md
53
README_fr.md
|
@ -3,71 +3,46 @@ N.B.: This README was automatically generated by https://github.com/YunoHost/app
|
||||||
It shall NOT be edited by hand.
|
It shall NOT be edited by hand.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
# Exemple d'app pour YunoHost
|
# 13ft pour YunoHost
|
||||||
|
|
||||||
[](https://dash.yunohost.org/appci/app/example)  
|
[](https://dash.yunohost.org/appci/app/13ft)  
|
||||||
[](https://install-app.yunohost.org/?app=example)
|
[](https://install-app.yunohost.org/?app=13ft)
|
||||||
|
|
||||||
*[Read this readme in english.](./README.md)*
|
*[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 13ft rapidement et simplement sur un serveur YunoHost.
|
||||||
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
|
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
|
||||||
|
|
||||||
## Vue d'ensemble
|
## Vue d'ensemble
|
||||||
|
|
||||||
Some long and extensive description of what the app is and does, lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
13ft is an [12ft ladder](https://12ft.io) selfhosted alternative that allows you to bypass some paywalls and read the article content anyway.
|
||||||
|
https://github.com/wasi-master/13ft
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
- Provide *some* web articles that are normally protected by paywalls.
|
||||||
- Ut enim ad minim veniam, quis nostrud exercitation ullamco ;
|
|
||||||
- Laboris nisi ut aliquip ex ea commodo consequat ;
|
|
||||||
- Duis aute irure dolor in reprehenderit in voluptate ;
|
|
||||||
- Velit esse cillum dolore eu fugiat nulla pariatur ;
|
|
||||||
- Excepteur sint occaecat cupidatat non proident, sunt in culpa."
|
|
||||||
|
|
||||||
|
|
||||||
**Version incluse :** 1.0~ynh1
|
**Version incluse :** 0.1.1~ynh2
|
||||||
|
|
||||||
**Démo :** https://demo.example.com
|
|
||||||
|
|
||||||
## Captures d'écran
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Avertissements / informations importantes
|
## Avertissements / informations importantes
|
||||||
|
|
||||||
* Any known limitations, constrains or stuff not working, such as (but not limited to):
|
|
||||||
* requiring a full dedicated domain ?
|
|
||||||
* architectures not supported ?
|
|
||||||
* not-working single-sign on or LDAP integration ?
|
|
||||||
* the app requires an important amount of RAM / disk / .. to install or to work properly
|
|
||||||
* etc...
|
|
||||||
|
|
||||||
* Other infos that people should be aware of, such as:
|
|
||||||
* any specific step to perform after installing (such as manually finishing the install, specific admin credentials, ...)
|
|
||||||
* how to configure / administrate the application if it ain't obvious
|
|
||||||
* upgrade process / specificities / things to be aware of ?
|
|
||||||
* security considerations ?
|
|
||||||
|
|
||||||
## Documentations et ressources
|
## Documentations et ressources
|
||||||
|
|
||||||
* Site officiel de l'app : <https://example.com>
|
* Site officiel de l'app : <https://github.com/wasi-master/13ft>
|
||||||
* Documentation officielle utilisateur : <https://yunohost.org/apps>
|
* Documentation YunoHost pour cette app : <https://yunohost.org/app_13ft>
|
||||||
* Documentation officielle de l'admin : <https://yunohost.org/packaging_apps>
|
* Signaler un bug : <https://github.com/YunoHost-Apps/13ft_ynh/issues>
|
||||||
* 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>
|
|
||||||
|
|
||||||
## Informations pour les développeurs
|
## Informations pour les développeurs
|
||||||
|
|
||||||
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/example_ynh/tree/testing).
|
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/13ft_ynh/tree/testing).
|
||||||
|
|
||||||
Pour essayer la branche testing, procédez comme suit.
|
Pour essayer la branche testing, procédez comme suit.
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
sudo yunohost app install https://github.com/YunoHost-Apps/example_ynh/tree/testing --debug
|
sudo yunohost app install https://github.com/YunoHost-Apps/13ft_ynh/tree/testing --debug
|
||||||
ou
|
ou
|
||||||
sudo yunohost app upgrade example -u https://github.com/YunoHost-Apps/example_ynh/tree/testing --debug
|
sudo yunohost app upgrade 13ft -u https://github.com/YunoHost-Apps/13ft_ynh/tree/testing --debug
|
||||||
```
|
```
|
||||||
|
|
||||||
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>
|
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
SOURCE_URL=https://github.com/wasi-master/13ft/releases/download/v0.1.1/portable.py
|
SOURCE_URL=https://github.com/wasi-master/13ft/archive/refs/tags/v0.1.1.tar.gz
|
||||||
SOURCE_SUM=7efb48e5a2fe4a68c66619d7d6275d53cfeac1b4ff19079369e182bcabd82eb4
|
SOURCE_SUM=166685beb4aa1f924ef9d1b52d478702858b478a9e02cf49c1dab28e79d03601
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=
|
|
||||||
SOURCE_IN_SUBDIR=true
|
|
||||||
SOURCE_FILENAME=
|
|
||||||
SOURCE_EXTRACT=true
|
SOURCE_EXTRACT=true
|
||||||
|
SOURCE_IN_SUBDIR=true
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
Some long and extensive description of what the app is and does, lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
13ft is an [12ft ladder](https://12ft.io) selfhosted alternative that allows you to bypass some paywalls and read the article content anyway.
|
||||||
|
https://github.com/wasi-master/13ft
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
- Provide *some* web articles that are normally protected by paywalls.
|
||||||
- Ut enim ad minim veniam, quis nostrud exercitation ullamco ;
|
|
||||||
- Laboris nisi ut aliquip ex ea commodo consequat ;
|
|
||||||
- Duis aute irure dolor in reprehenderit in voluptate ;
|
|
||||||
- Velit esse cillum dolore eu fugiat nulla pariatur ;
|
|
||||||
- Excepteur sint occaecat cupidatat non proident, sunt in culpa."
|
|
||||||
|
|
|
@ -1,12 +1 @@
|
||||||
* Any known limitations, constrains or stuff not working, such as (but not limited to):
|
|
||||||
* requiring a full dedicated domain ?
|
|
||||||
* architectures not supported ?
|
|
||||||
* not-working single-sign on or LDAP integration ?
|
|
||||||
* the app requires an important amount of RAM / disk / .. to install or to work properly
|
|
||||||
* etc...
|
|
||||||
|
|
||||||
* Other infos that people should be aware of, such as:
|
|
||||||
* any specific step to perform after installing (such as manually finishing the install, specific admin credentials, ...)
|
|
||||||
* how to configure / administrate the application if it ain't obvious
|
|
||||||
* upgrade process / specificities / things to be aware of ?
|
|
||||||
* security considerations ?
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 35 KiB |
|
@ -3,18 +3,18 @@
|
||||||
"id": "13ft",
|
"id": "13ft",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
"description": {
|
"description": {
|
||||||
"en": "Selfhosted 12ft equivalent : bypass paywall by acting as GoogleBot",
|
"en": "Selfhosted 12ft equivalent - bypass paywall by acting as GoogleBot",
|
||||||
"fr": "Un équivalent de 12ft autohébergé : contourner les paywall en vous faisant passer pour GoogleBot"
|
"fr": "Un équivalent de 12ft autohébergé - contourner les paywall en vous faisant passer pour GoogleBot"
|
||||||
},
|
},
|
||||||
"version": "0.1.1~ynh1",
|
"version": "0.1.1~ynh2",
|
||||||
"url": "https://github.com/wasi-master/13ft",
|
"url": "https://github.com/wasi-master/13ft",
|
||||||
"upstream": {
|
"upstream": {
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"website": "https://github.com/wasi-master/13ft",
|
"website": "https://github.com/wasi-master/13ft"
|
||||||
},
|
},
|
||||||
"license": "free",
|
"license": "AGPL-3",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "Lapineige",
|
"name": "Lapineige"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 11.0.0"
|
"yunohost": ">= 11.0.0"
|
||||||
|
@ -39,7 +39,6 @@
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true
|
"default": true
|
||||||
},
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
|
|
||||||
# dependencies used by the app (must be on a single line)
|
# dependencies used by the app (must be on a single line)
|
||||||
#pkg_dependencies="deb1 deb2 $php_dependencies"
|
pkg_dependencies="python3-venv"
|
||||||
# How to install python flask ?
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
|
|
|
@ -30,9 +30,6 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
|
@ -50,63 +47,20 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
|
|
||||||
ynh_backup --src_path="$final_path"
|
ynh_backup --src_path="$final_path"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP THE DATA DIR
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="$datadir" --is_big
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX 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
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
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
|
# SPECIFIC BACKUP
|
||||||
#=================================================
|
|
||||||
# BACKUP LOGROTATE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP SYSTEMD
|
# BACKUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP VARIOUS FILES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
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
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -68,7 +68,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||||
|
|
||||||
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=language --value=$language
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
|
@ -94,26 +93,6 @@ ynh_script_progression --message="Finding an available port..." --weight=1
|
||||||
# ynh_script_progression --message="Configuring firewall..." --weight=1
|
# ynh_script_progression --message="Configuring firewall..." --weight=1
|
||||||
# ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
# ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# INSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Installing python dependencies..." --weight=1
|
|
||||||
|
|
||||||
### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package.
|
|
||||||
### Those deb packages will be installed as dependencies of this package.
|
|
||||||
### If you're not using this helper:
|
|
||||||
### - Remove the section "REMOVE DEPENDENCIES" in the remove script
|
|
||||||
### - Remove the variable "pkg_dependencies" in _common.sh
|
|
||||||
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
|
|
||||||
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
|
|
||||||
|
|
||||||
# ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
pushd $final_path
|
|
||||||
python3 -m venv venv
|
|
||||||
venv/bin/pip install --upgrade pip
|
|
||||||
venv/bin/pip install -r requirements.txt # should only be flask for now, but just in case
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -145,6 +124,25 @@ chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:www-data "$final_path"
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INSTALL APT DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Installing apt dependencies..." --weight=1
|
||||||
|
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INSTALL PYTHON DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Installing python dependencies..." --weight=1
|
||||||
|
|
||||||
|
pushd $final_path
|
||||||
|
python3 -m venv venv
|
||||||
|
venv/bin/pip install --upgrade pip
|
||||||
|
venv/bin/pip install -r requirements.txt # should only be flask for now, but just in case
|
||||||
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -179,7 +177,7 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||||
### - And the section "SETUP SYSTEMD" in the upgrade script
|
### - And the section "SETUP SYSTEMD" in the upgrade script
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
# ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -60,10 +60,14 @@ ynh_remove_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
ynh_script_progression --message="Removing apt dependencies..." --weight=1
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
venv/bin/pip uninstall flask
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
|
# ynh_script_progression --message="Removing python dependencies..." --weight=1
|
||||||
|
# Remove metapackage and its dependencies
|
||||||
|
# venv/bin/pip uninstall flask # useless, managed by previous helper ?
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -31,10 +31,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)
|
||||||
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_user=$db_name
|
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
|
@ -71,50 +67,26 @@ chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:www-data "$final_path"
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE DATA DIRECTORY
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
|
||||||
|
|
||||||
mkdir -p $datadir
|
|
||||||
|
|
||||||
# FIXME: this should be managed by the core in the future
|
|
||||||
# Here, as a packager, you may have to tweak the ownerhsip/permissions
|
|
||||||
# such that the appropriate users (e.g. maybe www-data) can access
|
|
||||||
# files in some cases.
|
|
||||||
# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder -
|
|
||||||
# this will be treated as a security issue.
|
|
||||||
chmod 750 "$datadir"
|
|
||||||
chmod -R o-rwx "$datadir"
|
|
||||||
chown -R $app:www-data "$datadir"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE FAIL2BAN CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=1
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
ynh_script_progression --message="Reinstalling apt dependencies..." --weight=1
|
||||||
|
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
# INSTALL PYTHON DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --time --weight=1
|
ynh_script_progression --message="Reinstalling Python dependencies..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
pushd $final_path
|
||||||
|
python3 -m venv venv
|
||||||
|
venv/bin/pip install --upgrade pip
|
||||||
|
venv/bin/pip install -r requirements.txt # should only be flask for now, but just in case
|
||||||
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
|
@ -123,24 +95,6 @@ ynh_script_progression --message="Restoring the NGINX web server configuration..
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE MYSQL DATABASE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
|
|
||||||
|
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
|
||||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
|
||||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE VARIOUS FILES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring various files..." --weight=1
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/$app/"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -149,13 +103,6 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||||
systemctl enable $app.service --quiet
|
systemctl enable $app.service --quiet
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE LOGROTATE CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -175,9 +122,8 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM
|
# RELOAD NGINX AND PHP-FPM
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -138,14 +138,6 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
|
|
||||||
|
|
||||||
# Create a dedicated PHP-FPM config
|
|
||||||
ynh_add_fpm_config
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -157,33 +149,6 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
#=================================================
|
#=================================================
|
||||||
# ...
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPDATE A CONFIG FILE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
|
||||||
|
|
||||||
### Same as during install
|
|
||||||
###
|
|
||||||
### The file will automatically be backed-up if it's found to be manually modified (because
|
|
||||||
### ynh_add_config keeps track of the file's checksum)
|
|
||||||
|
|
||||||
ynh_add_config --template="some_config_file" --destination="$final_path/some_config_file"
|
|
||||||
|
|
||||||
# FIXME: this should be handled by the core in the future
|
|
||||||
# You may need to use chmod 600 instead of 400,
|
|
||||||
# for example if the app is expected to be able to modify its own config
|
|
||||||
chmod 400 "$final_path/some_config_file"
|
|
||||||
chown $app:$app "$final_path/some_config_file"
|
|
||||||
|
|
||||||
### For more complex cases where you want to replace stuff using regexes,
|
|
||||||
### you shoud rely on ynh_replace_string (which is basically a wrapper for sed)
|
|
||||||
### When doing so, you also need to manually call ynh_store_file_checksum
|
|
||||||
###
|
|
||||||
### ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$final_path/some_config_file"
|
|
||||||
### ynh_store_file_checksum --file="$final_path/some_config_file"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
|
@ -217,14 +182,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPGRADE FAIL2BAN
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=1
|
|
||||||
|
|
||||||
# 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"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue