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 #25 from YunoHost-Apps/Upgrade

Upgrade
This commit is contained in:
Éric Gaspar 2021-09-06 16:33:36 +02:00 committed by GitHub
commit 3b99a52555
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 238 additions and 174 deletions

View file

@ -1,11 +1,17 @@
# ZAP for YunoHost <!--
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.
-->
[![Integration level](https://dash.yunohost.org/integration/zap.svg)](https://dash.yunohost.org/appci/app/zap) ![](https://ci-apps.yunohost.org/ci/badges/zap.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/zap.maintain.svg) # Zap for YunoHost
[![Integration level](https://dash.yunohost.org/integration/zap.svg)](https://dash.yunohost.org/appci/app/zap) ![](https://ci-apps.yunohost.org/ci/badges/zap.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/zap.maintain.svg)
[![Install Zap with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=zap) [![Install Zap with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=zap)
> _This package allow you to install ZAP quickly and simply on a YunoHost server. *[Lire ce readme en français.](./README_fr.md)*
> If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it._
> *This package allows you to install Zap 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 ## Overview
@ -13,8 +19,6 @@
Compatible with **Mastodon**, **Pleroma**, **Pixelfed**, **Friendica**, **Hubzilla**, **Funkwhale**, **Peertube**, **Plume**, **WriteFreely** and many, many more. Compatible with **Mastodon**, **Pleroma**, **Pixelfed**, **Friendica**, **Hubzilla**, **Funkwhale**, **Peertube**, **Plume**, **WriteFreely** and many, many more.
**Shipped version:** 21.05.21
## Unique Features of ZAP ## Unique Features of ZAP
- **Groups** : public, private, and moderated. - **Groups** : public, private, and moderated.
@ -25,13 +29,12 @@ Compatible with **Mastodon**, **Pleroma**, **Pixelfed**, **Friendica**, **Hubzil
- **Lists**: Sometimes referred to as circles or aspects, this lets you define your own groups of related friends and- communicate with them as a private group. - **Lists**: Sometimes referred to as circles or aspects, this lets you define your own groups of related friends and- communicate with them as a private group.
- **Extend** : Change or upgrade your software functionality as desired by installing additional features from addons and- the free app collection. - **Extend** : Change or upgrade your software functionality as desired by installing additional features from addons and- the free app collection.
## This app claims following features:
- [x] Ldap integration **Shipped version:** 21.10.21~ynh1
- [x] Multi-instance
- [x] Adeed php.log in the root folder for debugging php, with logrotate applied on it (can be accesssed by **admin->logs** and entering the **php.log**).
- [x] Fail2ban
- [x] Option to choose between **Mysql** and **PostgreSQL**. ## Disclaimers / important information
## Installation ## Installation
@ -41,7 +44,7 @@ Before installing, read the [Zap installation instructions](https://codeberg.org
- Zap requires a dedicated domain, so obtain one and add it using the YunoHost admin panel. **Domains -> Add domain**. As Zap uses the full domain and is installed on the root, you can create a subdomain such as Zap.domain.tld. Don't forget to update your DNS if you manage them manually. - Zap requires a dedicated domain, so obtain one and add it using the YunoHost admin panel. **Domains -> Add domain**. As Zap uses the full domain and is installed on the root, you can create a subdomain such as Zap.domain.tld. Don't forget to update your DNS if you manage them manually.
## Ldap Admin user rights, logs and failed database updates ## LDAP Admin user rights, logs and failed database updates
- **For admin rights**: When installation is complete, you will need to visit your new hub's page and login with the **admin account username** which was entered at the time of installation process. You should then be able to create your first channel and have the **admin rights** for the hub. - **For admin rights**: When installation is complete, you will need to visit your new hub's page and login with the **admin account username** which was entered at the time of installation process. You should then be able to create your first channel and have the **admin rights** for the hub.
@ -49,32 +52,26 @@ Before installing, read the [Zap installation instructions](https://codeberg.org
- **Failing to get admin rights :** If the admin cannot access the admin settings at `https://zap.example.com/admin` or you want to grant admin rights to any other user(s) on the hub, then you have to **manually add 4096** to the **account_roles** under **accounts** for that user in the **database through phpMYAdmin**. - **Failing to get admin rights :** If the admin cannot access the admin settings at `https://zap.example.com/admin` or you want to grant admin rights to any other user(s) on the hub, then you have to **manually add 4096** to the **account_roles** under **accounts** for that user in the **database through phpMYAdmin**.
- **For logs :** Go to **admin->logs** and enter the file name **php.log**. - **For logs:** Go to **admin->logs** and enter the file name **php.log**.
- **Failed Database after Upgrade :** Some times databse upgrade fails after version upgrade. You can go to hub eg. `https://zap.example.com/admin/dbsync/` and check the numbers of failled update. These updates will have to be ran manually by **phpMYAdmin**. - **Failed Database after Upgrade:** Some times databse upgrade fails after version upgrade. You can go to hub eg. `https://zap.example.com/admin/dbsync/` and check the numbers of failled update. These updates will have to be ran manually by **phpMYAdmin**.
#### Supported architectures ## Documentation and resources
- x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/Zap%20%28Official%29.svg)](https://ci-apps.yunohost.org/ci/apps/zap/) * Official app website: https://zotlabs.com/zap/
- ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/Zap%20%28Official%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/zap/) * Upstream app code repository: https://codeberg.org/zot/zap
* YunoHost documentation for this app: https://yunohost.org/app_zap
## Links * Report a bug: https://github.com/YunoHost-Apps/zap_ynh/issues
- YunoHost project: https://yunohost.org
- Zap website: https://zotlabs.com/zap/
- Zap code on codeberg: https://codeberg.org/zot/zap
- Zap addons on codeberg: https://codeberg.org/zot/zap-addons
---
## Developer info ## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/zap_ynh/tree/testing). Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/zap_ynh/tree/testing).
To try the testing branch, please proceed like that. To try the testing branch, please proceed like that.
``` ```
sudo yunohost app install https://github.com/YunoHost-Apps/zap_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/zap_ynh/tree/testing --debug
or or
sudo yunohost app upgrade zap -u https://github.com/YunoHost-Apps/zap_ynh/tree/testing --debug sudo yunohost app upgrade zap -u https://github.com/YunoHost-Apps/zap_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

73
README_fr.md Normal file
View file

@ -0,0 +1,73 @@
# Zap pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/zap.svg)](https://dash.yunohost.org/appci/app/zap) ![](https://ci-apps.yunohost.org/ci/badges/zap.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/zap.maintain.svg)
[![Installer Zap avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=zap)
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Zap 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
[Zap](https://zotlabs.com/zap/) is an an ethical alternative to Fediverse that provides powerful features for creating interconnected websites featuring a decentralized identity, communications, and permissions framework built using common webserver technology.
Compatible with **Mastodon**, **Pleroma**, **Pixelfed**, **Friendica**, **Hubzilla**, **Funkwhale**, **Peertube**, **Plume**, **WriteFreely** and many, many more.
## Unique Features of ZAP
- **Groups** : public, private, and moderated.
- **Events** : Calendar and attendance; automatic birthday notifications for friends using this feature.
- **Cloud**storage : Built-in network file storage integrated with social networking access.
- **Editor** : Supports both markdown and bbcode. Use either or both - if you want.
- **Share**: Drag-and-drop a number of different things such as files, photos, webpages, maps, phone numbers to share- them.
- **Lists**: Sometimes referred to as circles or aspects, this lets you define your own groups of related friends and- communicate with them as a private group.
- **Extend** : Change or upgrade your software functionality as desired by installing additional features from addons and- the free app collection.
**Version incluse :** 21.10.21~ynh1
## Avertissements / informations importantes
## Installation
Before installing, read the [Zap installation instructions](https://codeberg.org/zot/zap/src/branch/release/install/INSTALL.txt) for important information about:
### Register a new domain and add it to YunoHost
- Zap requires a dedicated domain, so obtain one and add it using the YunoHost admin panel. **Domains -> Add domain**. As Zap uses the full domain and is installed on the root, you can create a subdomain such as Zap.domain.tld. Don't forget to update your DNS if you manage them manually.
## LDAP Admin user rights, logs and failed database updates
- **For admin rights**: When installation is complete, you will need to visit your new hub's page and login with the **admin account username** which was entered at the time of installation process. You should then be able to create your first channel and have the **admin rights** for the hub.
- **For normal YunoHost users :** Normal LDAP users can login through Ldap authentication and create there channels.
- **Failing to get admin rights :** If the admin cannot access the admin settings at `https://zap.example.com/admin` or you want to grant admin rights to any other user(s) on the hub, then you have to **manually add 4096** to the **account_roles** under **accounts** for that user in the **database through phpMYAdmin**.
- **For logs:** Go to **admin->logs** and enter the file name **php.log**.
- **Failed Database after Upgrade:** Some times databse upgrade fails after version upgrade. You can go to hub eg. `https://zap.example.com/admin/dbsync/` and check the numbers of failled update. These updates will have to be ran manually by **phpMYAdmin**.
## Documentations et ressources
* Site officiel de l'app : https://zotlabs.com/zap/
* Dépôt de code officiel de l'app : https://codeberg.org/zot/zap
* Documentation YunoHost pour cette app : https://yunohost.org/app_zap
* Signaler un bug : https://github.com/YunoHost-Apps/zap_ynh/issues
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/zap_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/zap_ynh/tree/testing --debug
ou
sudo yunohost app upgrade zap -u https://github.com/YunoHost-Apps/zap_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

View file

@ -1,8 +1,3 @@
# See here for more information
# https://github.com/YunoHost/package_check#syntax-check_process-file
# Move this file from check_process.default to check_process when you have filled it.
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" domain="domain.tld"
@ -20,7 +15,6 @@
upgrade=1 from_commit=c8575c645eb5802cd99cf63dfede2ddba124582b upgrade=1 from_commit=c8575c645eb5802cd99cf63dfede2ddba124582b
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=0
change_url=0 change_url=0
;;; Options ;;; Options
Email= Email=

View file

@ -1,5 +1,6 @@
SOURCE_URL=https://codeberg.org/zot/zap/archive/7d77d277d90dbb0b99c3680d1dc956323120e0d5.tar.gz SOURCE_URL=https://codeberg.org/zot/zap/archive/8f08b200fd6c410c88a3f24248da55185721ccf1.tar.gz
SOURCE_SUM=0e3e932514c877aad5a2bbc31703143c0df22d097a01a952505bbbca3976fd50 SOURCE_SUM=82eab96306b2c4fb1d2dfcded5ccbc9adfc0f3f82695bd2459aff9b35e71ff21
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR= SOURCE_IN_SUBDIR=
SOURCE_FILENAME= SOURCE_FILENAME=

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://codeberg.org/zot/zap-addons/archive/096e7619f091652b3abdabd6f85141fb49c3f268.tar.gz SOURCE_URL=https://codeberg.org/zot/zap-addons/archive/b2ddcc67735fb413f14efcc9c49780469b8b61cf.tar.gz
SOURCE_SUM=1c8c205f2811fed809bce71a97fdd8723096030473be1162766d8772c56f1511 SOURCE_SUM=009f5047096fdbe3becaebfb7ac3ee34d7efd3f4f891e3a645484a7e406598a1
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR= SOURCE_IN_SUBDIR=

View file

@ -1,16 +1,14 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ { location __PATH__/ {
alias __FINALPATH__/;
# Force https
if ($scheme = http)
{ alias __FINALPATH__/;
# Force https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent; rewrite ^ https://$server_name$request_uri? permanent;
} }
if (!-e $request_filename) if (!-e $request_filename) {
{
rewrite ^(.*)$ /index.php?req=$1; rewrite ^(.*)$ /index.php?req=$1;
} }
@ -21,24 +19,19 @@ location __PATH__/ {
index index.php; index index.php;
charset utf-8; charset utf-8;
location ~* \.php$ {
# Example PHP configuration try_files $uri =404;
location ~* \.php$ fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
{ fastcgi_index index.php;
try_files $uri =404; include fastcgi_params;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
} }
# make sure webfinger and other well known services aren't blocked # make sure webfinger and other well known services aren't blocked
# by denying dot files and rewrite request to the front controller # by denying dot files and rewrite request to the front controller
location ^~ /.well-known/ location ^~ /.well-known/ {
{
allow all; allow all;
if (!-e $request_filename) if (!-e $request_filename) {
{
rewrite ^(.*)$ /index.php?req=$1; rewrite ^(.*)$ /index.php?req=$1;
} }
} }
@ -53,20 +46,17 @@ location __PATH__/ {
# } # }
# block these file types # block these file types
location ~* \.(tpl|md|tgz|log|out)$ location ~* \.(tpl|md|tgz|log|out)$ {
{
deny all; deny all;
} }
# deny access to all dot files # deny access to all dot files
location ~ /\. location ~ /\. {
{
deny all; deny all;
} }
#deny access to store #deny access to store
location ~ /store location ~ /store {
{
deny all; deny all;
} }

View file

@ -1,2 +1,2 @@
# Run poller periodically to update Hubzilla # Run poller periodically to update Hubzilla
*/10 * * * * __USER__ cd YNH_WWW_PATH; /usr/bin/php__PHP_VERSION__ Zotlabs/Daemon/Master.php Cron > /dev/null 2>&1 */10 * * * * __APP__ cd __FINALPATH__; /usr/bin/php__PHPVERSION__ Zotlabs/Daemon/Master.php Cron > /dev/null 2>&1

13
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1,13 @@
[Zap](https://zotlabs.com/zap/) is an an ethical alternative to Fediverse that provides powerful features for creating interconnected websites featuring a decentralized identity, communications, and permissions framework built using common webserver technology.
Compatible with **Mastodon**, **Pleroma**, **Pixelfed**, **Friendica**, **Hubzilla**, **Funkwhale**, **Peertube**, **Plume**, **WriteFreely** and many, many more.
## Unique Features of ZAP
- **Groups** : public, private, and moderated.
- **Events** : Calendar and attendance; automatic birthday notifications for friends using this feature.
- **Cloud**storage : Built-in network file storage integrated with social networking access.
- **Editor** : Supports both markdown and bbcode. Use either or both - if you want.
- **Share**: Drag-and-drop a number of different things such as files, photos, webpages, maps, phone numbers to share- them.
- **Lists**: Sometimes referred to as circles or aspects, this lets you define your own groups of related friends and- communicate with them as a private group.
- **Extend** : Change or upgrade your software functionality as desired by installing additional features from addons and- the free app collection.

19
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,19 @@
## Installation
Before installing, read the [Zap installation instructions](https://codeberg.org/zot/zap/src/branch/release/install/INSTALL.txt) for important information about:
### Register a new domain and add it to YunoHost
- Zap requires a dedicated domain, so obtain one and add it using the YunoHost admin panel. **Domains -> Add domain**. As Zap uses the full domain and is installed on the root, you can create a subdomain such as Zap.domain.tld. Don't forget to update your DNS if you manage them manually.
## LDAP Admin user rights, logs and failed database updates
- **For admin rights**: When installation is complete, you will need to visit your new hub's page and login with the **admin account username** which was entered at the time of installation process. You should then be able to create your first channel and have the **admin rights** for the hub.
- **For normal YunoHost users :** Normal LDAP users can login through Ldap authentication and create there channels.
- **Failing to get admin rights :** If the admin cannot access the admin settings at `https://zap.example.com/admin` or you want to grant admin rights to any other user(s) on the hub, then you have to **manually add 4096** to the **account_roles** under **accounts** for that user in the **database through phpMYAdmin**.
- **For logs:** Go to **admin->logs** and enter the file name **php.log**.
- **Failed Database after Upgrade:** Some times databse upgrade fails after version upgrade. You can go to hub eg. `https://zap.example.com/admin/dbsync/` and check the numbers of failled update. These updates will have to be ran manually by **phpMYAdmin**.

View file

@ -3,21 +3,27 @@
"id": "zap", "id": "zap",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "A fediverse server." "en": "Ethical fediverse server alternative",
"fr": "serveur fedverse éthique"
}, },
"version": "21.05.21~ynh1", "version": "21.10.21~ynh1",
"url": "https://zotlabs.com/zap/", "url": "https://zotlabs.com/zap/",
"upstream": {
"license": "MIT",
"website": "https://zotlabs.com/zap/",
"code": "https://codeberg.org/zot/zap"
},
"license": "MIT", "license": "MIT",
"maintainer": { "maintainer": {
"name": "" "name": ""
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.1.0" "yunohost": ">= 4.2.4"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
"nginx", "nginx",
"php7.0-fpm", "php7.3-fpm",
"mysql", "mysql",
"postgresql" "postgresql"
], ],
@ -26,6 +32,8 @@
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain",
"example": "/example",
"default": "/example",
"help": { "help": {
"en": "ZAP must run in the root of this domain. It means no other app can be accessed/run from this domain. We advise to use a dedicated subdomain such as zap.domain.tld", "en": "ZAP must run in the root of this domain. It means no other app can be accessed/run from this domain. We advise to use a dedicated subdomain such as zap.domain.tld",
"fr": "ZAP doit être installé à la racine du domaine. Cela implique qu'aucune autre app ne pourra être installée ou accessible sur ce domain. Nous conseillons un sous-domaine dédié par exemple zap.domain.tld." "fr": "ZAP doit être installé à la racine du domaine. Cela implique qu'aucune autre app ne pourra être installée ou accessible sur ce domain. Nous conseillons un sous-domaine dédié par exemple zap.domain.tld."
@ -33,7 +41,8 @@
}, },
{ {
"name": "admin", "name": "admin",
"type": "user" "type": "user",
"example": "johndoe"
}, },
{ {
"name": "database", "name": "database",

View file

@ -23,6 +23,7 @@ ynh_abort_if_errors
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info --message="Loading installation settings..." ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME 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)
@ -67,8 +68,6 @@ elif [ $database -eq 2 ]; then
ynh_psql_dump_db --database="$db_name" > db.sql ynh_psql_dump_db --database="$db_name" > db.sql
fi fi
#=================================================
# SPECIFIC BACKUP
#================================================= #=================================================
# BACKUP LOGROTATE # BACKUP LOGROTATE
#================================================= #=================================================

View file

@ -13,10 +13,6 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
@ -27,10 +23,10 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url="/" path_url="/"
admin=$YNH_APP_ARG_ADMIN admin=$YNH_APP_ARG_ADMIN
email=$(yunohost user info $admin | grep "mail:" | cut -d' ' -f2) email=$(ynh_user_get_info --username=$admin --key=mail)
upload="256M" upload="256M"
database="1" database="1"
random_string="$(ynh_string_random)$(ynh_string_random)$(ynh_string_random)" random_string=$(ynh_string_random --length=48)
database=`expr $YNH_APP_ARG_DATABASE` database=`expr $YNH_APP_ARG_DATABASE`
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -51,11 +47,11 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#================================================= #=================================================
ynh_print_info "Storing installation settings..." ynh_print_info "Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=email --value=$email 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=upload --value=$upload
ynh_app_setting_set --app=$app --key=database --value=$database ynh_app_setting_set --app=$app --key=database --value=$database
ynh_app_setting_set --app=$app --key=random_string --value=$random_string ynh_app_setting_set --app=$app --key=random_string --value=$random_string
@ -70,6 +66,14 @@ if [ $database -eq 2 ]; then
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
fi fi
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -79,19 +83,18 @@ ynh_script_progression --message="Setting up Zap source files..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
git clone https://codeberg.org/zot/zap.git "$final_path" git clone https://codeberg.org/zot/zap.git "$final_path" --quiet
# 2 - Zap Addons # 2 - Zap Addons
# Make addon Directory and unpack the addons to this directory # Make addon Directory and unpack the addons to this directory
ynh_script_progression --message="Create addon directory inside root folder..."
ynh_script_progression --message="Setting up Zap addons source files..." ynh_script_progression --message="Setting up Zap addons source files..."
pushd "$final_path" pushd "$final_path"
mkdir -p extend/addon/zaddons mkdir -p extend/addon/zaddons
mkdir addon mkdir addon
git clone https://codeberg.org/zot/zap-addons.git $final_path/extend/addon/zaddons git clone https://codeberg.org/zot/zap-addons.git $final_path/extend/addon/zaddons --quiet
filelist=(`ls extend/addon/zaddons`) filelist=(`ls extend/addon/zaddons`)
cd addon cd addon
for a in "${filelist[@]}" ; do for a in "${filelist[@]}" ; do
@ -134,6 +137,10 @@ config="$final_path/.htconfig.php"
ynh_print_info "Create php.log for the debuging..." ynh_print_info "Create php.log for the debuging..."
touch "$final_path/php.log" touch "$final_path/php.log"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# CREATE A DATABASE # CREATE A DATABASE
#================================================= #=================================================
@ -192,14 +199,6 @@ ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
@ -208,23 +207,14 @@ ynh_script_progression --message="Configuring PHP-FPM..."
# Create a dedicated php-fpm config # Create a dedicated php-fpm config
ynh_add_fpm_config --package="$extra_php_dependencies" ynh_add_fpm_config --package="$extra_php_dependencies"
# Set right permissions for Zap #=================================================
ynh_script_progression --message="Set right for Zap..." # CRON JOB CONFIGURATION
chown -R $app: $final_path #=================================================
# Set up cron job
ynh_script_progression --message="Setting up cron job..." ynh_script_progression --message="Setting up cron job..."
ynh_replace_string --match_string="YNH_WWW_PATH" --replace_string="$final_path" --target_file="../conf/poller-cron"
ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="../conf/poller-cron"
ynh_replace_string --match_string="__PHP_VERSION__" --replace_string="$phpversion" --target_file="../conf/poller-cron"
cp ../conf/poller-cron /etc/cron.d/$app
#================================================= ynh_add_config --template="../conf/poller-cron" --destination="/etc/cron.d/$app"
# STORE THE CONFIG FILE CHECKSUM chown root: "/etc/cron.d/$app"
#================================================= chmod 644 "/etc/cron.d/$app"
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$config"
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
@ -244,10 +234,9 @@ ynh_add_fail2ban_config --logpath="$final_path/php.log" --failregex="^.*auth\.ph
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring SSOwat..." ynh_script_progression --message="Configuring permissions..."
ynh_permission_update --permission="main" --add="visitors"
# As Zap is social network and have its own permission there is no need to keep Zap behind SSO
ynh_permission_update --permission="main" --add="visitors"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX

View file

@ -14,10 +14,6 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () {
#### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
@ -42,8 +38,6 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." ynh_script_progression --message="Validating restoration parameters..."
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \ test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path " || ynh_die --message="There is already a directory: $final_path "
@ -55,6 +49,14 @@ test ! -d $final_path \
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"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_print_info "Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
@ -62,6 +64,10 @@ ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================
@ -84,26 +90,15 @@ elif [ $database -eq 2 ]; then
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name" ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
fi fi
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_print_info "Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create $app
#================================================= #=================================================
# RESTORE THE PHP-FPM CONFIGURATION # RESTORE THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restoring PHP-FPM configuration..." ynh_script_progression --message="Restoring PHP-FPM configuration..."
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config # Recreate a dedicated php-fpm config
ynh_add_fpm_config --package="$extra_php_dependencies" ynh_add_fpm_config --package="$extra_php_dependencies"
#=================================================
# SPECIFIC RESTORATION
#================================================= #=================================================
# RESTORE THE CRON FILE # RESTORE THE CRON FILE
#================================================= #=================================================

View file

@ -52,27 +52,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# Migrate legacy permissions to new system # Migrate legacy permissions to new system
#================================================= #=================================================
if ynh_legacy_permissions_exists ynh_script_progression --message="Ensuring downward compatibility..."
then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Upgrading source files..."
# Create a temporary directory
# Remove the app directory securely
# ynh_secure_remove "$final_path"
# If final_path doesn't exist, create it # If final_path doesn't exist, create it
if [ -z "$final_path" ]; then if [ -z "$final_path" ]; then
@ -80,11 +60,21 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi fi
if ynh_legacy_permissions_exists
then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#================================================= #=================================================
# STANDARD UPGRADE STEPS # CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -95,9 +85,9 @@ ynh_script_progression --message="Upgrading source files..."
if [ `cd $final_path && git rev-parse --is-inside-work-tree` ]; then if [ `cd $final_path && git rev-parse --is-inside-work-tree` ]; then
pushd "$final_path" pushd "$final_path"
git pull git pull --quiet
cd extend/addon/zaddons cd extend/addon/zaddons
git pull git pull --quiet
cd ../../.. cd ../../..
filelist=(`ls extend/addon/zaddons`) filelist=(`ls extend/addon/zaddons`)
cd addon cd addon
@ -152,9 +142,12 @@ else
chmod -R 777 $final_path/store chmod -R 777 $final_path/store
mkdir $final_path/addon mkdir $final_path/addon
ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons" ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons"
fi fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -163,17 +156,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
# Set right permissions for curl install
chown -R $app: $final_path
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
@ -196,18 +178,21 @@ ynh_script_progression --message="Upgrading logrotate configuration..."
# Use logrotate to manage app-specific logfile(s) # Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append ynh_use_logrotate --non-append
#=================================================
# UPGRADE FAIL2BAN # UPGRADE FAIL2BAN
#================================================= #=================================================
ynh_script_progression --message="Re-configure fail2ban..." ynh_script_progression --message="Re-configure Fail2Ban..."
ynh_add_fail2ban_config --logpath="$final_path/php.log" --failregex="^.*auth\.php.*failed login attempt.*from IP <HOST>.*$" --max_retry="5" ynh_add_fail2ban_config --logpath="$final_path/php.log" --failregex="^.*auth\.php.*failed login attempt.*from IP <HOST>.*$" --max_retry="5"
# Set cron job #=================================================
ynh_print_info "Setting up cron job..." # UPGRADE CRON
ynh_replace_string --match_string="YNH_WWW_PATH" --replace_string="$final_path" --target_file="../conf/poller-cron" #=================================================
ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="../conf/poller-cron" ynh_script_progression --message="Setting up cron job..."
ynh_replace_string --match_string="__PHP_VERSION__" --replace_string="$phpversion" --target_file="../conf/poller-cron"
cp -f ../conf/poller-cron /etc/cron.d/$app ynh_add_config --template="../conf/poller-cron" --destination="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
@ -221,7 +206,7 @@ fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload