1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/coturn_ynh.git synced 2024-09-03 18:16:32 +02:00
This commit is contained in:
Éric Gaspar 2023-03-12 11:55:41 +01:00
parent 73385b7bb0
commit dacea63b18
7 changed files with 102 additions and 62 deletions

40
manifest.toml Normal file
View file

@ -0,0 +1,40 @@
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~ynh1"
maintainers = ["eric_G"]
[upstream]
license = "BSD-3-Clause"
admindoc = "https://github.com/coturn/coturn/wiki"
code = "https://github.com/coturn/coturn"
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
website = "https://github.com/coturn/coturn"
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
[integration]
yunohost = ">= 11.0.9"
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
multi_instance = false
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
[install.domain]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "domain"
full_domain = true
[resources]
[resources.system_user]
[resources.install_dir]
[resources.permissions]

View file

@ -5,7 +5,7 @@
#================================================= #=================================================
# dependencies used by the app # dependencies used by the app
pkg_dependencies="sqlite3 libsqlite3-dev coturn acl" #REMOVEME? pkg_dependencies="sqlite3 libsqlite3-dev coturn acl"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
@ -38,7 +38,7 @@ ynh_send_readme_to_admin() {
type="${type:-install}" type="${type:-install}"
# Get the value of admin_mail_html # Get the value of admin_mail_html
admin_mail_html=$(ynh_app_setting_get $app admin_mail_html) #REMOVEME? admin_mail_html=$(ynh_app_setting_get $app admin_mail_html)
admin_mail_html="${admin_mail_html:-0}" admin_mail_html="${admin_mail_html:-0}"
# Retrieve the email of users # Retrieve the email of users

View file

@ -14,17 +14,17 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_abort_if_errors #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info --message="Loading installation settings..." #REMOVEME? ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
domain=$(ynh_app_setting_get --app=$app --key=domain) #REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#================================================= #=================================================
# DECLARE DATA AND CONF FILES TO BACKUP # DECLARE DATA AND CONF FILES TO BACKUP

View file

@ -14,22 +14,22 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#================================================= #=================================================
domain=$YNH_APP_ARG_DOMAIN #REMOVEME? domain=$YNH_APP_ARG_DOMAIN
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." --weight=4 #REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=4
ynh_app_setting_set --app=$app --key=domain --value=$domain #REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=no_sso --value=true ynh_app_setting_set --app=$app --key=no_sso --value=true
#================================================= #=================================================
@ -53,36 +53,36 @@ fi
#================================================= #=================================================
# FIND AND OPEN A PORT # FIND AND OPEN A PORT
#================================================= #=================================================
ynh_script_progression --message="Finding an available port..." --weight=3 #REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=3
# Find an available port # Find an available port
turnserver_tls_port=$(ynh_find_port --port=5349) #REMOVEME? turnserver_tls_port=$(ynh_find_port --port=5349)
turnserver_alt_tls_port=$(ynh_find_port --port=$((turnserver_tls_port+1))) #REMOVEME? turnserver_alt_tls_port=$(ynh_find_port --port=$((turnserver_tls_port+1)))
cli_port=$(ynh_find_port --port=5766) #REMOVEME? cli_port=$(ynh_find_port --port=5766)
# Open the port # Open the port
ynh_exec_warn_less yunohost firewall allow Both $turnserver_tls_port ynh_exec_warn_less yunohost firewall allow Both $turnserver_tls_port
ynh_exec_warn_less yunohost firewall allow Both $turnserver_alt_tls_port ynh_exec_warn_less yunohost firewall allow Both $turnserver_alt_tls_port
# Store opened ports # Store opened ports
ynh_app_setting_set --app=$app --key=turnserver_tls_port --value=$turnserver_tls_port #REMOVEME? 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 #REMOVEME? 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 #REMOVEME? ynh_app_setting_set --app=$app --key=cli_port --value=$cli_port
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --weight=5 #REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=5
ynh_install_app_dependencies $pkg_dependencies #REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Configuring system user..." --weight=3 #REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=3
# Create a system user # Create a system user
ynh_system_user_create --username=turnserver #REMOVEME? ynh_system_user_create --username=turnserver
adduser turnserver ssl-cert adduser turnserver ssl-cert
#================================================= #=================================================

View file

@ -12,13 +12,13 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 #REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) #REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
turnserver_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_tls_port) #REMOVEME? 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) #REMOVEME? turnserver_alt_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_alt_tls_port)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
@ -44,10 +44,10 @@ ynh_remove_systemd_config
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1 #REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_app_dependencies #REMOVEME? ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
@ -105,11 +105,11 @@ fi
#================================================= #=================================================
# REMOVE DEDICATED USER # REMOVE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Removing the dedicated system user..." --weight=1 #REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user # Delete a system user
deluser turnserver ssl-cert deluser turnserver ssl-cert
ynh_system_user_delete --username=turnserver #REMOVEME? ynh_system_user_delete --username=turnserver
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -13,26 +13,26 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_abort_if_errors #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 #REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) #REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
turnserver_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_tls_port) #REMOVEME? 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) #REMOVEME? turnserver_alt_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_alt_tls_port)
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --weight=5 #REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=5
ynh_install_app_dependencies $pkg_dependencies #REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# RESTORE COTURN CONFIGURATION # RESTORE COTURN CONFIGURATION
@ -57,10 +57,10 @@ ynh_restore_file --origin_path="/var/log/$app"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 #REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create --username=turnserver #REMOVEME? ynh_system_user_create --username=turnserver
adduser turnserver ssl-cert adduser turnserver ssl-cert
#================================================= #=================================================
@ -95,10 +95,10 @@ setfacl -R -m user:turnserver:rwX /var/log/$app
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1 #REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies # Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies #REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD

View file

@ -12,16 +12,16 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 #REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) #REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
turnserver_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_tls_port) #REMOVEME? 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) #REMOVEME? 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) #REMOVEME? cli_port=$(ynh_app_setting_get --app=$app --key=cli_port)
turnserver_pwd=$(ynh_app_setting_get --app=$app --key=turnserver_pwd) #REMOVEME? turnserver_pwd=$(ynh_app_setting_get --app=$app --key=turnserver_pwd)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -32,16 +32,16 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 #REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade #REMOVEME? ynh_backup_before_upgrade
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
# Restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup #REMOVEME? ynh_restore_upgradebackup
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
@ -55,17 +55,17 @@ ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1 #REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies #REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 #REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
ynh_system_user_create --username=turnserver #REMOVEME? ynh_system_user_create --username=turnserver
adduser turnserver ssl-cert adduser turnserver ssl-cert
#================================================= #=================================================