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:
parent
181f1e0551
commit
6ccdd95b12
9 changed files with 26 additions and 20 deletions
|
@ -489,7 +489,7 @@ database:
|
||||||
args:
|
args:
|
||||||
user: __SYNAPSE_DB_USER__
|
user: __SYNAPSE_DB_USER__
|
||||||
password: __SYNAPSE_DB_PWD__
|
password: __SYNAPSE_DB_PWD__
|
||||||
database: matrix___APP__
|
database: __SYNAPSE_DB_NAME__
|
||||||
host: localhost
|
host: localhost
|
||||||
cp_min: 5
|
cp_min: 5
|
||||||
cp_max: 10
|
cp_max: 10
|
||||||
|
|
|
@ -4,7 +4,7 @@ static-auth-secret=__TURNSERVER_PWD__
|
||||||
realm=__DOMAIN__
|
realm=__DOMAIN__
|
||||||
|
|
||||||
tls-listening-port=__TURNSERVER_TLS_PORT__
|
tls-listening-port=__TURNSERVER_TLS_PORT__
|
||||||
alt-tls-listening-port=__TLS_ALT_PORT__
|
alt-tls-listening-port=__TURNSERVER_ALT_TLS_PORT__
|
||||||
min-port=49153
|
min-port=49153
|
||||||
max-port=49193
|
max-port=49193
|
||||||
cli-port=__CLI_PORT__
|
cli-port=__CLI_PORT__
|
||||||
|
|
|
@ -39,6 +39,7 @@ fi
|
||||||
synapse_user="matrix-$app"
|
synapse_user="matrix-$app"
|
||||||
synapse_db_name="matrix_$app"
|
synapse_db_name="matrix_$app"
|
||||||
synapse_db_user="matrix_$app"
|
synapse_db_user="matrix_$app"
|
||||||
|
synapse_db_name="matrix_$app"
|
||||||
upstream_version=$(ynh_app_upstream_version)
|
upstream_version=$(ynh_app_upstream_version)
|
||||||
final_www_path="/var/www/$app"
|
final_www_path="/var/www/$app"
|
||||||
data_path="/home/yunohost.app/matrix-$app"
|
data_path="/home/yunohost.app/matrix-$app"
|
||||||
|
|
|
@ -46,6 +46,7 @@ ynh_print_ON
|
||||||
synapse_user="matrix-$app"
|
synapse_user="matrix-$app"
|
||||||
synapse_db_name="matrix_$app"
|
synapse_db_name="matrix_$app"
|
||||||
synapse_db_user="matrix_$app"
|
synapse_db_user="matrix_$app"
|
||||||
|
synapse_db_name="matrix_$app"
|
||||||
upstream_version=$(ynh_app_upstream_version)
|
upstream_version=$(ynh_app_upstream_version)
|
||||||
|
|
||||||
# Check if the new path stay /_matrix if not exit
|
# Check if the new path stay /_matrix if not exit
|
||||||
|
|
|
@ -37,6 +37,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
synapse_user="matrix-$app"
|
synapse_user="matrix-$app"
|
||||||
synapse_db_name="matrix_$app"
|
synapse_db_name="matrix_$app"
|
||||||
synapse_db_user="matrix_$app"
|
synapse_db_user="matrix_$app"
|
||||||
|
synapse_db_name="matrix_$app"
|
||||||
upstream_version=$(ynh_app_upstream_version)
|
upstream_version=$(ynh_app_upstream_version)
|
||||||
report_stats="false"
|
report_stats="false"
|
||||||
allow_public_rooms="false"
|
allow_public_rooms="false"
|
||||||
|
@ -306,14 +307,12 @@ public_ip6="$(curl ipv6.yunohost.org)" || true
|
||||||
turn_external_ip=""
|
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"
|
||||||
then
|
then
|
||||||
turn_external_ip+="
|
turn_external_ip+="\nexternal-ip=$public_ip4"
|
||||||
external-ip=$public_ip4"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$public_ip6" ] && ynh_validate_ip6 --ip_address="$public_ip6"
|
if [ -n "$public_ip6" ] && ynh_validate_ip6 --ip_address="$public_ip6"
|
||||||
then
|
then
|
||||||
turn_external_ip+="
|
turn_external_ip+="\nexternal-ip=$public_ip6"
|
||||||
external-ip=$public_ip6"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_add_config --template="turnserver.conf" --destination="/etc/matrix-$app/coturn.conf"
|
ynh_add_config --template="turnserver.conf" --destination="/etc/matrix-$app/coturn.conf"
|
||||||
|
|
|
@ -31,6 +31,7 @@ turnserver_alt_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_alt_tl
|
||||||
synapse_user="matrix-$app"
|
synapse_user="matrix-$app"
|
||||||
synapse_db_name="matrix_$app"
|
synapse_db_name="matrix_$app"
|
||||||
synapse_db_user="matrix_$app"
|
synapse_db_user="matrix_$app"
|
||||||
|
synapse_db_name="matrix_$app"
|
||||||
upstream_version=$(ynh_app_upstream_version)
|
upstream_version=$(ynh_app_upstream_version)
|
||||||
final_www_path="/var/www/$app"
|
final_www_path="/var/www/$app"
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ ynh_print_ON
|
||||||
synapse_user="matrix-$app"
|
synapse_user="matrix-$app"
|
||||||
synapse_db_name="matrix_$app"
|
synapse_db_name="matrix_$app"
|
||||||
synapse_db_user="matrix_$app"
|
synapse_db_user="matrix_$app"
|
||||||
|
synapse_db_name="matrix_$app"
|
||||||
upstream_version=$(ynh_app_upstream_version)
|
upstream_version=$(ynh_app_upstream_version)
|
||||||
final_www_path="/var/www/$app"
|
final_www_path="/var/www/$app"
|
||||||
data_path="/home/yunohost.app/matrix-$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
|
# For any update do it in all files
|
||||||
ynh_install_app_dependencies $dependances
|
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
|
# RESTORE ALL CONFIG AND DATA
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -102,6 +93,18 @@ install_sources
|
||||||
ynh_script_progression --message="Reload fail2ban..." --weight=6
|
ynh_script_progression --message="Reload fail2ban..." --weight=6
|
||||||
ynh_systemd_action --action=restart --service_name=fail2ban
|
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
|
# RESTORE THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -50,6 +50,7 @@ ynh_print_ON
|
||||||
synapse_user="matrix-$app"
|
synapse_user="matrix-$app"
|
||||||
synapse_db_name="matrix_$app"
|
synapse_db_name="matrix_$app"
|
||||||
synapse_db_user="matrix_$app"
|
synapse_db_user="matrix_$app"
|
||||||
|
synapse_db_name="matrix_$app"
|
||||||
upstream_version=$(ynh_app_upstream_version)
|
upstream_version=$(ynh_app_upstream_version)
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
final_www_path="/var/www/$app"
|
final_www_path="/var/www/$app"
|
||||||
|
|
|
@ -4,11 +4,13 @@ app_instance=__APP__
|
||||||
|
|
||||||
source /usr/share/yunohost/helpers
|
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_ip4="$(curl ip.yunohost.org)" || true
|
||||||
public_ip6="$(curl ipv6.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"
|
if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4"
|
||||||
then
|
then
|
||||||
echo "external-ip=$public_ip4" >> "$coturn_config_path"
|
echo "external-ip=$public_ip4" >> "$coturn_config_path"
|
||||||
|
@ -19,8 +21,6 @@ then
|
||||||
echo "external-ip=$public_ip6" >> "$coturn_config_path"
|
echo "external-ip=$public_ip6" >> "$coturn_config_path"
|
||||||
fi
|
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")
|
new_config_line=$(egrep "^external-ip=.*\$" "/etc/matrix-$app_instance/coturn.conf")
|
||||||
|
|
||||||
setfacl -R -m user:turnserver:rX /etc/matrix-$app_instance
|
setfacl -R -m user:turnserver:rX /etc/matrix-$app_instance
|
||||||
|
|
Loading…
Add table
Reference in a new issue