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 #457 from YunoHost-Apps/upgrade

Upgrade
This commit is contained in:
Josue-T 2024-05-06 15:11:19 +02:00 committed by GitHub
commit 80afb8e5e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 91 additions and 85 deletions

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)
**Shipped version:** 1.105.1~ynh1
**Shipped version:** 1.106.0~ynh1
## Documentation and resources
- Official app website: <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)
**Paketatutako bertsioa:** 1.105.1~ynh1
**Paketatutako bertsioa:** 1.106.0~ynh1
## Dokumentazioa eta baliabideak
- 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)
**Version incluse:** 1.105.1~ynh1
**Version incluse:** 1.106.0~ynh1
## Documentations et ressources
- 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)
**Versión proporcionada:** 1.105.1~ynh1
**Versión proporcionada:** 1.106.0~ynh1
## Documentación e recursos
- Web oficial da app: <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)
**分发版本:** 1.105.1~ynh1
**分发版本:** 1.106.0~ynh1
## 文档与资源
- 官方应用网站: <https://matrix.org/>

View file

@ -15,13 +15,13 @@ ijson==3.2.3
immutabledict==4.2.0
incremental==22.10.0
Jinja2==3.1.3
jsonschema==4.21.1
jsonschema==4.22.0
jsonschema-specifications==2023.12.1
ldap3==2.9.1
lxml==5.2.1
MarkupSafe==2.1.5
matrix-common==1.3.0
matrix-synapse==1.105.1
matrix-synapse==1.106.0
matrix-synapse-ldap3==0.3.0
msgpack==1.0.8
ndg-httpsclient==0.5.1
@ -40,7 +40,7 @@ pymacaroons==0.13.0
PyNaCl==1.5.0
pyOpenSSL==24.1.0
PyYAML==6.0.1
referencing==0.34.0
referencing==0.35.0
requests==2.31.0
rpds-py==0.18.0
semantic-version==2.10.0

View file

@ -15,13 +15,13 @@ ijson==3.2.3
immutabledict==4.2.0
incremental==22.10.0
Jinja2==3.1.3
jsonschema==4.21.1
jsonschema==4.22.0
jsonschema-specifications==2023.12.1
ldap3==2.9.1
lxml==5.2.1
MarkupSafe==2.1.5
matrix-common==1.3.0
matrix-synapse==1.105.1
matrix-synapse==1.106.0
matrix-synapse-ldap3==0.3.0
msgpack==1.0.8
ndg-httpsclient==0.5.1
@ -40,7 +40,7 @@ pymacaroons==0.13.0
PyNaCl==1.5.0
pyOpenSSL==24.1.0
PyYAML==6.0.1
referencing==0.34.0
referencing==0.35.0
requests==2.31.0
rpds-py==0.18.0
semantic-version==2.10.0

View file

@ -5,7 +5,7 @@ name = "Synapse"
description.en = "Instant messaging server which uses Matrix"
description.fr = "Serveur de messagerie instantané basé sur Matrix"
version = "1.105.1~ynh1"
version = "1.106.0~ynh1"
maintainers = ["Josué Tille"]
@ -63,13 +63,13 @@ ram.runtime = "1G"
[resources]
[resources.sources.synapse_prebuilt_armv7_bookworm]
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.sha256 = "39beb845db95880fe561f14d936c4d22b8d50eac005c4b3ad0489c517df461da"
armhf.url = "https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.106.0/matrix-synapse_1.106.0-bookworm-bin1_armv7l.tar.gz"
armhf.sha256 = "a33070c47f3b0175d304ff9e13bd77b87743b4c457ee58c498fe1985e9fea336"
[resources.sources.synapse_prebuilt_armv7_bullseye]
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.sha256 = "7eb2d8e870c0e58641e6790ab680ffed327a88dec1d3235bb86b8f19ad044fbe"
armhf.url = "https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.106.0/matrix-synapse_1.106.0-bullseye-bin1_armv7l.tar.gz"
armhf.sha256 = "8e4ae0f16474458e4a4c1759d75e73f5ef15e4323a7b2ce6dbeb8fa56f4f44c2"
[resources.system_user]
allow_email = true

