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

Fix template helper

This commit is contained in:
Josué Tille 2021-02-18 09:16:37 +01:00
parent 181f1e0551
commit 6ccdd95b12
No known key found for this signature in database
GPG key ID: 716A6C99B04194EF
9 changed files with 26 additions and 20 deletions

View file

@ -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

View file

@ -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__

View file

@ -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"

View file

@ -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

View file

@ -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"

View file

@ -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"

View file

@ -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
#=================================================

View file

@ -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"

View file

@ -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