diff --git a/conf/homeserver.yaml b/conf/homeserver.yaml index b8d1823..6376607 100644 --- a/conf/homeserver.yaml +++ b/conf/homeserver.yaml @@ -489,7 +489,7 @@ database: args: user: __SYNAPSE_DB_USER__ password: __SYNAPSE_DB_PWD__ - database: matrix___APP__ + database: __SYNAPSE_DB_NAME__ host: localhost cp_min: 5 cp_max: 10 diff --git a/conf/turnserver.conf b/conf/turnserver.conf index 3d3440f..f25071c 100644 --- a/conf/turnserver.conf +++ b/conf/turnserver.conf @@ -4,7 +4,7 @@ static-auth-secret=__TURNSERVER_PWD__ realm=__DOMAIN__ tls-listening-port=__TURNSERVER_TLS_PORT__ -alt-tls-listening-port=__TLS_ALT_PORT__ +alt-tls-listening-port=__TURNSERVER_ALT_TLS_PORT__ min-port=49153 max-port=49193 cli-port=__CLI_PORT__ diff --git a/scripts/backup b/scripts/backup index ffb2ed3..6af787c 100644 --- a/scripts/backup +++ b/scripts/backup @@ -39,6 +39,7 @@ fi synapse_user="matrix-$app" synapse_db_name="matrix_$app" synapse_db_user="matrix_$app" +synapse_db_name="matrix_$app" upstream_version=$(ynh_app_upstream_version) final_www_path="/var/www/$app" data_path="/home/yunohost.app/matrix-$app" diff --git a/scripts/change_url b/scripts/change_url index 73f3c50..52aded6 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -46,6 +46,7 @@ ynh_print_ON synapse_user="matrix-$app" synapse_db_name="matrix_$app" synapse_db_user="matrix_$app" +synapse_db_name="matrix_$app" upstream_version=$(ynh_app_upstream_version) # Check if the new path stay /_matrix if not exit diff --git a/scripts/install b/scripts/install index 54528ab..a1e1f3d 100644 --- a/scripts/install +++ b/scripts/install @@ -37,6 +37,7 @@ app=$YNH_APP_INSTANCE_NAME synapse_user="matrix-$app" synapse_db_name="matrix_$app" synapse_db_user="matrix_$app" +synapse_db_name="matrix_$app" upstream_version=$(ynh_app_upstream_version) report_stats="false" allow_public_rooms="false" @@ -306,14 +307,12 @@ public_ip6="$(curl ipv6.yunohost.org)" || true turn_external_ip="" if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4" then - turn_external_ip+=" -external-ip=$public_ip4" + turn_external_ip+="\nexternal-ip=$public_ip4" fi if [ -n "$public_ip6" ] && ynh_validate_ip6 --ip_address="$public_ip6" then - turn_external_ip+=" -external-ip=$public_ip6" + turn_external_ip+="\nexternal-ip=$public_ip6" fi ynh_add_config --template="turnserver.conf" --destination="/etc/matrix-$app/coturn.conf" diff --git a/scripts/remove b/scripts/remove index 34ed766..eb42eb6 100755 --- a/scripts/remove +++ b/scripts/remove @@ -31,6 +31,7 @@ turnserver_alt_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_alt_tl synapse_user="matrix-$app" synapse_db_name="matrix_$app" synapse_db_user="matrix_$app" +synapse_db_name="matrix_$app" upstream_version=$(ynh_app_upstream_version) final_www_path="/var/www/$app" diff --git a/scripts/restore b/scripts/restore index a6dc022..e11084a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -47,6 +47,7 @@ ynh_print_ON synapse_user="matrix-$app" synapse_db_name="matrix_$app" synapse_db_user="matrix_$app" +synapse_db_name="matrix_$app" upstream_version=$(ynh_app_upstream_version) final_www_path="/var/www/$app" data_path="/home/yunohost.app/matrix-$app" @@ -72,16 +73,6 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=70 # For any update do it in all files ynh_install_app_dependencies $dependances -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$synapse_user --home_dir=$data_path -adduser $synapse_user ssl-cert -adduser turnserver ssl-cert - #================================================= # RESTORE ALL CONFIG AND DATA #================================================= @@ -102,6 +93,18 @@ install_sources ynh_script_progression --message="Reload fail2ban..." --weight=6 ynh_systemd_action --action=restart --service_name=fail2ban +#================================================= +# SPECIFIC RESTORATION +#================================================= +# RECREATE THE DEDICATED USER +#================================================= +ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 + +# Create the dedicated user (if not existing) +ynh_system_user_create --username=$synapse_user --home_dir=$data_path +adduser $synapse_user ssl-cert +adduser turnserver ssl-cert + #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 69c02d8..072163b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -50,6 +50,7 @@ ynh_print_ON synapse_user="matrix-$app" synapse_db_name="matrix_$app" synapse_db_user="matrix_$app" +synapse_db_name="matrix_$app" upstream_version=$(ynh_app_upstream_version) upgrade_type=$(ynh_check_app_version_changed) final_www_path="/var/www/$app" diff --git a/sources/Coturn_config_rotate.sh b/sources/Coturn_config_rotate.sh index 7c2d704..4cfa5e2 100644 --- a/sources/Coturn_config_rotate.sh +++ b/sources/Coturn_config_rotate.sh @@ -4,11 +4,13 @@ app_instance=__APP__ source /usr/share/yunohost/helpers -external_IP_line="external-ip=__IPV4__,__IPV6__" - +coturn_config_path="/etc/matrix-$app_instance/coturn.conf" public_ip4="$(curl ip.yunohost.org)" || true public_ip6="$(curl ipv6.yunohost.org)" || true +old_config_line=$(egrep "^external-ip=.*\$" $coturn_config_path) +perl -i -pe 's/(^external-ip=.*\n)*//g' $coturn_config_path + if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4" then echo "external-ip=$public_ip4" >> "$coturn_config_path" @@ -19,8 +21,6 @@ then echo "external-ip=$public_ip6" >> "$coturn_config_path" fi -old_config_line=$(egrep "^external-ip=.*\$" "/etc/matrix-$app_instance/coturn.conf") -ynh_replace_string "^external-ip=.*\$" "$external_IP_line" "/etc/matrix-$app_instance/coturn.conf" new_config_line=$(egrep "^external-ip=.*\$" "/etc/matrix-$app_instance/coturn.conf") setfacl -R -m user:turnserver:rX /etc/matrix-$app_instance