1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/streams_ynh.git synced 2024-09-03 20:26:20 +02:00

Merge pull request #38 from YunoHost-Apps/testing

Testing / Helpers 2.1
This commit is contained in:
Papa Dragon 2024-09-03 13:39:38 +02:00 committed by GitHub
commit ab4ce05224
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 239 additions and 502 deletions

View file

@ -5,4 +5,6 @@
- [Irakurri README euskaraz](README_eu.md)
- [Lire le README en français](README_fr.md)
- [Le o README en galego](README_gl.md)
- [Baca README dalam bahasa bahasa Indonesia](README_id.md)
- [Прочитать README на русский](README_ru.md)
- [阅读中文(简体)的 README](README_zh_Hans.md)

View file

@ -5,7 +5,7 @@ It shall NOT be edited by hand.
# Streams for YunoHost
[![Integration level](https://dash.yunohost.org/integration/streams.svg)](https://dash.yunohost.org/appci/app/streams) ![Working status](https://ci-apps.yunohost.org/ci/badges/streams.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/streams.maintain.svg)
[![Integration level](https://dash.yunohost.org/integration/streams.svg)](https://ci-apps.yunohost.org/ci/apps/streams/) ![Working status](https://ci-apps.yunohost.org/ci/badges/streams.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/streams.maintain.svg)
[![Install Streams with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=streams)
@ -21,7 +21,7 @@ The [streams repository](https://codeberg.org/streams/streams/) lets you install
Your websites will be compatible with **Mastodon**, **Pleroma**, **Pixelfed**, **Friendica**, **Hubzilla**, **Funkwhale**, **Peertube**, **Plume**, **WriteFreely** and many, many more.
**Shipped version:** 24.05.10~ynh1
**Shipped version:** 24.8.27~ynh1
## Screenshots

View file

@ -5,7 +5,7 @@ No se debe editar a mano.
# Streams para Yunohost
[![Nivel de integración](https://dash.yunohost.org/integration/streams.svg)](https://dash.yunohost.org/appci/app/streams) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/streams.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/streams.maintain.svg)
[![Nivel de integración](https://dash.yunohost.org/integration/streams.svg)](https://ci-apps.yunohost.org/ci/apps/streams/) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/streams.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/streams.maintain.svg)
[![Instalar Streams con Yunhost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=streams)
@ -21,7 +21,7 @@ The [streams repository](https://codeberg.org/streams/streams/) lets you install
Your websites will be compatible with **Mastodon**, **Pleroma**, **Pixelfed**, **Friendica**, **Hubzilla**, **Funkwhale**, **Peertube**, **Plume**, **WriteFreely** and many, many more.
**Versión actual:** 24.05.10~ynh1
**Versión actual:** 24.8.27~ynh1
## Capturas

View file

@ -5,7 +5,7 @@ EZ editatu eskuz.
# Streams YunoHost-erako
[![Integrazio maila](https://dash.yunohost.org/integration/streams.svg)](https://dash.yunohost.org/appci/app/streams) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/streams.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/streams.maintain.svg)
[![Integrazio maila](https://dash.yunohost.org/integration/streams.svg)](https://ci-apps.yunohost.org/ci/apps/streams/) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/streams.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/streams.maintain.svg)
[![Instalatu Streams YunoHost-ekin](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=streams)
@ -21,7 +21,7 @@ The [streams repository](https://codeberg.org/streams/streams/) lets you install
Your websites will be compatible with **Mastodon**, **Pleroma**, **Pixelfed**, **Friendica**, **Hubzilla**, **Funkwhale**, **Peertube**, **Plume**, **WriteFreely** and many, many more.
**Paketatutako bertsioa:** 24.05.10~ynh1
**Paketatutako bertsioa:** 24.8.27~ynh1
## Pantaila-argazkiak

View file

@ -5,7 +5,7 @@ Il NE doit PAS être modifié à la main.
# Streams pour YunoHost
[![Niveau dintégration](https://dash.yunohost.org/integration/streams.svg)](https://dash.yunohost.org/appci/app/streams) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/streams.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/streams.maintain.svg)
[![Niveau dintégration](https://dash.yunohost.org/integration/streams.svg)](https://ci-apps.yunohost.org/ci/apps/streams/) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/streams.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/streams.maintain.svg)
[![Installer Streams avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=streams)
@ -21,7 +21,7 @@ Le [dépôt streams](https://codeberg.org/streams/streams/) vous permet d'instal
Vos sites web seront compatibles avec **Mastodon**, **Pleroma**, **Pixelfed**, **Friendica**, **Hubzilla**, **Funkwhale**, **Peertube**, **Plume**, **WriteFreely** et bien d'autres encore.
**Version incluse:** 24.05.10~ynh1
**Version incluse:** 24.8.27~ynh1
## Captures décran

View file

@ -5,7 +5,7 @@ NON debe editarse manualmente.
# Streams para YunoHost
[![Nivel de integración](https://dash.yunohost.org/integration/streams.svg)](https://dash.yunohost.org/appci/app/streams) ![Estado de funcionamento](https://ci-apps.yunohost.org/ci/badges/streams.status.svg) ![Estado de mantemento](https://ci-apps.yunohost.org/ci/badges/streams.maintain.svg)
[![Nivel de integración](https://dash.yunohost.org/integration/streams.svg)](https://ci-apps.yunohost.org/ci/apps/streams/) ![Estado de funcionamento](https://ci-apps.yunohost.org/ci/badges/streams.status.svg) ![Estado de mantemento](https://ci-apps.yunohost.org/ci/badges/streams.maintain.svg)
[![Instalar Streams con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=streams)
@ -21,7 +21,7 @@ The [streams repository](https://codeberg.org/streams/streams/) lets you install
Your websites will be compatible with **Mastodon**, **Pleroma**, **Pixelfed**, **Friendica**, **Hubzilla**, **Funkwhale**, **Peertube**, **Plume**, **WriteFreely** and many, many more.
**Versión proporcionada:** 24.05.10~ynh1
**Versión proporcionada:** 24.8.27~ynh1
## Capturas de pantalla

48
README_id.md Normal file
View file

@ -0,0 +1,48 @@
<!--
N.B.: README ini dibuat secara otomatis oleh <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
Ini TIDAK boleh diedit dengan tangan.
-->
# Streams untuk YunoHost
[![Tingkat integrasi](https://dash.yunohost.org/integration/streams.svg)](https://ci-apps.yunohost.org/ci/apps/streams/) ![Status kerja](https://ci-apps.yunohost.org/ci/badges/streams.status.svg) ![Status pemeliharaan](https://ci-apps.yunohost.org/ci/badges/streams.maintain.svg)
[![Pasang Streams dengan YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=streams)
*[Baca README ini dengan bahasa yang lain.](./ALL_README.md)*
> *Paket ini memperbolehkan Anda untuk memasang Streams secara cepat dan mudah pada server YunoHost.*
> *Bila Anda tidak mempunyai YunoHost, silakan berkonsultasi dengan [panduan](https://yunohost.org/install) untuk mempelajari bagaimana untuk memasangnya.*
## Ringkasan
The [streams repository](https://codeberg.org/streams/streams/) lets you install fediverse-connected websites with powerful and innovative features such as decentralized/nomadic identity, permissions framework, and much more (see [FEATURES](doc/FEATURES.md)).
Your websites will be compatible with **Mastodon**, **Pleroma**, **Pixelfed**, **Friendica**, **Hubzilla**, **Funkwhale**, **Peertube**, **Plume**, **WriteFreely** and many, many more.
**Versi terkirim:** 24.8.27~ynh1
## Tangkapan Layar
![Tangkapan Layar pada Streams](./doc/screenshots/example.png)
## Dokumentasi dan sumber daya
- Depot kode aplikasi hulu: <https://codeberg.org/streams/streams>
- Gudang YunoHost: <https://apps.yunohost.org/app/streams>
- Laporkan bug: <https://github.com/YunoHost-Apps/streams_ynh/issues>
## Info developer
Silakan kirim pull request ke [`testing` branch](https://github.com/YunoHost-Apps/streams_ynh/tree/testing).
Untuk mencoba branch `testing`, silakan dilanjutkan seperti:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/streams_ynh/tree/testing --debug
atau
sudo yunohost app upgrade streams -u https://github.com/YunoHost-Apps/streams_ynh/tree/testing --debug
```
**Info lebih lanjut mengenai pemaketan aplikasi:** <https://yunohost.org/packaging_apps>

48
README_ru.md Normal file
View file

@ -0,0 +1,48 @@
<!--
Важно: этот README был автоматически сгенерирован <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
Он НЕ ДОЛЖЕН редактироваться вручную.
-->
# Streams для YunoHost
[![Уровень интеграции](https://dash.yunohost.org/integration/streams.svg)](https://ci-apps.yunohost.org/ci/apps/streams/) ![Состояние работы](https://ci-apps.yunohost.org/ci/badges/streams.status.svg) ![Состояние сопровождения](https://ci-apps.yunohost.org/ci/badges/streams.maintain.svg)
[![Установите Streams с YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=streams)
*[Прочтите этот README на других языках.](./ALL_README.md)*
> *Этот пакет позволяет Вам установить Streams быстро и просто на YunoHost-сервер.*
> *Если у Вас нет YunoHost, пожалуйста, посмотрите [инструкцию](https://yunohost.org/install), чтобы узнать, как установить его.*
## Обзор
The [streams repository](https://codeberg.org/streams/streams/) lets you install fediverse-connected websites with powerful and innovative features such as decentralized/nomadic identity, permissions framework, and much more (see [FEATURES](doc/FEATURES.md)).
Your websites will be compatible with **Mastodon**, **Pleroma**, **Pixelfed**, **Friendica**, **Hubzilla**, **Funkwhale**, **Peertube**, **Plume**, **WriteFreely** and many, many more.
**Поставляемая версия:** 24.8.27~ynh1
## Снимки экрана
![Снимок экрана Streams](./doc/screenshots/example.png)
## Документация и ресурсы
- Репозиторий кода главной ветки приложения: <https://codeberg.org/streams/streams>
- Магазин YunoHost: <https://apps.yunohost.org/app/streams>
- Сообщите об ошибке: <https://github.com/YunoHost-Apps/streams_ynh/issues>
## Информация для разработчиков
Пришлите Ваш запрос на слияние в [ветку `testing`](https://github.com/YunoHost-Apps/streams_ynh/tree/testing).
Чтобы попробовать ветку `testing`, пожалуйста, сделайте что-то вроде этого:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/streams_ynh/tree/testing --debug
или
sudo yunohost app upgrade streams -u https://github.com/YunoHost-Apps/streams_ynh/tree/testing --debug
```
**Больше информации о пакетировании приложений:** <https://yunohost.org/packaging_apps>

View file

@ -5,7 +5,7 @@
# YunoHost 上的 Streams
[![集成程度](https://dash.yunohost.org/integration/streams.svg)](https://dash.yunohost.org/appci/app/streams) ![工作状态](https://ci-apps.yunohost.org/ci/badges/streams.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/streams.maintain.svg)
[![集成程度](https://dash.yunohost.org/integration/streams.svg)](https://ci-apps.yunohost.org/ci/apps/streams/) ![工作状态](https://ci-apps.yunohost.org/ci/badges/streams.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/streams.maintain.svg)
[![使用 YunoHost 安装 Streams](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=streams)
@ -21,7 +21,7 @@ The [streams repository](https://codeberg.org/streams/streams/) lets you install
Your websites will be compatible with **Mastodon**, **Pleroma**, **Pixelfed**, **Friendica**, **Hubzilla**, **Funkwhale**, **Peertube**, **Plume**, **WriteFreely** and many, many more.
**分发版本:** 24.05.10~ynh1
**分发版本:** 24.8.27~ynh1
## 截图

View file

@ -1,4 +1,3 @@
# Run poller periodically to update your website
*/10 * * * * __APP__ /usr/bin/php__PHPVERSION__ -f Code/Daemon/Run.php Cron > /dev/null 2>&1
# Daily software update job
30 05 * * * root /bin/bash __DATA_DIR__/daily-update.sh >> __DATA_DIR__/daily-updates.log 2>&1
*/10 * * * * __APP__ /usr/bin/php__PHP_VERSION__ -f src/Daemon/Run.php Cron > /dev/null 2>&1

View file

@ -1,17 +0,0 @@
#!/bin/sh
#
echo " "
echo "+++ $(date) +++"
echo " "
git_branch="$(cd /var/www/__APP__ && sudo -u __APP__ \
git branch --show-current)" 2> /dev/null
if echo $git_branch | grep -q "release"
then
echo "$(date) - Updating website..."
(cd /var/www/__APP__ ; sudo -u __APP__ util/udall)
else
echo "$(date) - Updating release branch code..."
(cd /var/www/__APP__ ; sudo -u __APP__ git fetch origin release:release)
fi
echo "$(date) - Daily update finished."

View file

@ -1,4 +0,0 @@
; Additional php.ini defines, specific to this pool of workers.
php_admin_value[upload_max_filesize] = 50M
php_admin_value[post_max_size] = 50M

View file

@ -109,7 +109,7 @@ App::$config['system']['max_import_size'] = 200000;
// Location of PHP command line processor
App::$config['system']['php_path'] = '/usr/bin/php__PHPVERSION__';
App::$config['system']['php_path'] = '/usr/bin/php__PHP_VERSION__';
// Configure how we communicate with directory servers.
// Deprecated. Please do not change.

View file

@ -16,7 +16,7 @@ location __PATH__/ {
location ~* \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

View file

@ -1,48 +0,0 @@
version = "1.0"
[main]
name.en = "Streams configuration"
name.fr = "Configuration de Streams"
[main.php_fpm_config]
name.en = "PHP-FPM configuration"
name.fr = "Configuration de PHP-FPM"
[main.php_fpm_config.fpm_footprint]
ask.en = "Memory footprint"
ask.fr = "Empreinte mémoire"
type = "select"
choices = ["low", "medium", "high", "specific"]
default = "medium"
help.en = "<strong>low</strong>: <= 20Mb per pool<br><strong>medium</strong>: Between 20Mb and 40Mb per pool<br><strong>high</strong>: 40Mb per pool<br><strong>specific</strong> : Use specific value"
help.fr = "<strong>low</strong>: <= 20Mb par pool<br><strong>medium</strong>: Entre 20Mb et 40Mb par pool<br><strong>high</strong>: 40Mb par pool<br><strong>specific</strong> : Utiliser une valeur personnalisée"
[main.php_fpm_config.fpm_free_footprint]
visible = "fpm_footprint == 'specific'"
ask.en = "Memory footprint of the service?"
ask.fr = "Empreinte mémoire du service?"
type = "number"
default = "0"
help.en = "Free field to specify exactly the footprint in Mb if you don't want to use one of the three previous values."
help.fr = "Champ libre pour spécifier exactement l'empreinte mémoire en Mb si vous ne souhaitez pas utiliser l'une des trois valeurs précédentes."
[main.php_fpm_config.fpm_usage]
ask.en = "Expected usage"
ask.fr = "Utilisation prévue"
type = "select"
choices = ["low", "medium", "high"]
default = "medium"
help.en = "<strong>low</strong>: 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><strong>medium</strong>: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.<br><strong>high</strong>: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding."
help.fr = "<strong>low</strong> : Utilisation personnelle, derrière le SSO. Pas d'empreinte RAM en cas de non-utilisation, mais l'impact sur le processeur peut être élevé si de nombreux utilisateurs utilisent le service.<br><strong>medium</strong> : Faible utilisation, peu d'utilisateurs et/ou service pas nécessairement accessible au public. Faible empreinte RAM, empreinte moyenne sur le processeur en cas d'utilisation.<br><strong>high</strong> : Utilisation soutenue, site web fréquemment visité. L'empreinte RAM est élevée, mais l'utilisation du processeur est moindre et le service répond rapidement."
[main.git_branch_mode]
name.en = "Developer Mode"
name.fr = "Mode Développeur"
[main.git_branch_mode.git_branch_mode]
ask.en = "Switch to 'dev' branch"
ask.fr = "Basculer sur la branche 'dev'"
type = "boolean"
default = "0"
help.en = "<strong>This option should only be used if you're either a professional software developer or a certified lunatic (or both).</strong><br><br>You can only return to the 'release' branch if it is ahead of the 'dev' branch.<br><br>If authorised, the switch to the 'release' branch will be immediately followed by a global update of the site - via the util/udall command.<br><br>You must be able to use the command line to solve any problems you may encounter after using this option.<br><br>If you haven't understood any of the above lines <strong>DON'T USE THIS OPTION!!!</strong>"
help.fr = "<strong>Cette option ne devrait être utilisée que si vous êtes un développeur de logiciels professionnel ou une personne passablement déraisonnable (ou les deux à la fois)</strong><br><br>Vous ne pourrez revenir à la branche 'release' que si celle-ci est en avance sur la branche 'dev'.<br><br>Si elle est autorisée, la bascule vers la branche 'release' sera immédiatement suivie d'une mise à jour globale du site - via la commande util/udall.<br><br>Vous devez impérativement être capable d'utiliser la ligne de commande pour résoudre tout problème que vous pourriez rencontrer après avoir utilisé cette option.<br><br>Si vous n'avez rien compris aux lignes ci-dessus <strong>N'UTILISEZ PAS CETTE OPTION!!!</strong>"

View file

@ -5,7 +5,7 @@ name = "Streams"
description.en = "Open source fediverse server"
description.fr = "Serveur fediverse open source"
version = "24.05.10~ynh1"
version = "24.8.27~ynh1"
maintainers = ["Papa Dragon"]
@ -14,7 +14,8 @@ license = "Unlicense"
code = "https://codeberg.org/streams/streams"
[integration]
yunohost = ">= 11.2"
yunohost = ">= 11.2.18"
helpers_version = "2.1"
architectures = "all"
multi_instance = true
ldap = false
@ -46,11 +47,25 @@ ram.runtime = "50M"
[resources]
[resources.sources]
[resources.sources.main]
url = "https://codeberg.org/streams/streams/archive/v24.8.27.tar.gz"
sha256 = "61bc0e0cb088c2644bcc4993f41af449d111a394e559eede75204b504b5fcbbb"
autoupdate.strategy = "latest_forgejo_tag"
autoupdate.version_regex = "^v(.*)$"
[resources.sources.addons]
url = "https://codeberg.org/streams/streams-addons/archive/47ce10d5f6e855186d10f2373dc7bbe385454cce.tar.gz"
sha256 = "ddea62f2c745ccb29f291813e0a8a24b122c9eba67539fd3a792862c6653b134"
autoupdate.strategy = "latest_forgejo_commit"
autoupdate.upstream = "https://codeberg.org/streams/streams-addons"
[resources.ports]
[resources.system_user]
[resources.install_dir]
group = "www-data:r-x"
[resources.data_dir]
@ -58,7 +73,7 @@ ram.runtime = "50M"
main.url = "/"
[resources.apt]
packages = "php8.2-mbstring, php8.2-cli, php8.2-imagick, php8.2-xml, php8.2-zip, php8.2-curl, php8.2-ldap, php8.2-gd, mariadb-server, php8.2-mysql php8.2-gmp"
packages = "php8.3-mbstring, php8.3-cli, php8.3-imagick, php8.3-xml, php8.3-zip, php8.3-curl, php8.3-ldap, php8.3-gd, mariadb-server, php8.3-mysql php8.3-gmp"
[resources.database]
type = "mysql"

View file

@ -1,22 +1,10 @@
#!/bin/bash
#=================================================
# COMMON VARIABLES
# COMMON VARIABLES AND CUSTOM HELPERS
#=================================================
# PHP APP SPECIFIC
#=================================================
YNH_COMPOSER_VERSION="2.5.8"
YNH_PHP_VERSION="8.2"
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================
composer_version="2.7.8"
YNH_PHP_VERSION="8.3"

View file

@ -1,44 +1,36 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
ynh_print_info "Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
# BACKUP THE APP MAIN DIR & DATA DIR
#=================================================
ynh_backup --src_path="$install_dir"
ynh_backup "$install_dir"
ynh_backup "$data_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup "/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"
ynh_backup "/etc/php/$php_version/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"
ynh_backup "/etc/fail2ban/jail.d/$app.conf"
ynh_backup "/etc/fail2ban/filter.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
@ -46,24 +38,23 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
# BACKUP LOGROTATE
#=================================================
ynh_backup --src_path="/etc/logrotate.d/$app"
ynh_backup "/etc/logrotate.d/$app"
#=================================================
# BACKUP CRON JOBS
#=================================================
ynh_backup --src_path="/etc/cron.d/$app"
ynh_backup --src_path="$data_dir"
ynh_backup "/etc/cron.d/$app"
#=================================================
# BACKUP THE DATABASE
#=================================================
ynh_print_info --message="Backup of the MySQL database..."
ynh_print_info "Backup of the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql
ynh_mysql_dump_db > db.sql
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -1,134 +0,0 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
phpversion="$YNH_PHP_VERSION"
current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
#=================================================
# SPECIFIC GETTERS FOR TOML SHORT KEY
#=================================================
get__git_branch_mode() {
# Git branch mode status
git_branch_mode_status="$(cd "$install_dir" && sudo -u $app git branch --show-current)" 2> /dev/null
if echo $git_branch_mode_status | grep -q "release"
then
echo "0"
elif echo $git_branch_mode_status | grep -q "dev"
then
echo "1"
else
ynh_print_err --message="Not using \"release\" or \"dev\" branch, please handle this in command line"
exit 0
fi
}
get__fpm_footprint() {
# Free footprint value for php-fpm
# Check if current_fpm_footprint is an integer
if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
then
echo "specific"
else
echo "$current_fpm_footprint"
fi
}
get__free_footprint() {
# Free footprint value for php-fpm
# Check if current_fpm_footprint is an integer
if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
then
# If current_fpm_footprint is an integer, that's a numeric value for the footprint
echo "$current_fpm_footprint"
else
echo "0"
fi
}
#=================================================
# SPECIFIC SETTERS FOR TOML SHORT KEYS
#=================================================
set__git_branch_mode() {
if [ "$git_branch_mode" -eq "0" ]
then
# We allow switch back to "release" only if the branch is ahead of "dev"
if [ -z "$(cd "$install_dir" && git log --oneline release..dev)" ]
then
# If git_branch was set to 0, switch to "release" branch
ynh_print_info "Switching to \"release\" branch"
(cd "$install_dir" && ynh_exec_as "$app" git checkout release)
ynh_print_info "Full update of the website"
(cd /home/yunohost.app/"$app" && bash daily-update.sh >> daily-updates.log 2>&1)
else
ynh_die --message="\"release\" branch is behind your local \"dev\" branch, rolling back is not allowed here"
exit 1
fi
elif [ "$git_branch_mode" -eq "1" ]; then
# If git_branch was set to 1, switch to "dev" branch
(cd "$install_dir" && ynh_exec_as "$app" git checkout dev)
ynh_print_info "Switching to \"dev\" branch"
fi
ynh_app_setting_set --app=$app --key=git_branch_mode --value="$git_branch_mode"
}
set__fpm_footprint() {
if [ "$fpm_footprint" != "specific" ]
then
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_footprint"
fi
}
set__fpm_free_footprint() {
if [ "$fpm_footprint" = "specific" ]
then
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_free_footprint"
fi
}
#=================================================
# GENERIC FINALIZATION
#=================================================
ynh_app_config_validate() {
_ynh_app_config_validate
if [ "${changed[fpm_usage]}" == "true" ] || [ "${changed[fpm_footprint]}" == "true" ] || [ "${changed[fpm_free_footprint]}" == "true" ]; then
# If fpm_footprint is set to 'specific', use $fpm_free_footprint value.
if [ "$fpm_footprint" = "specific" ]
then
fpm_footprint=$fpm_free_footprint
fi
if [ "$fpm_footprint" == "0" ]
then
ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below."
exit 0
fi
fi
}
ynh_app_config_apply() {
_ynh_app_config_apply
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
}
ynh_app_config_run $1

View file

@ -1,110 +1,71 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
# INITIALIZE SETTINGS
#=================================================
ynh_script_progression "Initialize installation settings..."
email=$(ynh_user_get_info --username=$admin --key=mail)
upload="256M"
random_string="$(ynh_string_random --length=48)"
fpm_footprint="medium"
fpm_free_footprint=0
fpm_usage="medium"
git_branch_mode="0"
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=email --value=$email
ynh_app_setting_set --app=$app --key=upload --value=$upload
ynh_app_setting_set --app=$app --key=random_string --value=$random_string
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
ynh_app_setting_set --app=$app --key=git_branch_mode --value="$git_branch_mode"
ynh_app_setting_set_default --key=email --value=$(ynh_user_get_info --username=$admin --key=mail)
ynh_app_setting_set_default --key=upload --value="256M"
ynh_app_setting_set_default --key=random_string --value="$(ynh_string_random --length=48)"
#=================================================
# CREATE A DATABASE
#=================================================
ynh_script_progression --message="Creating a database..." --weight=2
ynh_script_progression "Tweak database character set..."
ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name \
ynh_mysql_db_shell \
<<< "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
mkdir -p "$install_dir"
chown -R $app:www-data "$install_dir"
ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from GitHub
ynh_exec_as $app git clone https://codeberg.org/streams/streams.git "$install_dir" --quiet
git config --system --add safe.directory $install_dir
ynh_setup_source --dest_dir="$install_dir"
ynh_setup_source --dest_dir="$install_dir/addon" --source_id="addons"
touch "$install_dir/php.log"
mkdir -p "$install_dir/store"
mkdir -p "$install_dir/cache/smarty3"
ynh_exec_as_app mkdir -p "$install_dir/store"
ynh_exec_as_app mkdir -p "$install_dir/cache/smarty3"
chmod -R o-rwx "$install_dir"
chmod -R 775 $install_dir/store $install_dir/cache
ynh_exec_as_app chmod -R 775 $install_dir/store $install_dir/cache
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
ynh_script_progression "Configuring PHP-FPM..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
ynh_config_add_phpfpm
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_config_add_nginx
#=================================================
# COMPOSER
#=================================================
ynh_script_progression --message="Pulling in external libraries with Composer..."
ynh_script_progression "Pulling in external libraries with Composer..."
ynh_install_composer --workdir="$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# ADDONS
#=================================================
ynh_script_progression --message="Installing addons..."
pushd $install_dir
ynh_exec_as $app git config pull.rebase false
ynh_exec_as $app util/add_addon_repo https://codeberg.org/streams/streams-addons.git zaddons
cd /var/www/$app/extend/addon/zaddons
ynh_exec_as $app git config pull.rebase false
popd
ynh_composer_install
ynh_composer_exec install --no-dev
#=================================================
# SPECIFIC SETUP
#=================================================
# PROVISION DATABASE
#=================================================
ynh_script_progression --message="Provisionning database..." --weight=1
ynh_script_progression "Provisionning database..."
ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" < $install_dir/install/schema_mysql.sql
ynh_mysql_db_shell < $install_dir/install/schema_mysql.sql
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_script_progression "Adding $app's configuration..."
timezone=$(</etc/timezone)
@ -115,48 +76,39 @@ else
max_imported_follow=0
fi
ynh_add_config --template="../conf/htconfig.sample.php" --destination="$install_dir/.htconfig.php"
ynh_config_add --template="htconfig.sample.php" --destination="$install_dir/.htconfig.php"
ynh_store_file_checksum --file=$install_dir/.htconfig.php
ynh_store_file_checksum $install_dir/.htconfig.php
chmod 600 "$install_dir/.htconfig.php"
chown $app:$app "$install_dir/.htconfig.php"
ynh_exec_as $app touch $data_dir/extra_conf.php
ynh_exec_as_app touch $data_dir/extra_conf.php
#=================================================
# SET CRON JOBS
#=================================================
ynh_script_progression --message="Setuping cron job..." --weight=1
ynh_script_progression "Setuping cron job..."
# Set up cron job
ynh_add_config --template="../conf/cronjobs" --destination="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
# Add daily update script
ynh_add_config --template="../conf/daily-update.sh" --destination="/home/yunohost.app/$app/daily-update.sh"
chown root: "/home/yunohost.app/$app/daily-update.sh"
ynh_config_add --template="cronjobs" --destination="/etc/cron.d/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
ynh_script_progression "Configuring log rotation..."
# Use logrotate to manage application logfile(s)
ynh_use_logrotate "$install_dir/php.log"
ynh_config_add_logrotate "/var/log/$app/php.log"
ynh_exec_as_app touch "/var/log/$app/php.log"
#=================================================
# SETUP FAIL2BAN
#=================================================
ynh_script_progression --message="Configuring Fail2Ban..." --weight=1
ynh_script_progression "Configuring Fail2Ban..."
# Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="$install_dir/php.log" --failregex="^.*auth\.php.*failed login attempt.*from IP <HOST>.*$" --max_retry="5"
ynh_config_add_fail2ban --logpath="/var/log/$app/php.log" --failregex="^.*auth\.php.*failed login attempt.*from IP <HOST>.*$"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last
ynh_script_progression "Installation of $app completed"

View file

@ -1,39 +1,30 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
ynh_script_progression "Removing system configurations related to $app..."
# Remove the dedicated NGINX config
ynh_remove_nginx_config
ynh_config_remove_nginx
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
ynh_config_remove_phpfpm
# Remove the app-specific logrotate config
ynh_remove_logrotate
ynh_config_remove_logrotate
# Remove the dedicated Fail2Ban config
ynh_remove_fail2ban_config
ynh_config_remove_fail2ban
# Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app"
# Remove daily updates logfile
ynh_secure_remove --file="$data_dir/daily-updates.log"
ynh_safe_rm "/etc/cron.d/$app"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last
ynh_script_progression "Removal of $app completed"

View file

@ -1,70 +1,59 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE APP MAIN DIR
# RESTORE THE APP MAIN DIR & DATA DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_script_progression "Restoring the app main directory..."
ynh_restore_file --origin_path="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
ynh_restore "$install_dir"
ynh_restore "$data_dir"
#=================================================
# RESTORE THE DATABASE
#=================================================
ynh_script_progression --message="Restoring MySQL database..." --weight=1
ynh_script_progression "Restoring MySQL database..."
ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name \
ynh_mysql_db_shell \
<<< "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
ynh_mysql_execute_file_as_root --file="./db.sql" --database=$db_name
ynh_mysql_db_shell < "./db.sql"
#=================================================
# RESTORE FAIL2BAN CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=1
ynh_script_progression "Restoring the Fail2Ban configuration..."
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
ynh_restore "/etc/fail2ban/jail.d/$app.conf"
ynh_restore "/etc/fail2ban/filter.d/$app.conf"
ynh_systemctl --action=restart --service=fail2ban
#=================================================
# RESTORE CRON JOBS
#=================================================
ynh_restore_file --origin_path="/etc/cron.d/$app"
ynh_restore_file --origin_path="$data_dir"
ynh_restore "/etc/cron.d/$app"
#=================================================
# RESTORE LOGROTATE
#=================================================
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
ynh_restore "/etc/logrotate.d/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
ynh_script_progression "Reloading NGINX web server and PHP-FPM..."
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
ynh_systemctl --service=php$php_version-fpm --action=reload
ynh_systemctl --service=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last
ynh_script_progression "Restoration completed for $app"

View file

@ -1,186 +1,103 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..." --weight=1
ynh_script_progression "Loading settings..."
email=$(ynh_user_get_info --username=$admin --key=mail)
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If fpm_footprint doesn't exist, create it
if [ -z "$fpm_footprint" ]; then
fpm_footprint=low
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
fi
# If fpm_free_footprint doesn't exist, create it
if [ -z "$fpm_free_footprint" ]; then
fpm_free_footprint=0
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
fi
# If fpm_usage doesn't exist, create it
if [ -z "$fpm_usage" ]; then
fpm_usage=low
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
fi
# Make sure that git_branch_mode exists with relevant value
git_branch_mode_status="$(cd "$install_dir" && sudo -u $app git branch --show-current)" 2> /dev/null
if echo $git_branch_mode_status | grep -q "release"
then
git_branch_mode="0"
ynh_app_setting_set --app=$app --key=git_branch_mode --value="$git_branch_mode"
elif echo $git_branch_mode_status | grep -q "dev"
then
git_branch_mode="1"
ynh_app_setting_set --app=$app --key=git_branch_mode --value="$git_branch_mode"
else
ynh_print_err --message="You need to use \"release\" or \"dev\" branch, please handle this in command line"
exit 0
fi
ynh_script_progression "Ensuring downward compatibility..."
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed
if ynh_app_upstream_version_changed
then
ynh_script_progression --message="Upgrading source files..." --weight=1
ynh_script_progression "Upgrading source files..."
# First we save what we need to keep
mv $install_dir/store $data_dir/
mv $install_dir/cache $data_dir/
mv $install_dir/php.log $data_dir/
# Move data to the data_dir if it's still in install_dir
if [ ! -d "$data_dir/store" ]
then
ynh_exec_as_app mv $install_dir/store $data_dir/
ynh_exec_as_app mv $install_dir/cache $data_dir/
fi
# Then we remove the previous install
ynh_secure_remove $install_dir
ynh_safe_rm $install_dir
# We make the install cloning the repo
mkdir -p "$install_dir"
chown -R $app:www-data "$install_dir"
ynh_exec_as $app git clone https://codeberg.org/streams/streams.git "$install_dir" --quiet
git config --system --add safe.directory $install_dir
ynh_app_setting_get --app=$app --key=git_branch_mode
if [[ -n $git_branch_mode ]] && [ "$git_branch_mode" -eq "1" ]
then
ynh_print_info "Switching to \"dev\" branch"
(cd "$install_dir" && ynh_exec_as $app git checkout dev)
fi
ynh_setup_source --dest_dir="$install_dir"
ynh_setup_source --dest_dir="$install_dir/addon" --source_id="addons"
# We restore what we previously saved
mv $data_dir/store $install_dir/
mv $data_dir/cache $install_dir/
mv $data_dir/php.log $install_dir/
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
chmod -R 775 $install_dir/store $install_dir/cache
ynh_exec_as_app ln -s $data_dir/store $install_dir/
ynh_exec_as_app ln -s $data_dir/cache $install_dir/
fi
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
ynh_script_progression "Upgrading PHP-FPM configuration..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
ynh_config_add_phpfpm
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_config_add_nginx
#=================================================
# COMPOSER
#=================================================
ynh_script_progression --message="Pulling in external libraries with Composer..."
ynh_script_progression "Pulling in external libraries with Composer..."
ynh_install_composer
chown -R $app:www-data "$install_dir"
ynh_composer_install
ynh_composer_exec install --no-dev
#=================================================
# ADDONS
#=================================================
ynh_script_progression --message="Installing addons..."
pushd $install_dir
ynh_exec_as $app git config pull.rebase false
ynh_exec_as $app util/add_addon_repo https://codeberg.org/streams/streams-addons.git zaddons
cd /var/www/$app/extend/addon/zaddons
ynh_exec_as $app git config pull.rebase false
popd
#=================================================
# SPECIFIC UPGRADE
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1
ynh_script_progression "Updating configuration..."
timezone=$(</etc/timezone)
max_imported_follow=10
ynh_add_config --template="../conf/htconfig.sample.php" --destination="$install_dir/.htconfig.php"
chmod 600 "$install_dir/.htconfig.php"
chown $app:$app "$install_dir/.htconfig.php"
ynh_config_add --template="htconfig.sample.php" --destination="$install_dir/.htconfig.php"
if [ ! -f $data_dir/extra_conf.php ]
then
ynh_exec_as $app touch $data_dir/extra_conf.php
ynh_exec_as_app touch $data_dir/extra_conf.php
fi
#=================================================
# UPGRADE CRON JOB
#=================================================
ynh_script_progression --message="Setuping cron job..." --weight=1
ynh_script_progression "Setuping cron job..."
# Set up cron job
ynh_add_config --template="../conf/cronjobs" --destination="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
# Add daily update script
ynh_add_config --template="../conf/daily-update.sh" --destination="/home/yunohost.app/$app/daily-update.sh"
chown root: "/home/yunohost.app/$app/daily-update.sh"
ynh_config_add --template="cronjobs" --destination="/etc/cron.d/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
ynh_script_progression "Upgrading logrotate configuration..."
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate "$install_dir/php.log"
ynh_config_add_logrotate "/var/log/$app/php.log"
ynh_exec_as_app touch "/var/log/$app/php.log"
# Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="$install_dir/php.log" --failregex="^.*auth\.php.*failed login attempt.*from IP <HOST>.*$" --max_retry="5"
ynh_config_add_fail2ban --logpath="/var/log/$app/php.log" --failregex="^.*auth\.php.*failed login attempt.*from IP <HOST>.*$"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last
ynh_script_progression "Upgrade of $app completed"