mirror of
https://github.com/YunoHost-Apps/rportd_ynh.git
synced 2024-09-03 20:16:15 +02:00
More ports
This commit is contained in:
parent
1b6e3fcad2
commit
3112dc3dfa
5 changed files with 20 additions and 6 deletions
|
@ -101,7 +101,7 @@
|
||||||
## Defaults to ['20000-30000'].
|
## Defaults to ['20000-30000'].
|
||||||
## Example:
|
## Example:
|
||||||
## used_ports = [ '1024-2000', '9000', '9090' ]
|
## used_ports = [ '1024-2000', '9000', '9090' ]
|
||||||
used_ports = ['20000-30000']
|
used_ports = ['__USED_START_PORT__-__USED_END_PORT__']
|
||||||
|
|
||||||
## Defines a list of port numbers or ranges of server ports,
|
## Defines a list of port numbers or ranges of server ports,
|
||||||
## that would not be used for automatic and manual port assignment.
|
## that would not be used for automatic and manual port assignment.
|
||||||
|
|
|
@ -70,12 +70,18 @@ ynh_app_setting_set --app=$app --key=client_port --value=$client_port
|
||||||
ynh_script_progression --message="Configuring firewall..."
|
ynh_script_progression --message="Configuring firewall..."
|
||||||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $client_port
|
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $client_port
|
||||||
|
|
||||||
api_port=$(ynh_find_port --port=8195)
|
api_port=$(ynh_find_port --port=$(($client_port + 1)))
|
||||||
ynh_app_setting_set --app=$app --key=api_port --value=$api_port
|
ynh_app_setting_set --app=$app --key=api_port --value=$api_port
|
||||||
|
|
||||||
guacd_port=$(ynh_find_port --port=8295)
|
guacd_port=$(ynh_find_port --port=$(($api_port + 1)))
|
||||||
ynh_app_setting_set --app=$app --key=guacd_port --value=$guacd_port
|
ynh_app_setting_set --app=$app --key=guacd_port --value=$guacd_port
|
||||||
|
|
||||||
|
used_start_port=$(ynh_find_port --port=20000)
|
||||||
|
ynh_app_setting_set --app=$app --key=used_start_port --value=$used_start_port
|
||||||
|
used_end_port=$(ynh_find_port --port=30000)
|
||||||
|
ynh_app_setting_set --app=$app --key=used_end_port --value=$used_end_port
|
||||||
|
ynh_exec_warn_less yunohost firewall allow TCP $used_start_port:$used_end_port
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -197,7 +203,7 @@ ynh_use_logrotate
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add $app --log="/var/log/$app/$app.log" --needs_exposed_ports="$client_port"
|
yunohost service add $app --log="/var/log/$app/$app.log" --needs_exposed_ports="$client_port $used_start_port:$used_end_port"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
|
|
@ -18,6 +18,8 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
client_port=$(ynh_app_setting_get --app=$app --key=client_port)
|
client_port=$(ynh_app_setting_get --app=$app --key=client_port)
|
||||||
|
used_start_port=$(ynh_app_setting_get --app=$app --key=used_start_port)
|
||||||
|
used_end_port=$(ynh_app_setting_get --app=$app --key=used_end_port)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
@ -106,6 +108,12 @@ then
|
||||||
ynh_exec_warn_less yunohost firewall disallow TCP $client_port
|
ynh_exec_warn_less yunohost firewall disallow TCP $client_port
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if yunohost firewall list | grep -q "\- $used_start_port:$used_end_port$"
|
||||||
|
then
|
||||||
|
ynh_script_progression --message="Closing port $used_start_port:$used_end_port..."
|
||||||
|
ynh_exec_warn_less yunohost firewall disallow TCP $used_start_port:$used_end_port
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC REMOVE
|
# SPECIFIC REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -148,7 +148,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add $app --log="/var/log/$app/$app.log" --needs_exposed_ports="$client_port"
|
yunohost service add $app --log="/var/log/$app/$app.log" --needs_exposed_ports="$client_port $used_start_port:$used_end_port"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
|
|
@ -154,7 +154,7 @@ ynh_use_logrotate --non-append
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add $app --log="/var/log/$app/$app.log" --needs_exposed_ports="$client_port"
|
yunohost service add $app --log="/var/log/$app/$app.log" --needs_exposed_ports="$client_port $used_start_port:$used_end_port"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
|
Loading…
Add table
Reference in a new issue