1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/galene_ynh.git synced 2024-09-03 18:36:31 +02:00

Open ports for turn

This commit is contained in:
ericgaspar 2021-02-25 09:36:43 +01:00
parent dfbe5f44bd
commit ec8b46e7b7
No known key found for this signature in database
GPG key ID: 574F281483054D44
8 changed files with 40 additions and 10 deletions

View file

@ -1,8 +1,6 @@
# See here for more information
# https://github.com/YunoHost/package_check#syntax-check_process-file
# Move this file from check_process.default to check_process when you have filled it.
;; Test complet
; Manifest
domain="domain.tld" (DOMAIN)

View file

@ -8,7 +8,7 @@ Type=simple
WorkingDirectory=__FINALPATH__/
User=__APP__
Group=__APP__
ExecStart=__FINALPATH__/galene -turn auto
ExecStart=__FINALPATH__/galene -turn __IPV4__:1194
LimitNOFILE=65536
[Install]

View file

@ -14,7 +14,7 @@
"email": ""
},
"requirements": {
"yunohost": ">= 4.0.8"
"yunohost": ">= 4.1.7"
},
"multi_instance": false,
"services": [

View file

@ -106,14 +106,14 @@ fi
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --time --weight=3
ynh_script_progression --message="Starting a systemd service..." --weight=3
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -66,6 +66,15 @@ ynh_script_progression --message="Finding an available port..." --weight=3
port=$(ynh_find_port --port=8443)
ynh_app_setting_set --app=$app --key=port --value=$port
# Find an available port
turn_port=$(ynh_find_port --port=1194)
ynh_app_setting_set --app=$app --key=port --value=$port
# Open the port
ynh_script_progression --message="Configuring firewall..." --weight=1
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
ynh_exec_warn_less yunohost firewall allow Both $turn_port
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -115,6 +124,10 @@ ynh_system_user_create --username=$app
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
public_ip4="$(curl ip.yunohost.org)" || true
ynh_replace_string --match_string="__IPV4__" --replace_string="$public_ip4" --target_file="../conf/systemd.service"
# Create a dedicated systemd config
ynh_add_systemd_config
@ -152,7 +165,7 @@ chmod -R 755 $final_path
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=2
yunohost service add $app --description="Videoconferencing server" --log="/var/log/$app/$app.log"
yunohost service add $app --description="Videoconferencing server" --log="/var/log/$app/$app.log" --needs_exposed_ports $turn_port
#=================================================
# START SYSTEMD SERVICE

View file

@ -18,6 +18,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port)
turn_port=$(ynh_app_setting_get --app=$app --key=turn_port)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
@ -57,6 +58,22 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $port$"
then
ynh_script_progression --message="Closing port $port..." --weight=1
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
if yunohost firewall list | grep -q "\- $turn_port$"
then
ynh_script_progression --message="Closing port $turn_port..." --weight=1
ynh_exec_warn_less yunohost firewall disallow both $turn_port
fi
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -31,6 +31,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
group_name=$(ynh_app_setting_get --app=$app --key=group_name)
turn_port=$(ynh_app_setting_get --app=$app --key=turn_port)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -86,7 +87,7 @@ systemctl enable $app.service --quiet
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=2
yunohost service add $app --description="Videoconferencing server" --log="/var/log/$app/$app.log"
yunohost service add $app --description="Videoconferencing server" --log="/var/log/$app/$app.log" --needs_exposed_ports $turn_port
#=================================================
# START SYSTEMD SERVICE

View file

@ -23,6 +23,7 @@ is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
group_name=$(ynh_app_setting_get --app=$app --key=group_name)
port=$(ynh_app_setting_get --app=$app --key=port)
turn_port=$(ynh_app_setting_get --app=$app --key=turn_port)
architecture=$(ynh_detect_arch)
#=================================================
@ -149,7 +150,7 @@ chmod -R 755 $final_path
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Videoconferencing server" --log="/var/log/$app/$app.log"
yunohost service add $app --description="Videoconferencing server" --log="/var/log/$app/$app.log" --needs_exposed_ports $turn_port
#=================================================
# START SYSTEMD SERVICE