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

Merge pull request #461 from YunoHost-Apps/testing

Testing
This commit is contained in:
Josue-T 2024-05-17 08:18:22 +02:00 committed by GitHub
commit 02268cce8b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 150 additions and 98 deletions

View file

@ -1,6 +1,7 @@
# All available README files by language # All available README files by language
- [Read the README in English](README.md) - [Read the README in English](README.md)
- [Lee el README en español](README_es.md)
- [Irakurri README euskaraz](README_eu.md) - [Irakurri README euskaraz](README_eu.md)
- [Lire le README en français](README_fr.md) - [Lire le README en français](README_fr.md)
- [Le o README en galego](README_gl.md) - [Le o README en galego](README_gl.md)

View file

@ -21,7 +21,7 @@ Instant messaging server matrix network.
Yunohost chatroom with matrix : [https://matrix.to/#/#yunohost:matrix.org](https://matrix.to/#/#yunohost:matrix.org) Yunohost chatroom with matrix : [https://matrix.to/#/#yunohost:matrix.org](https://matrix.to/#/#yunohost:matrix.org)
**Shipped version:** 1.105.1~ynh1 **Shipped version:** 1.107.0~ynh1
## Documentation and resources ## Documentation and resources
- Official app website: <https://matrix.org/> - Official app website: <https://matrix.org/>

45
README_es.md Normal file
View file

@ -0,0 +1,45 @@
<!--
Este archivo README esta generado automaticamente<https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
No se debe editar a mano.
-->
# Synapse para Yunohost
[![Nivel de integración](https://dash.yunohost.org/integration/synapse.svg)](https://dash.yunohost.org/appci/app/synapse) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/synapse.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/synapse.maintain.svg)
[![Instalar Synapse con Yunhost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=synapse)
*[Leer este README en otros idiomas.](./ALL_README.md)*
> *Este paquete le permite instalarSynapse rapidamente y simplement en un servidor YunoHost.*
> *Si no tiene YunoHost, visita [the guide](https://yunohost.org/install) para aprender como instalarla.*
## Descripción general
Instant messaging server matrix network.
Yunohost chatroom with matrix : [https://matrix.to/#/#yunohost:matrix.org](https://matrix.to/#/#yunohost:matrix.org)
**Versión actual:** 1.107.0~ynh1
## Documentaciones y recursos
- Sitio web oficial: <https://matrix.org/>
- Documentación administrador oficial: <https://matrix-org.github.io/synapse/latest/welcome_and_overview.html>
- Repositorio del código fuente oficial de la aplicación : <https://github.com/element-hq/synapse>
- Catálogo YunoHost: <https://apps.yunohost.org/app/synapse>
- Reportar un error: <https://github.com/YunoHost-Apps/synapse_ynh/issues>
## Información para desarrolladores
Por favor enviar sus correcciones a la [`branch testing`](https://github.com/YunoHost-Apps/synapse_ynh/tree/testing
Para probar la rama `testing`, sigue asÍ:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/synapse_ynh/tree/testing --debug
o
sudo yunohost app upgrade synapse -u https://github.com/YunoHost-Apps/synapse_ynh/tree/testing --debug
```
**Mas informaciones sobre el empaquetado de aplicaciones:** <https://yunohost.org/packaging_apps>

View file

@ -21,7 +21,7 @@ Instant messaging server matrix network.
Yunohost chatroom with matrix : [https://matrix.to/#/#yunohost:matrix.org](https://matrix.to/#/#yunohost:matrix.org) Yunohost chatroom with matrix : [https://matrix.to/#/#yunohost:matrix.org](https://matrix.to/#/#yunohost:matrix.org)
**Paketatutako bertsioa:** 1.105.1~ynh1 **Paketatutako bertsioa:** 1.107.0~ynh1
## Dokumentazioa eta baliabideak ## Dokumentazioa eta baliabideak
- Aplikazioaren webgune ofiziala: <https://matrix.org/> - Aplikazioaren webgune ofiziala: <https://matrix.org/>

View file

@ -21,7 +21,7 @@ Instant messaging server matrix network.
Yunohost chatroom with matrix : [https://matrix.to/#/#yunohost:matrix.org](https://matrix.to/#/#yunohost:matrix.org) Yunohost chatroom with matrix : [https://matrix.to/#/#yunohost:matrix.org](https://matrix.to/#/#yunohost:matrix.org)
**Version incluse:** 1.105.1~ynh1 **Version incluse:** 1.107.0~ynh1
## Documentations et ressources ## Documentations et ressources
- Site officiel de lapp: <https://matrix.org/> - Site officiel de lapp: <https://matrix.org/>

View file

@ -21,7 +21,7 @@ Instant messaging server matrix network.
Yunohost chatroom with matrix : [https://matrix.to/#/#yunohost:matrix.org](https://matrix.to/#/#yunohost:matrix.org) Yunohost chatroom with matrix : [https://matrix.to/#/#yunohost:matrix.org](https://matrix.to/#/#yunohost:matrix.org)
**Versión proporcionada:** 1.105.1~ynh1 **Versión proporcionada:** 1.107.0~ynh1
## Documentación e recursos ## Documentación e recursos
- Web oficial da app: <https://matrix.org/> - Web oficial da app: <https://matrix.org/>

View file

@ -3,7 +3,7 @@
请勿手动编辑。 请勿手动编辑。
--> -->
# YunoHost 的 Synapse # YunoHost 的 Synapse
[![集成程度](https://dash.yunohost.org/integration/synapse.svg)](https://dash.yunohost.org/appci/app/synapse) ![工作状态](https://ci-apps.yunohost.org/ci/badges/synapse.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/synapse.maintain.svg) [![集成程度](https://dash.yunohost.org/integration/synapse.svg)](https://dash.yunohost.org/appci/app/synapse) ![工作状态](https://ci-apps.yunohost.org/ci/badges/synapse.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/synapse.maintain.svg)
@ -21,7 +21,7 @@ Instant messaging server matrix network.
Yunohost chatroom with matrix : [https://matrix.to/#/#yunohost:matrix.org](https://matrix.to/#/#yunohost:matrix.org) Yunohost chatroom with matrix : [https://matrix.to/#/#yunohost:matrix.org](https://matrix.to/#/#yunohost:matrix.org)
**分发版本:** 1.105.1~ynh1 **分发版本:** 1.107.0~ynh1
## 文档与资源 ## 文档与资源
- 官方应用网站: <https://matrix.org/> - 官方应用网站: <https://matrix.org/>

View file

@ -1,33 +1,33 @@
annotated-types==0.6.0 annotated-types==0.6.0
attrs==23.2.0 attrs==23.2.0
Automat==22.10.0 Automat==22.10.0
bcrypt==4.1.2 bcrypt==4.1.3
bleach==6.1.0 bleach==6.1.0
canonicaljson==2.0.0 canonicaljson==2.0.0
certifi==2024.2.2 certifi==2024.2.2
cffi==1.16.0 cffi==1.16.0
charset-normalizer==3.3.2 charset-normalizer==3.3.2
constantly==23.10.4 constantly==23.10.4
cryptography==42.0.5 cryptography==42.0.7
hyperlink==21.0.0 hyperlink==21.0.0
idna==3.7 idna==3.7
ijson==3.2.3 ijson==3.2.3
immutabledict==4.2.0 immutabledict==4.2.0
incremental==22.10.0 incremental==22.10.0
Jinja2==3.1.3 Jinja2==3.1.4
jsonschema==4.21.1 jsonschema==4.22.0
jsonschema-specifications==2023.12.1 jsonschema-specifications==2023.12.1
ldap3==2.9.1 ldap3==2.9.1
lxml==5.2.1 lxml==5.2.2
MarkupSafe==2.1.5 MarkupSafe==2.1.5
matrix-common==1.3.0 matrix-common==1.3.0
matrix-synapse==1.105.1 matrix-synapse==1.107.0
matrix-synapse-ldap3==0.3.0 matrix-synapse-ldap3==0.3.0
msgpack==1.0.8 msgpack==1.0.8
ndg-httpsclient==0.5.1 ndg-httpsclient==0.5.1
netaddr==1.2.1 netaddr==1.2.1
packaging==24.0 packaging==24.0
phonenumbers==8.13.35 phonenumbers==8.13.36
pillow==10.3.0 pillow==10.3.0
prometheus_client==0.20.0 prometheus_client==0.20.0
psycopg2==2.9.9 psycopg2==2.9.9
@ -40,9 +40,9 @@ pymacaroons==0.13.0
PyNaCl==1.5.0 PyNaCl==1.5.0
pyOpenSSL==24.1.0 pyOpenSSL==24.1.0
PyYAML==6.0.1 PyYAML==6.0.1
referencing==0.34.0 referencing==0.35.1
requests==2.31.0 requests==2.31.0
rpds-py==0.18.0 rpds-py==0.18.1
semantic-version==2.10.0 semantic-version==2.10.0
service-identity==24.1.0 service-identity==24.1.0
setuptools-rust==1.9.0 setuptools-rust==1.9.0

View file

@ -1,33 +1,33 @@
annotated-types==0.6.0 annotated-types==0.6.0
attrs==23.2.0 attrs==23.2.0
Automat==22.10.0 Automat==22.10.0
bcrypt==4.1.2 bcrypt==4.1.3
bleach==6.1.0 bleach==6.1.0
canonicaljson==2.0.0 canonicaljson==2.0.0
certifi==2024.2.2 certifi==2024.2.2
cffi==1.16.0 cffi==1.16.0
charset-normalizer==3.3.2 charset-normalizer==3.3.2
constantly==23.10.4 constantly==23.10.4
cryptography==42.0.5 cryptography==42.0.7
hyperlink==21.0.0 hyperlink==21.0.0
idna==3.7 idna==3.7
ijson==3.2.3 ijson==3.2.3
immutabledict==4.2.0 immutabledict==4.2.0
incremental==22.10.0 incremental==22.10.0
Jinja2==3.1.3 Jinja2==3.1.4
jsonschema==4.21.1 jsonschema==4.22.0
jsonschema-specifications==2023.12.1 jsonschema-specifications==2023.12.1
ldap3==2.9.1 ldap3==2.9.1
lxml==5.2.1 lxml==5.2.2
MarkupSafe==2.1.5 MarkupSafe==2.1.5
matrix-common==1.3.0 matrix-common==1.3.0
matrix-synapse==1.105.1 matrix-synapse==1.107.0
matrix-synapse-ldap3==0.3.0 matrix-synapse-ldap3==0.3.0
msgpack==1.0.8 msgpack==1.0.8
ndg-httpsclient==0.5.1 ndg-httpsclient==0.5.1
netaddr==1.2.1 netaddr==1.2.1
packaging==24.0 packaging==24.0
phonenumbers==8.13.35 phonenumbers==8.13.36
pillow==10.3.0 pillow==10.3.0
prometheus_client==0.20.0 prometheus_client==0.20.0
psycopg2==2.9.9 psycopg2==2.9.9
@ -40,9 +40,9 @@ pymacaroons==0.13.0
PyNaCl==1.5.0 PyNaCl==1.5.0
pyOpenSSL==24.1.0 pyOpenSSL==24.1.0
PyYAML==6.0.1 PyYAML==6.0.1
referencing==0.34.0 referencing==0.35.1
requests==2.31.0 requests==2.31.0
rpds-py==0.18.0 rpds-py==0.18.1
semantic-version==2.10.0 semantic-version==2.10.0
service-identity==24.1.0 service-identity==24.1.0
setuptools-rust==1.9.0 setuptools-rust==1.9.0

View file

@ -5,7 +5,7 @@ name = "Synapse"
description.en = "Instant messaging server which uses Matrix" description.en = "Instant messaging server which uses Matrix"
description.fr = "Serveur de messagerie instantané basé sur Matrix" description.fr = "Serveur de messagerie instantané basé sur Matrix"
version = "1.105.1~ynh1" version = "1.107.0~ynh1"
maintainers = ["Josué Tille"] maintainers = ["Josué Tille"]
@ -63,13 +63,13 @@ ram.runtime = "1G"
[resources] [resources]
[resources.sources.synapse_prebuilt_armv7_bookworm] [resources.sources.synapse_prebuilt_armv7_bookworm]
prefetch = false prefetch = false
armhf.url = "https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.105.1/matrix-synapse_1.105.1-bookworm-bin1_armv7l.tar.gz" armhf.url = "https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.107.0/matrix-synapse_1.107.0-bookworm-bin1_armv7l.tar.gz"
armhf.sha256 = "39beb845db95880fe561f14d936c4d22b8d50eac005c4b3ad0489c517df461da" armhf.sha256 = "568ed915a0ea9984e9163c74457c3c5263af08b93dbef74dd177f53aabf60538"
[resources.sources.synapse_prebuilt_armv7_bullseye] [resources.sources.synapse_prebuilt_armv7_bullseye]
prefetch = false prefetch = false
armhf.url = "https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.105.1/matrix-synapse_1.105.1-bullseye-bin1_armv7l.tar.gz" armhf.url = "https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.107.0/matrix-synapse_1.107.0-bullseye-bin1_armv7l.tar.gz"
armhf.sha256 = "7eb2d8e870c0e58641e6790ab680ffed327a88dec1d3235bb86b8f19ad044fbe" armhf.sha256 = "587118c7040ab64e4f4a85a014da89cd6b6b7258c3062a9abbd900b1a48e82d9"
[resources.system_user] [resources.system_user]
allow_email = true allow_email = true

View file

@ -6,51 +6,51 @@ install_sources() {
# Install/upgrade synapse in virtualenv # Install/upgrade synapse in virtualenv
# Clean venv is it was on python2.7 or python3 with old version in case major upgrade of debian # Clean venv is it was on python2.7 or python3 with old version in case major upgrade of debian
if [ ! -e $code_dir/bin/python3 ] || [ ! -e $code_dir/lib/python$python_version ]; then if [ ! -e "$code_dir"/bin/python3 ] || [ ! -e "$code_dir/lib/python$python_version" ]; then
ynh_secure_remove --file=$code_dir/bin ynh_secure_remove --file="$code_dir"/bin
ynh_secure_remove --file=$code_dir/lib ynh_secure_remove --file="$code_dir"/lib
ynh_secure_remove --file=$code_dir/lib64 ynh_secure_remove --file="$code_dir"/lib64
ynh_secure_remove --file=$code_dir/include ynh_secure_remove --file="$code_dir"/include
ynh_secure_remove --file=$code_dir/share ynh_secure_remove --file="$code_dir"/share
ynh_secure_remove --file=$code_dir/pyvenv.cfg ynh_secure_remove --file="$code_dir"/pyvenv.cfg
fi fi
mkdir -p $code_dir mkdir -p "$code_dir"
chown $app:root -R $code_dir chown "$app":root -R "$code_dir"
if [ -n "$(uname -m | grep arm)" ] if [ -n "$(uname -m | grep arm)" ]
then then
# Clean old file, sometimes it could make some big issues if we don't do this!! # Clean old file, sometimes it could make some big issues if we don't do this!!
ynh_secure_remove --file=$code_dir/bin ynh_secure_remove --file="$code_dir"/bin
ynh_secure_remove --file=$code_dir/lib ynh_secure_remove --file="$code_dir"/lib
ynh_secure_remove --file=$code_dir/include ynh_secure_remove --file="$code_dir"/include
ynh_secure_remove --file=$code_dir/share ynh_secure_remove --file="$code_dir"/share
ynh_setup_source --dest_dir=$code_dir/ --source_id="synapse_prebuilt_armv7_$(lsb_release --codename --short)" ynh_setup_source --dest_dir="$code_dir"/ --source_id="synapse_prebuilt_armv7_$(lsb_release --codename --short)"
# Fix multi-instance support # Fix multi-instance support
for f in $(ls $code_dir/bin); do for f in "$code_dir"/bin/*; do
if ! [[ $f =~ "__" ]]; then if ! [[ $f =~ "__" ]]; then
ynh_replace_special_string --match_string='#!/opt/yunohost/matrix-synapse' --replace_string='#!'$code_dir --target_file=$code_dir/bin/$f ynh_replace_special_string --match_string='#!/opt/yunohost/matrix-synapse' --replace_string='#!'"$code_dir" --target_file="$f"
fi fi
done done
else else
# Install virtualenv if it don't exist # Install virtualenv if it don't exist
test -e $code_dir/bin/python3 || python3 -m venv $code_dir test -e "$code_dir"/bin/python3 || python3 -m venv "$code_dir"
# Install synapse in virtualenv # Install synapse in virtualenv
local pip3=$code_dir/bin/pip3 local pip3="$code_dir"/bin/pip3
$pip3 install --upgrade setuptools wheel pip cffi $pip3 install --upgrade setuptools wheel pip cffi
$pip3 install --upgrade -r $YNH_APP_BASEDIR/conf/requirement_$(lsb_release --codename --short).txt $pip3 install --upgrade -r "$YNH_APP_BASEDIR/conf/requirement_$(lsb_release --codename --short).txt"
fi fi
# Apply patch for LDAP auth if needed # Apply patch for LDAP auth if needed
# Note that we put patch into scripts dir because /source are not stored and can't be used on restore # Note that we put patch into scripts dir because /source are not stored and can't be used on restore
if ! grep -F -q '# LDAP Filter anonymous user Applied' $code_dir/lib/python$python_version/site-packages/ldap_auth_provider.py; then if ! grep -F -q '# LDAP Filter anonymous user Applied' "$code_dir/lib/python$python_version/site-packages/ldap_auth_provider.py"; then
pushd $code_dir/lib/python$python_version/site-packages pushd "$code_dir/lib/python$python_version/site-packages"
patch < $YNH_APP_BASEDIR/scripts/patch/ldap_auth_filter_anonymous_user.patch patch < "$YNH_APP_BASEDIR"/scripts/patch/ldap_auth_filter_anonymous_user.patch
popd popd
fi fi
} }
@ -58,8 +58,10 @@ install_sources() {
configure_coturn() { configure_coturn() {
# Get public IP and set as external IP for coturn # Get public IP and set as external IP for coturn
# note : '|| true' is used to ignore the errors if we can't get the public ipv4 or ipv6 # note : '|| true' is used to ignore the errors if we can't get the public ipv4 or ipv6
local public_ip4="$(curl -s ip.yunohost.org)" || true local public_ip4
local public_ip6="$(curl -s ipv6.yunohost.org)" || true local public_ip6
public_ip4="$(curl -s ip.yunohost.org)" || true
public_ip6="$(curl -s ipv6.yunohost.org)" || true
local turn_external_ip="" local turn_external_ip=""
if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4" if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4"
@ -80,7 +82,7 @@ configure_nginx() {
if yunohost --output-as plain domain list | grep -q "^$server_name$" if yunohost --output-as plain domain list | grep -q "^$server_name$"
then then
local e2e_enabled_by_default_client_config local e2e_enabled_by_default_client_config
if [ $e2e_enabled_by_default == "off" ]; then if [ "$e2e_enabled_by_default" == "off" ]; then
e2e_enabled_by_default_client_config=false e2e_enabled_by_default_client_config=false
else else
e2e_enabled_by_default_client_config=true e2e_enabled_by_default_client_config=true
@ -113,8 +115,8 @@ ensure_vars_set() {
element_instance=element element_instance=element
if yunohost --output-as plain app list | grep -q "^$element_instance"'$'; then if yunohost --output-as plain app list | grep -q "^$element_instance"'$'; then
element_domain=$(ynh_app_setting_get --app $element_instance --key domain) element_domain=$(ynh_app_setting_get --app=$element_instance --key=domain)
element_path=$(ynh_app_setting_get --app $element_instance --key path) element_path=$(ynh_app_setting_get --app=$element_instance --key=path)
web_client_location="https://""$element_domain""$element_path" web_client_location="https://""$element_domain""$element_path"
fi fi
ynh_app_setting_set --app="$app" --key=web_client_location --value="$web_client_location" ynh_app_setting_set --app="$app" --key=web_client_location --value="$web_client_location"

View file

@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
if systemctl is-active $app.service --quiet; then if systemctl is-active "$app".service --quiet; then
ynh_print_warn --message="It's hightly recommended to make your backup when the service is stopped. Please stop $app service with this command before to run the backup 'systemctl stop $app.service'" ynh_print_warn --message="It's hightly recommended to make your backup when the service is stopped. Please stop $app service with this command before to run the backup 'systemctl stop $app.service'"
fi fi
@ -37,7 +37,7 @@ ynh_backup --src_path="$install_dir"
#================================================= #=================================================
# BACKUP THE PHP-FPM CONFIGURATION # BACKUP THE PHP-FPM CONFIGURATION
ynh_backup --src_path "/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
if yunohost --output-as plain domain list | grep -q "^$server_name$" if yunohost --output-as plain domain list | grep -q "^$server_name$"
@ -90,7 +90,7 @@ ynh_backup --src_path="/var/log/matrix-$app" --is_big=1
#================================================= #=================================================
# Copy hook # Copy hook
ynh_backup --src_path "/etc/yunohost/hooks.d/post_cert_update/50-$app" ynh_backup --src_path="/etc/yunohost/hooks.d/post_cert_update/50-$app"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -10,7 +10,7 @@ source ./_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
# We stop the service # We stop the service
ynh_systemd_action --service_name=$app.service --action=stop ynh_systemd_action --service_name="$app".service --action=stop
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
@ -43,8 +43,8 @@ set_permissions
#================================================= #=================================================
ynh_script_progression --message="Restarting Synapse services..." --weight=5 ynh_script_progression --message="Restarting Synapse services..." --weight=5
ynh_systemd_action --service_name=$app-coturn.service --action=restart ynh_systemd_action --service_name="$app"-coturn.service --action=restart
ynh_systemd_action --service_name=$app.service --action=restart --line_match="Synapse now listening on TCP port $port_synapse_tls" --log_path="/var/log/matrix-$app/homeserver.log" --timeout=300 ynh_systemd_action --service_name="$app".service --action=restart --line_match="Synapse now listening on TCP port $port_synapse_tls" --log_path="/var/log/matrix-$app/homeserver.log" --timeout=300
if ! yunohost --output-as plain domain list | grep -q "^$server_name"'$'; then if ! yunohost --output-as plain domain list | grep -q "^$server_name"'$'; then
ynh_print_warn "Note yunohost won't be able to manage the required config for $server_name. So please add the needed DNS config as described on the documentation" ynh_print_warn "Note yunohost won't be able to manage the required config for $server_name. So please add the needed DNS config as described on the documentation"

View file

@ -37,4 +37,4 @@ ynh_app_config_apply() {
#================================================= #=================================================
# SELECT THE ACTION FOLLOWING THE GIVEN ARGUMENT # SELECT THE ACTION FOLLOWING THE GIVEN ARGUMENT
#================================================= #=================================================
ynh_app_config_run $1 ynh_app_config_run "$1"

View file

@ -13,8 +13,8 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
if [ "$server_name" == "Same than the domain" ]; then if [ "$server_name" == "Same than the domain" ]; then
server_name=$domain server_name="$domain"
ynh_app_setting_set --app=$app --key=server_name --value=$server_name ynh_app_setting_set --app="$app" --key=server_name --value="$server_name"
fi fi
#================================================= #=================================================
@ -43,10 +43,10 @@ ynh_app_setting_set --app="$app" --key=enable_registration --value="$enable_regi
# Check datadir empty # Check datadir empty
#================================================= #=================================================
if [ -n "$(ls -A $data_dir)" ]; then if [ -n "$(ls -A "$data_dir")" ]; then
old_data_dir_path="${data_dir}_$(date '+%Y%m%d.%H%M%S')" old_data_dir_path="${data_dir}_$(date '+%Y%m%d.%H%M%S')"
ynh_print_warn "Data directory was not empty. Data was moved to $old_data_dir_path" ynh_print_warn "Data directory was not empty. Data was moved to $old_data_dir_path"
mkdir -p $old_data_dir_path mkdir -p "$old_data_dir_path"
mv -t "$old_data_dir_path" "$data_dir"/* mv -t "$old_data_dir_path" "$data_dir"/*
fi fi
@ -71,7 +71,7 @@ fi
#================================================= #=================================================
ynh_script_progression --message='Configuring system groups' ynh_script_progression --message='Configuring system groups'
adduser $app ssl-cert adduser "$app" ssl-cert
adduser turnserver ssl-cert adduser turnserver ssl-cert
#================================================= #=================================================
@ -91,10 +91,10 @@ ynh_script_progression --message="Setting up source files..." --weight=50
# WARNING : theses command are used in INSTALL, UPGRADE # WARNING : theses command are used in INSTALL, UPGRADE
# For any update do it in all files # For any update do it in all files
mkdir -p /var/log/matrix-$app mkdir -p /var/log/matrix-"$app"
mkdir -p /etc/matrix-$app/conf.d mkdir -p /etc/matrix-"$app"/conf.d
mkdir -p /etc/matrix-$app/app-service mkdir -p /etc/matrix-"$app"/app-service
touch /etc/matrix-$app/conf.d/app_service.yaml touch /etc/matrix-"$app"/conf.d/app_service.yaml
# Install synapse in virtualenv # Install synapse in virtualenv
install_sources install_sources
@ -105,9 +105,9 @@ install_sources
# WARNING : theses command are used in INSTALL, UPGRADE # WARNING : theses command are used in INSTALL, UPGRADE
# For any update do it in all files # For any update do it in all files
cp ../sources/cas_server.php $install_dir/ cp ../sources/cas_server.php "$install_dir"/
chmod u=rwX,g=rX,o= -R $install_dir chmod u=rwX,g=rX,o= -R "$install_dir"
chown $app:$app -R $install_dir chown "$app:$app" -R "$install_dir"
#================================================= #=================================================
# CREATE SYNAPSE CONFIG # CREATE SYNAPSE CONFIG
@ -116,17 +116,17 @@ chown $app:$app -R $install_dir
ynh_script_progression --message="Creating Synapse config..." --weight=3 ynh_script_progression --message="Creating Synapse config..." --weight=3
# Generate config # Generate config
$code_dir/bin/python -m synapse.app.homeserver --keys-directory /etc/matrix-$app/ --generate-config --server-name $server_name --report-stats=no -c homeserver.yml $code_dir/bin/python -m synapse.app.homeserver --keys-directory /etc/matrix-"$app"/ --generate-config --server-name "$server_name" --report-stats=no -c homeserver.yml
# Get random values from config # Get random values from config
registration_shared_secret=$(egrep "^registration_shared_secret:" homeserver.yml | cut -d'"' -f2) registration_shared_secret="$(grep -E "^registration_shared_secret:" homeserver.yml | cut -d'"' -f2)"
form_secret=$(egrep "^form_secret:" homeserver.yml | cut -d'"' -f2) form_secret="$(grep -E "^form_secret:" homeserver.yml | cut -d'"' -f2)"
macaroon_secret_key=$(egrep "^macaroon_secret_key:" homeserver.yml | cut -d'"' -f2) macaroon_secret_key="$(grep -E "^macaroon_secret_key:" homeserver.yml | cut -d'"' -f2)"
# store in yunohost settings # store in yunohost settings
ynh_app_setting_set --app=$app --key=registration_shared_secret --value="$registration_shared_secret" ynh_app_setting_set --app="$app" --key=registration_shared_secret --value="$registration_shared_secret"
ynh_app_setting_set --app=$app --key=form_secret --value="$form_secret" ynh_app_setting_set --app="$app" --key=form_secret --value="$form_secret"
ynh_app_setting_set --app=$app --key=macaroon_secret_key --value="$macaroon_secret_key" ynh_app_setting_set --app="$app" --key=macaroon_secret_key --value="$macaroon_secret_key"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
@ -134,10 +134,10 @@ ynh_app_setting_set --app=$app --key=macaroon_secret_key --value="$macaroon_secr
ynh_script_progression --message="Configuring a systemd service..." --weight=2 ynh_script_progression --message="Configuring a systemd service..." --weight=2
# Create systemd service for synapse and turnserver # Create systemd service for synapse and turnserver
ynh_add_systemd_config --service=$app --template=synapse.service ynh_add_systemd_config --service="$app" --template=synapse.service
cp ../conf/default_coturn /etc/matrix-$app/coturn_env cp ../conf/default_coturn /etc/matrix-"$app"/coturn_env
ynh_add_systemd_config --service=$app-coturn --template=synapse-coturn.service ynh_add_systemd_config --service="$app"-coturn --template=synapse-coturn.service
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -171,7 +171,7 @@ configure_coturn
#================================================= #=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=2 ynh_script_progression --message="Configuring log rotation..." --weight=2
ynh_use_logrotate --logfile "/var/log/matrix-$app" ynh_use_logrotate --logfile="/var/log/matrix-$app"
#================================================= #=================================================
# ADD SCRIPT FOR COTURN CRON AND APP SERVICE # ADD SCRIPT FOR COTURN CRON AND APP SERVICE
@ -182,7 +182,7 @@ ynh_use_logrotate --logfile "/var/log/matrix-$app"
ynh_add_config --template="../sources/Coturn_config_rotate.sh" --destination="$code_dir/Coturn_config_rotate.sh" ynh_add_config --template="../sources/Coturn_config_rotate.sh" --destination="$code_dir/Coturn_config_rotate.sh"
ynh_add_config --template="../sources/update_synapse_for_appservice.sh" --destination="$code_dir/update_synapse_for_appservice.sh" ynh_add_config --template="../sources/update_synapse_for_appservice.sh" --destination="$code_dir/update_synapse_for_appservice.sh"
ynh_add_config --template=../sources/set_admin_user.sh --destination=$code_dir/set_admin_user.sh ynh_add_config --template=../sources/set_admin_user.sh --destination="$code_dir"/set_admin_user.sh
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
@ -193,7 +193,7 @@ ynh_add_config --template=../sources/set_admin_user.sh --destination=$code_dir/s
ynh_script_progression --message="Configuring permissions..." --weight=1 ynh_script_progression --message="Configuring permissions..." --weight=1
if yunohost --output-as plain domain list | grep -q "^$server_name$"; then if yunohost --output-as plain domain list | grep -q "^$server_name$"; then
ynh_""permission_create --permission=server_client_infos --url=$server_name/.well-known/matrix \ ynh_""permission_create --permission=server_client_infos --url="$server_name"/.well-known/matrix \
--label="Server info for clients. (well-known)" --show_tile=false --allowed=visitors \ --label="Server info for clients. (well-known)" --show_tile=false --allowed=visitors \
--auth_header=false --protected=true --auth_header=false --protected=true
else else
@ -206,8 +206,8 @@ fi
# WARNING : theses command are used in INSTALL, UPGRADE # WARNING : theses command are used in INSTALL, UPGRADE
# For any update do it in all files # For any update do it in all files
ynh_replace_string __APP__ $app ../hooks/post_cert_update ynh_replace_string __APP__ "$app" ../hooks/post_cert_update
ynh_replace_string __DOMAIN__ $domain ../hooks/post_cert_update ynh_replace_string __DOMAIN__ "$domain" ../hooks/post_cert_update
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
@ -220,16 +220,16 @@ set_permissions data
# ADVERTISE SERVICE IN ADMIN PANEL # ADVERTISE SERVICE IN ADMIN PANEL
#================================================= #=================================================
yunohost service add $app --log "/var/log/matrix-$app/homeserver.log" --needs_exposed_ports $port_synapse_tls --description 'Main matrix server service.' yunohost service add "$app" --log "/var/log/matrix-$app/homeserver.log" --needs_exposed_ports "$port_synapse_tls" --description 'Main matrix server service.'
yunohost service add $app-coturn --needs_exposed_ports $port_turnserver_tls --description 'Turn server for matrix server. Used for audio and video call.' yunohost service add "$app"-coturn --needs_exposed_ports "$port_turnserver_tls" --description 'Turn server for matrix server. Used for audio and video call.'
#================================================= #=================================================
# RELOAD SERVICES # RELOAD SERVICES
#================================================= #=================================================
ynh_script_progression --message="Restarting Synapse services..." --weight=11 ynh_script_progression --message="Restarting Synapse services..." --weight=11
ynh_systemd_action --service_name=$app-coturn.service --action=restart ynh_systemd_action --service_name="$app"-coturn.service --action=restart
ynh_systemd_action --service_name=$app.service --action=restart --line_match="Synapse now listening on TCP port $port_synapse_tls" --log_path="/var/log/matrix-$app/homeserver.log" --timeout=300 ynh_systemd_action --service_name="$app".service --action=restart --line_match="Synapse now listening on TCP port $port_synapse_tls" --log_path="/var/log/matrix-$app/homeserver.log" --timeout=300
#================================================= #=================================================
# SETUP FAIL2BAN # SETUP FAIL2BAN

View file

@ -34,10 +34,14 @@ ynh_remove_systemd_config --service=$app-coturn
ynh_script_progression --message="Removing app main directory" --weight=2 ynh_script_progression --message="Removing app main directory" --weight=2
ynh_secure_remove --file=$code_dir ynh_secure_remove --file=$code_dir
ynh_secure_remove --file=/var/log/matrix-$app
ynh_secure_remove --file=/etc/matrix-$app ynh_secure_remove --file=/etc/matrix-$app
ynh_secure_remove --file=/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf ynh_secure_remove --file=/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf
if [ "$YNH_APP_PURGE" -eq 1 ]; then
ynh_script_progression --message="Removing logs..."
ynh_secure_remove --file=/var/log/matrix-"$app"
fi
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================

View file

@ -104,7 +104,7 @@ configure_coturn
#================================================= #=================================================
ynh_script_progression --message="Configuring log rotation..." ynh_script_progression --message="Configuring log rotation..."
ynh_use_logrotate --logfile /var/log/matrix-$app ynh_use_logrotate --logfile=/var/log/matrix-$app
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION

View file

@ -30,7 +30,7 @@ if [ -z "${domain:-}" ]; then
ynh_app_setting_set --app=$app --key=path --value=$path ynh_app_setting_set --app=$app --key=path --value=$path
ynh_app_setting_delete --app=$app --key=special_domain ynh_app_setting_delete --app=$app --key=special_domain
ynh_app_setting_delete --app=$app --key=special_path ynh_app_setting_delete --app=$app --key=special_path
ynh_app_setting_set --app=$app --key=no_sso --value true ynh_app_setting_set --app=$app --key=no_sso --value=true
fi fi
ensure_vars_set ensure_vars_set
@ -187,7 +187,7 @@ then
# MAKE A CLEAN LOGROTATE CONFIG # MAKE A CLEAN LOGROTATE CONFIG
#================================================= #=================================================
ynh_use_logrotate --logfile /var/log/matrix-$app --nonappend ynh_use_logrotate --logfile=/var/log/matrix-$app --nonappend
fi fi
#================================================= #=================================================