View file

@ -6,51 +6,51 @@ install_sources() {
# Install/upgrade synapse in virtualenv
# 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
ynh_secure_remove --file=$code_dir/bin
ynh_secure_remove --file=$code_dir/lib
ynh_secure_remove --file=$code_dir/lib64
ynh_secure_remove --file=$code_dir/include
ynh_secure_remove --file=$code_dir/share
ynh_secure_remove --file=$code_dir/pyvenv.cfg
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"/lib
ynh_secure_remove --file="$code_dir"/lib64
ynh_secure_remove --file="$code_dir"/include
ynh_secure_remove --file="$code_dir"/share
ynh_secure_remove --file="$code_dir"/pyvenv.cfg
fi
mkdir -p $code_dir
chown $app:root -R $code_dir
mkdir -p "$code_dir"
chown "$app":root -R "$code_dir"
if [ -n "$(uname -m | grep arm)" ]
then
# 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/lib
ynh_secure_remove --file=$code_dir/include
ynh_secure_remove --file=$code_dir/share
ynh_secure_remove --file="$code_dir"/bin
ynh_secure_remove --file="$code_dir"/lib
ynh_secure_remove --file="$code_dir"/include
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
for f in $(ls $code_dir/bin); do
for f in $(ls "$code_dir"/bin); do
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="$code_dir"/bin/"$f"
fi
done
else
# 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
local pip3=$code_dir/bin/pip3
local pip3="$code_dir"/bin/pip3
$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
# 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
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
patch < $YNH_APP_BASEDIR/scripts/patch/ldap_auth_filter_anonymous_user.patch
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"
patch < "$YNH_APP_BASEDIR"/scripts/patch/ldap_auth_filter_anonymous_user.patch
popd
fi
}
@ -58,8 +58,10 @@ install_sources() {
configure_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
local public_ip4="$(curl -s ip.yunohost.org)" || true
local public_ip6="$(curl -s ipv6.yunohost.org)" || true
local public_ip4
local public_ip6
public_ip4="$(curl -s ip.yunohost.org)" || true
public_ip6="$(curl -s ipv6.yunohost.org)" || true
local turn_external_ip=""
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$"
then
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
else
e2e_enabled_by_default_client_config=true
@ -113,8 +115,8 @@ ensure_vars_set() {
element_instance=element
if yunohost --output-as plain app list | grep -q "^$element_instance"'$'; then
element_domain=$(ynh_app_setting_get --app $element_instance --key domain)
element_path=$(ynh_app_setting_get --app $element_instance --key path)
element_domain=$(ynh_app_setting_get --app=$element_instance --key=domain)
element_path=$(ynh_app_setting_get --app=$element_instance --key=path)
web_client_location="https://""$element_domain""$element_path"
fi
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
#=================================================
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'"
fi
@ -37,7 +37,7 @@ ynh_backup --src_path="$install_dir"
#=================================================
# 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"
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
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

View file

@ -10,7 +10,7 @@ source ./_common.sh
source /usr/share/yunohost/helpers
# We stop the service
ynh_systemd_action --service_name=$app.service --action=stop
ynh_systemd_action --service_name="$app".service --action=stop
#=================================================
# STANDARD MODIFICATIONS
@ -43,8 +43,8 @@ set_permissions
#=================================================
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.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"-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
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"

View file

@ -37,4 +37,4 @@ ynh_app_config_apply() {
#=================================================
# 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
server_name=$domain
ynh_app_setting_set --app=$app --key=server_name --value=$server_name
server_name="$domain"
ynh_app_setting_set --app="$app" --key=server_name --value="$server_name"
fi
#=================================================
@ -43,10 +43,10 @@ ynh_app_setting_set --app="$app" --key=enable_registration --value="$enable_regi
# 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')"
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"/*
fi
@ -71,7 +71,7 @@ fi
#=================================================
ynh_script_progression --message='Configuring system groups'
adduser $app ssl-cert
adduser "$app" 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
# For any update do it in all files
mkdir -p /var/log/matrix-$app
mkdir -p /etc/matrix-$app/conf.d
mkdir -p /etc/matrix-$app/app-service
touch /etc/matrix-$app/conf.d/app_service.yaml
mkdir -p /var/log/matrix-"$app"
mkdir -p /etc/matrix-"$app"/conf.d
mkdir -p /etc/matrix-"$app"/app-service
touch /etc/matrix-"$app"/conf.d/app_service.yaml
# Install synapse in virtualenv
install_sources
@ -105,9 +105,9 @@ install_sources
# WARNING : theses command are used in INSTALL, UPGRADE
# For any update do it in all files
cp ../sources/cas_server.php $install_dir/
chmod u=rwX,g=rX,o= -R $install_dir
chown $app:$app -R $install_dir
cp ../sources/cas_server.php "$install_dir"/
chmod u=rwX,g=rX,o= -R "$install_dir"
chown "$app:$app" -R "$install_dir"
#=================================================
# CREATE SYNAPSE CONFIG
@ -116,17 +116,17 @@ chown $app:$app -R $install_dir
ynh_script_progression --message="Creating Synapse config..." --weight=3
# 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
registration_shared_secret=$(egrep "^registration_shared_secret:" homeserver.yml | cut -d'"' -f2)
form_secret=$(egrep "^form_secret:" homeserver.yml | cut -d'"' -f2)
macaroon_secret_key=$(egrep "^macaroon_secret_key:" homeserver.yml | cut -d'"' -f2)
registration_shared_secret="$(grep -E "^registration_shared_secret:" homeserver.yml | cut -d'"' -f2)"
form_secret="$(grep -E "^form_secret:" homeserver.yml | cut -d'"' -f2)"
macaroon_secret_key="$(grep -E "^macaroon_secret_key:" homeserver.yml | cut -d'"' -f2)"
# 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=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=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=macaroon_secret_key --value="$macaroon_secret_key"
#=================================================
# 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
# 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
ynh_add_systemd_config --service=$app-coturn --template=synapse-coturn.service
cp ../conf/default_coturn /etc/matrix-"$app"/coturn_env
ynh_add_systemd_config --service="$app"-coturn --template=synapse-coturn.service
#=================================================
# NGINX CONFIGURATION
@ -171,7 +171,7 @@ configure_coturn
#=================================================
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
@ -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/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
@ -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
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 \
--auth_header=false --protected=true
else
@ -206,8 +206,8 @@ fi
# WARNING : theses command are used in INSTALL, UPGRADE
# For any update do it in all files
ynh_replace_string __APP__ $app ../hooks/post_cert_update
ynh_replace_string __DOMAIN__ $domain ../hooks/post_cert_update
ynh_replace_string __APP__ "$app" ../hooks/post_cert_update
ynh_replace_string __DOMAIN__ "$domain" ../hooks/post_cert_update
#=================================================
# SECURE FILES AND DIRECTORIES
@ -220,16 +220,16 @@ set_permissions data
# 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-coturn --needs_exposed_ports $port_turnserver_tls --description 'Turn server for matrix server. Used for audio and video call.'
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.'
#=================================================
# RELOAD SERVICES
#=================================================
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.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"-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
#=================================================
# 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_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/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
#=================================================

View file

@ -104,7 +104,7 @@ configure_coturn
#=================================================
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

View file

@ -30,7 +30,7 @@ if [ -z "${domain:-}" ]; then
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_path
ynh_app_setting_set --app=$app --key=no_sso --value true
ynh_app_setting_set --app=$app --key=no_sso --value=true
fi
ensure_vars_set
@ -187,7 +187,7 @@ then
# MAKE A CLEAN LOGROTATE CONFIG
#=================================================
ynh_use_logrotate --logfile /var/log/matrix-$app --nonappend
ynh_use_logrotate --logfile=/var/log/matrix-$app --nonappend
fi
#=================================================