mirror of
https://github.com/YunoHost-Apps/coturn_ynh.git
synced 2024-09-03 18:16:32 +02:00
commit
a5a2ee86ee
16 changed files with 86 additions and 433 deletions
19
README.md
19
README.md
|
@ -18,24 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
|||
|
||||
The TURN Server is a VoIP media traffic NAT traversal server and gateway. It can be used as a general-purpose network traffic TURN server and gateway, too.
|
||||
|
||||
**Shipped version:** 4.5.2.3~ynh2
|
||||
## Disclaimers / important information
|
||||
|
||||
## Configuration
|
||||
|
||||
You need to install TURN server in a root or subdomain like `turn.domain.tld`
|
||||
|
||||
How to configure this app: a plain file with SSH.
|
||||
|
||||
## Testing
|
||||
|
||||
For testing we can use Trickle-Ice testing tool. Go to [trickle-ice page](https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice) and enter following details.
|
||||
```
|
||||
TURN URI : turn:<YOUR_PUBLIC_IP_ADDRESS>:5349
|
||||
TURN username: <YOUR_USERNAME>
|
||||
TURN password: <YOUR_PASSWORD>
|
||||
```
|
||||
|
||||
**Shipped version:** 4.5.2.3~ynh3
|
||||
## Documentation and resources
|
||||
|
||||
* Official admin documentation: <https://github.com/coturn/coturn/wiki>
|
||||
|
|
19
README_fr.md
19
README_fr.md
|
@ -18,24 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
|
|||
|
||||
The TURN Server is a VoIP media traffic NAT traversal server and gateway. It can be used as a general-purpose network traffic TURN server and gateway, too.
|
||||
|
||||
**Version incluse :** 4.5.2.3~ynh2
|
||||
## Avertissements / informations importantes
|
||||
|
||||
## Configuration
|
||||
|
||||
Vous devez installer coTURN à la racine ou un sous-domaine comme `turn.domain.tld`
|
||||
|
||||
How to configure this app: a plain file with SSH.
|
||||
|
||||
## Testing
|
||||
|
||||
Pour les tests, vous pouvez utiliser l'outil de test Trickle-Ice. Accédez à la page [trickle-ice](https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice) et entrez les détails suivants.
|
||||
```
|
||||
TURN URI : turn:<YOUR_PUBLIC_IP_ADDRESS>:5349
|
||||
TURN username: <YOUR_USERNAME>
|
||||
TURN password: <YOUR_PASSWORD>
|
||||
```
|
||||
|
||||
**Version incluse :** 4.5.2.3~ynh3
|
||||
## Documentations et ressources
|
||||
|
||||
* Documentation officielle de l’admin : <https://github.com/coturn/coturn/wiki>
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# Check if the IP as not changed at every 15th minute
|
||||
*/15 * * * * root bash __DATA_PATH__/Coturn_config_rotate.sh >/dev/null 2>&1
|
||||
*/15 * * * * root bash __DATA_DIR__/Coturn_config_rotate.sh >/dev/null 2>&1
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
# TLS version 1.0, 1.1 and 1.2.
|
||||
# For secure UDP connections, Coturn supports DTLS version 1.
|
||||
#
|
||||
tls-listening-port=__TURNSERVER_TLS_PORT__
|
||||
tls-listening-port=__PORT_TURNSERVER_TLS__
|
||||
|
||||
# Alternative listening port for UDP and TCP listeners;
|
||||
# default (or zero) value means "listening port plus one".
|
||||
|
@ -43,7 +43,7 @@ tls-listening-port=__TURNSERVER_TLS_PORT__
|
|||
# Alternative listening port for TLS and DTLS protocols.
|
||||
# Default (or zero) value means "TLS listening port plus one".
|
||||
#
|
||||
alt-tls-listening-port=__TURNSERVER_ALT_TLS_PORT__
|
||||
alt-tls-listening-port=__PORT_TURNSERVER_ALT_TLS__
|
||||
|
||||
# Some network setups will require using a TCP reverse proxy in front
|
||||
# of the STUN server. If the proxy port option is set a single listener
|
||||
|
@ -690,7 +690,7 @@ no-cli
|
|||
|
||||
# CLI server port. Default is 5766.
|
||||
#
|
||||
cli-port=__CLI_PORT__
|
||||
cli-port=__PORT_CLI__
|
||||
|
||||
# CLI access password. Default is empty (no password).
|
||||
# For the security reasons, it is recommended that you use the encrypted
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
## Configuration
|
||||
|
||||
You need to install TURN server in a root or subdomain like `turn.domain.tld`
|
||||
You need to install TURN server in a root or subdomain like `__DOMAIN__`
|
||||
|
||||
How to configure this app: a plain file with SSH.
|
||||
|
|
@ -1,14 +1,12 @@
|
|||
## Configuration
|
||||
|
||||
Vous devez installer coTURN à la racine ou un sous-domaine comme `turn.domain.tld`
|
||||
|
||||
How to configure this app: a plain file with SSH.
|
||||
Vous devez installer coTURN à la racine ou un sous-domaine comme `__DOMAIN__`
|
||||
|
||||
## Testing
|
||||
|
||||
Pour les tests, vous pouvez utiliser l'outil de test Trickle-Ice. Accédez à la page [trickle-ice](https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice) et entrez les détails suivants.
|
||||
```
|
||||
TURN URI : turn:<YOUR_PUBLIC_IP_ADDRESS>:5349
|
||||
TURN URI : turn:__DOMAIN__:5349
|
||||
TURN username: <YOUR_USERNAME>
|
||||
TURN password: <YOUR_PASSWORD>
|
||||
```
|
5
doc/POST_INSTALL.md
Normal file
5
doc/POST_INSTALL.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
For testing we can use Trickle-Ice testing tool. Go to trickle-ice page https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/ and enter following details.
|
||||
|
||||
STUN or TURN URI: turn:__DOMAIN__:__PORT_TURNSERVER_TLS__
|
||||
TURN username: turnserver
|
||||
TURN password: __TURNSERVER_PWD__
|
|
@ -1,35 +0,0 @@
|
|||
{
|
||||
"name": "Coturn",
|
||||
"id": "coturn",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "VoIP media traffic NAT traversal server and gateway",
|
||||
"fr": "Serveur et passerelle NAT du trafic média VoIP"
|
||||
},
|
||||
"version": "4.5.2.3~ynh2",
|
||||
"url": "https://github.com/coturn/coturn",
|
||||
"upstream": {
|
||||
"license": "BSD-3-Clause",
|
||||
"admindoc": "https://github.com/coturn/coturn/wiki",
|
||||
"code": "https://github.com/coturn/coturn",
|
||||
"cpe": "cpe:2.3:a:coturn_project:coturn"
|
||||
},
|
||||
"license": "BSD-3-Clause",
|
||||
"maintainer": {
|
||||
"name": "eric_G",
|
||||
"email": ""
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 11.0.9"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"services": [],
|
||||
"arguments": {
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
48
manifest.toml
Normal file
48
manifest.toml
Normal file
|
@ -0,0 +1,48 @@
|
|||
packaging_format = 2
|
||||
|
||||
id = "coturn"
|
||||
name = "Coturn"
|
||||
description.en = "VoIP media traffic NAT traversal server and gateway"
|
||||
description.fr = "Serveur et passerelle NAT du trafic média VoIP"
|
||||
|
||||
version = "4.5.2.3~ynh3"
|
||||
|
||||
maintainers = ["eric_G"]
|
||||
|
||||
[upstream]
|
||||
license = "BSD-3-Clause"
|
||||
admindoc = "https://github.com/coturn/coturn/wiki"
|
||||
code = "https://github.com/coturn/coturn"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.1.19"
|
||||
architectures = "all"
|
||||
multi_instance = false
|
||||
ldap = "not_relevant"
|
||||
sso = "not_relevant"
|
||||
disk = "50M"
|
||||
ram.build = "50M"
|
||||
ram.runtime = "50M"
|
||||
|
||||
[install.domain]
|
||||
type = "domain"
|
||||
full_domain = true
|
||||
|
||||
[resources]
|
||||
[resources.ports]
|
||||
turnserver_tls.default = 5349
|
||||
turnserver_tls.exposed = "Both"
|
||||
turnserver_alt_tls.default = 5350
|
||||
turnserver_alt_tls.exposed = "Both"
|
||||
cli.default = 5766
|
||||
|
||||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
|
||||
[resources.data_dir]
|
||||
|
||||
[resources.permissions]
|
||||
|
||||
[resources.apt]
|
||||
packages = "sqlite3 libsqlite3-dev coturn acl"
|
|
@ -4,9 +4,6 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="sqlite3 libsqlite3-dev coturn acl"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
@ -14,140 +11,3 @@ pkg_dependencies="sqlite3 libsqlite3-dev coturn acl"
|
|||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
# Send an email to inform the administrator
|
||||
#
|
||||
# usage: ynh_send_readme_to_admin --app_message=app_message [--recipients=recipients] [--type=type]
|
||||
# | arg: -m --app_message= - The file with the content to send to the administrator.
|
||||
# | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root
|
||||
# example: "root admin@domain"
|
||||
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
|
||||
# example: "root admin@domain user1 user2"
|
||||
# | arg: -t, --type= - Type of mail, could be 'backup', 'change_url', 'install', 'remove', 'restore', 'upgrade'
|
||||
ynh_send_readme_to_admin() {
|
||||
# Declare an array to define the options of this helper.
|
||||
declare -Ar args_array=( [m]=app_message= [r]=recipients= [t]=type= )
|
||||
local app_message
|
||||
local recipients
|
||||
local type
|
||||
# Manage arguments with getopts
|
||||
|
||||
ynh_handle_getopts_args "$@"
|
||||
app_message="${app_message:-}"
|
||||
recipients="${recipients:-root}"
|
||||
type="${type:-install}"
|
||||
|
||||
# Get the value of admin_mail_html
|
||||
admin_mail_html=$(ynh_app_setting_get $app admin_mail_html)
|
||||
admin_mail_html="${admin_mail_html:-0}"
|
||||
|
||||
# Retrieve the email of users
|
||||
find_mails () {
|
||||
local list_mails="$1"
|
||||
local mail
|
||||
local recipients=" "
|
||||
# Read each mail in argument
|
||||
for mail in $list_mails
|
||||
do
|
||||
# Keep root or a real email address as it is
|
||||
if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@"
|
||||
then
|
||||
recipients="$recipients $mail"
|
||||
else
|
||||
# But replace an user name without a domain after by its email
|
||||
if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null)
|
||||
then
|
||||
recipients="$recipients $mail"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo "$recipients"
|
||||
}
|
||||
recipients=$(find_mails "$recipients")
|
||||
|
||||
# Subject base
|
||||
local mail_subject="☁️🆈🅽🅷☁️: \`$app\`"
|
||||
|
||||
# Adapt the subject according to the type of mail required.
|
||||
if [ "$type" = "backup" ]; then
|
||||
mail_subject="$mail_subject has just been backup."
|
||||
elif [ "$type" = "change_url" ]; then
|
||||
mail_subject="$mail_subject has just been moved to a new URL!"
|
||||
elif [ "$type" = "remove" ]; then
|
||||
mail_subject="$mail_subject has just been removed!"
|
||||
elif [ "$type" = "restore" ]; then
|
||||
mail_subject="$mail_subject has just been restored!"
|
||||
elif [ "$type" = "upgrade" ]; then
|
||||
mail_subject="$mail_subject has just been upgraded!"
|
||||
else # install
|
||||
mail_subject="$mail_subject has just been installed!"
|
||||
fi
|
||||
|
||||
local mail_message="Specific information for the application $app.
|
||||
|
||||
$(if [ -n "$app_message" ]
|
||||
then
|
||||
cat "$app_message"
|
||||
else
|
||||
echo "...No specific information..."
|
||||
fi)
|
||||
|
||||
---
|
||||
Automatic diagnosis data from YunoHost
|
||||
|
||||
__PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')__PRE_TAG2__"
|
||||
|
||||
# Store the message into a file for further modifications.
|
||||
echo "$mail_message" > mail_to_send
|
||||
|
||||
# If a html email is required. Apply html tags to the message.
|
||||
if [ "$admin_mail_html" -eq 1 ]
|
||||
then
|
||||
# Insert 'br' tags at each ending of lines.
|
||||
ynh_replace_string "$" "<br>" mail_to_send
|
||||
|
||||
# Insert starting HTML tags
|
||||
sed --in-place '1s@^@<!DOCTYPE html>\n<html>\n<head></head>\n<body>\n@' mail_to_send
|
||||
|
||||
# Keep tabulations
|
||||
ynh_replace_string " " "\ \ " mail_to_send
|
||||
ynh_replace_string "\t" "\ \ " mail_to_send
|
||||
|
||||
# Insert url links tags
|
||||
ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "<a href=\"\2\">\1</a>" mail_to_send
|
||||
|
||||
# Insert pre tags
|
||||
ynh_replace_string "__PRE_TAG1__" "<pre>" mail_to_send
|
||||
ynh_replace_string "__PRE_TAG2__" "<\pre>" mail_to_send
|
||||
|
||||
# Insert finishing HTML tags
|
||||
echo -e "\n</body>\n</html>" >> mail_to_send
|
||||
|
||||
# Otherwise, remove tags to keep a plain text.
|
||||
else
|
||||
# Remove URL tags
|
||||
ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send
|
||||
ynh_replace_string "__URL_TAG2__" ": " mail_to_send
|
||||
|
||||
# Remove PRE tags
|
||||
ynh_replace_string "__PRE_TAG[1-2]__" "" mail_to_send
|
||||
fi
|
||||
|
||||
# Define binary to use for mail command
|
||||
if [ -e /usr/bin/bsd-mailx ]
|
||||
then
|
||||
local mail_bin=/usr/bin/bsd-mailx
|
||||
else
|
||||
local mail_bin=/usr/bin/mail.mailutils
|
||||
fi
|
||||
|
||||
if [ "$admin_mail_html" -eq 1 ]
|
||||
then
|
||||
content_type="text/html"
|
||||
else
|
||||
content_type="text/plain"
|
||||
fi
|
||||
|
||||
# Send the email to the recipients
|
||||
cat mail_to_send | $mail_bin -a "Content-Type: $content_type; charset=UTF-8" -s "$mail_subject" "$recipients"
|
||||
}
|
||||
|
|
|
@ -10,22 +10,6 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
|
@ -41,7 +25,7 @@ ynh_backup --src_path="/etc/turnserver.conf"
|
|||
# BACKUP THE COTURN DATAPATH
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/home/yunohost.app/$app"
|
||||
ynh_backup --src_path="$data_dir"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
|
|
|
@ -9,27 +9,10 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..." --weight=4
|
||||
|
||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
ynh_app_setting_set --app=$app --key=no_sso --value=true
|
||||
|
||||
#=================================================
|
||||
|
@ -48,41 +31,12 @@ then
|
|||
chmod 640 /etc/ssl/private/dh2048.pem
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Finding an available port..." --weight=3
|
||||
|
||||
# Find an available port
|
||||
turnserver_tls_port=$(ynh_find_port --port=5349)
|
||||
turnserver_alt_tls_port=$(ynh_find_port --port=$((turnserver_tls_port+1)))
|
||||
cli_port=$(ynh_find_port --port=5766)
|
||||
|
||||
# Open the port
|
||||
ynh_exec_warn_less yunohost firewall allow Both $turnserver_tls_port
|
||||
ynh_exec_warn_less yunohost firewall allow Both $turnserver_alt_tls_port
|
||||
|
||||
# Store opened ports
|
||||
ynh_app_setting_set --app=$app --key=turnserver_tls_port --value=$turnserver_tls_port
|
||||
ynh_app_setting_set --app=$app --key=turnserver_alt_tls_port --value=$turnserver_alt_tls_port
|
||||
ynh_app_setting_set --app=$app --key=cli_port --value=$cli_port
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=5
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=3
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=turnserver
|
||||
adduser turnserver ssl-cert
|
||||
|
||||
#=================================================
|
||||
|
@ -130,11 +84,10 @@ ynh_store_file_checksum --file="$coturn_config_path"
|
|||
|
||||
# WARNING : theses command are used in INSTALL, UPGRADE
|
||||
# For any update do it in all files
|
||||
data_path="/home/yunohost.app/$app"
|
||||
mkdir -p $data_path
|
||||
cp -f ../sources/Coturn_config_rotate.sh $data_path/
|
||||
ynh_replace_string --match_string="__APP__" --replace_string=$app --target_file=$data_path/Coturn_config_rotate.sh
|
||||
chmod +x $data_path/Coturn_config_rotate.sh
|
||||
cp -f ../sources/Coturn_config_rotate.sh $data_dir/
|
||||
ynh_replace_string --match_string="__APP__" --replace_string=$app --target_file=$data_dir/Coturn_config_rotate.sh
|
||||
|
||||
chmod +x $data_dir/Coturn_config_rotate.sh
|
||||
|
||||
#=================================================
|
||||
# SET COTURN CRON
|
||||
|
@ -156,7 +109,7 @@ ynh_use_logrotate --logfile "/var/log/$app"
|
|||
#=================================================
|
||||
|
||||
# Set permissions to app files
|
||||
chown root: -R $data_path
|
||||
chown root: -R $data_dir
|
||||
chown -R turnserver:root /var/log/$app
|
||||
chown turnserver:root /etc/turnserver.conf
|
||||
setfacl -R -m user:turnserver:rwX /var/log/$app
|
||||
|
@ -166,7 +119,7 @@ setfacl -R -m user:turnserver:rwX /var/log/$app
|
|||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=2
|
||||
|
||||
yunohost service add $app --description="Coturn TURN server" --log="/var/log/$app/$app.log" --needs_exposed_ports="$turnserver_tls_port"
|
||||
yunohost service add $app --description="Coturn TURN server" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port_turnserver_tls"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
@ -176,25 +129,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action=restart --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# SEND A README FOR THE ADMIN
|
||||
#=================================================
|
||||
|
||||
# WARNING : theses command are used in INSTALL, RESTORE
|
||||
# For any update do it in all files
|
||||
|
||||
echo "Coturn server was successfully installed :)
|
||||
|
||||
For testing we can use Trickle-Ice testing tool. Go to trickle-ice page https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/ and enter following details.
|
||||
|
||||
STUN or TURN URI: turn:$domain:$turnserver_tls_port
|
||||
TURN username: turnserver
|
||||
TURN password: $turnserver_pwd
|
||||
|
||||
If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/coturn_ynh" > mail_to_send
|
||||
|
||||
ynh_send_readme_to_admin --app_message="mail_to_send" --type="install"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -9,17 +9,6 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
turnserver_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_tls_port)
|
||||
turnserver_alt_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_alt_tls_port)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
|
@ -41,14 +30,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
|
|||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
|
@ -84,22 +65,6 @@ ynh_secure_remove --file=/var/log/$app
|
|||
# Remove the sqlitedb file
|
||||
#ynh_secure_remove --file=/var/lib/turn
|
||||
|
||||
#=================================================
|
||||
# CLOSE PORTS
|
||||
#=================================================
|
||||
|
||||
if yunohost firewall list | grep -q "\- $turnserver_tls_port$"
|
||||
then
|
||||
ynh_script_progression --message="Closing port $turnserver_tls_port..." --weight=1
|
||||
ynh_exec_warn_less yunohost firewall disallow Both $turnserver_tls_port
|
||||
fi
|
||||
|
||||
if yunohost firewall list | grep -q "\- $turnserver_alt_tls_port$"
|
||||
then
|
||||
ynh_script_progression --message="Closing port $turnserver_alt_tls_port..." --weight=1
|
||||
ynh_exec_warn_less yunohost firewall disallow Both $turnserver_alt_tls_port
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
@ -109,7 +74,6 @@ ynh_script_progression --message="Removing the dedicated system user..." --weigh
|
|||
|
||||
# Delete a system user
|
||||
deluser turnserver ssl-cert
|
||||
ynh_system_user_delete --username=turnserver
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -9,31 +9,6 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
turnserver_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_tls_port)
|
||||
turnserver_alt_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_alt_tls_port)
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=5
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE COTURN CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -60,7 +35,6 @@ ynh_restore_file --origin_path="/var/log/$app"
|
|||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=turnserver
|
||||
adduser turnserver ssl-cert
|
||||
|
||||
#=================================================
|
||||
|
@ -90,16 +64,6 @@ chown -R turnserver:root /var/log/$app
|
|||
chown turnserver:root /etc/turnserver.conf
|
||||
setfacl -R -m user:turnserver:rwX /var/log/$app
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
|
@ -113,15 +77,7 @@ systemctl enable $app.service --quiet
|
|||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
|
||||
yunohost service add $app --description="Coturn TURN server" --log="/var/log/$app/$app.log" --needs_exposed_ports="$turnserver_tls_port"
|
||||
|
||||
#=================================================
|
||||
# OPEN THE PORT
|
||||
#=================================================
|
||||
|
||||
# Ouvre le port dans le firewall
|
||||
ynh_exec_warn_less yunohost firewall allow Both $turnserver_tls_port
|
||||
ynh_exec_warn_less yunohost firewall allow Both $turnserver_alt_tls_port
|
||||
yunohost service add $app --description="Coturn TURN server" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port_turnserver_tls"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
|
|
@ -9,40 +9,12 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
turnserver_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_tls_port)
|
||||
turnserver_alt_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_alt_tls_port)
|
||||
cli_port=$(ynh_app_setting_get --app=$app --key=cli_port)
|
||||
turnserver_pwd=$(ynh_app_setting_get --app=$app --key=turnserver_pwd)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
|
@ -52,20 +24,12 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
|||
|
||||
ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=turnserver
|
||||
adduser turnserver ssl-cert
|
||||
|
||||
#=================================================
|
||||
|
@ -76,6 +40,7 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
|||
mkdir -p /var/log/$app
|
||||
# Create systemd service for turnserver
|
||||
cp ../conf/default.coturn /etc/default/coturn
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
|
@ -109,11 +74,10 @@ ynh_store_file_checksum --file="$coturn_config_path"
|
|||
|
||||
# WARNING : theses command are used in INSTALL, UPGRADE
|
||||
# For any update do it in all files
|
||||
data_path="/home/yunohost.app/$app"
|
||||
mkdir -p $data_path
|
||||
cp -f ../sources/Coturn_config_rotate.sh $data_path/
|
||||
ynh_replace_string --match_string="__APP__" --replace_string=$app --target_file=$data_path/Coturn_config_rotate.sh
|
||||
chmod +x $data_path/Coturn_config_rotate.sh
|
||||
cp -f ../sources/Coturn_config_rotate.sh $data_dir/
|
||||
ynh_replace_string --match_string="__APP__" --replace_string=$app --target_file=$data_dir/Coturn_config_rotate.sh
|
||||
|
||||
chmod +x $data_dir/Coturn_config_rotate.sh
|
||||
|
||||
#=================================================
|
||||
# SET COTURN CRON
|
||||
|
@ -147,7 +111,7 @@ ynh_use_logrotate --logfile "/var/log/$app"
|
|||
#=================================================
|
||||
|
||||
# Set permissions to app files
|
||||
chown root: -R $data_path
|
||||
chown root: -R $data_dir
|
||||
chown -R turnserver:root /var/log/$app
|
||||
chown turnserver:root /etc/turnserver.conf
|
||||
setfacl -R -m user:turnserver:rwX /var/log/$app
|
||||
|
@ -157,7 +121,7 @@ setfacl -R -m user:turnserver:rwX /var/log/$app
|
|||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=2
|
||||
|
||||
yunohost service add $app --description="Coturn TURN server" --log="/var/log/$app/$app.log" --needs_exposed_ports="$turnserver_tls_port"
|
||||
yunohost service add $app --description="Coturn TURN server" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port_turnserver_tls"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
|
9
tests.toml
Normal file
9
tests.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
test_format = 1.0
|
||||
|
||||
[default]
|
||||
|
||||
# ------------
|
||||
# Tests to run
|
||||
# ------------
|
||||
|
||||
test_upgrade_from.2b6e951d.name = "Upgrade from 4.5.2.3"
|
Loading…
Add table
Reference in a new issue