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:
YunoHost Bot 2024-08-31 12:58:47 +02:00 committed by GitHub
commit 9e2d9a03f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 74 additions and 128 deletions

View file

@ -15,7 +15,8 @@ admindoc = "https://github.com/coturn/coturn/wiki"
code = "https://github.com/coturn/coturn" code = "https://github.com/coturn/coturn"
[integration] [integration]
yunohost = ">= 11.2" yunohost = ">= 11.2.18"
helpers_version = "2.1"
architectures = "all" architectures = "all"
multi_instance = false multi_instance = false

View file

@ -1,13 +1,5 @@
#!/bin/bash #!/bin/bash
#================================================= #=================================================
# COMMON VARIABLES # COMMON VARIABLES AND CUSTOM HELPERS
#=================================================
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#================================================= #=================================================

View file

@ -1,31 +1,22 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= ynh_print_info "Declaring files to be backed up..."
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#================================================= #=================================================
# BACKUP THE COTURN CONFIGURATION # BACKUP THE COTURN CONFIGURATION
#================================================= #=================================================
ynh_backup --src_path="/etc/turnserver.conf" ynh_backup "/etc/turnserver.conf"
#================================================= #=================================================
# BACKUP THE COTURN DATAPATH # BACKUP THE COTURN DATAPATH
#================================================= #=================================================
ynh_backup --src_path="$data_dir" ynh_backup "$data_dir"
#================================================= #=================================================
# SPECIFIC BACKUP # SPECIFIC BACKUP
@ -33,18 +24,18 @@ ynh_backup --src_path="$data_dir"
# BACKUP LOGROTATE # BACKUP LOGROTATE
#================================================= #=================================================
ynh_backup --src_path="/var/log/$app" ynh_backup "/var/log/$app"
ynh_backup --src_path="/etc/cron.d/$app" ynh_backup "/etc/cron.d/$app"
#================================================= #=================================================
# BACKUP SYSTEMD # BACKUP SYSTEMD
#================================================= #=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service" ynh_backup "/etc/systemd/system/$app.service"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -1,11 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -13,17 +7,17 @@ source /usr/share/yunohost/helpers
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_app_setting_set --app=$app --key=no_sso --value=true ynh_app_setting_set --key=no_sso --value=true
#================================================= #=================================================
# CREATE A DH FILE # CREATE A DH FILE
#================================================= #=================================================
ynh_script_progression --message="Creating a dhparam file..." --weight=3 ynh_script_progression "Creating a dhparam file..."
# Make dhparam cert for Coturn if it doesn't exist # Make dhparam cert for Coturn if it doesn't exist
if [ ! -e /etc/ssl/private/dh2048.pem ] if [ ! -e /etc/ssl/private/dh2048.pem ]
then then
ynh_exec_warn_less openssl dhparam -out /etc/ssl/private/dh2048.pem -outform PEM -dsaparam 2048 ynh_hide_warnings openssl dhparam -out /etc/ssl/private/dh2048.pem -outform PEM -dsaparam 2048
chown root:ssl-cert /etc/ssl/private/dh2048.pem chown root:ssl-cert /etc/ssl/private/dh2048.pem
chmod 640 /etc/ssl/private/dh2048.pem chmod 640 /etc/ssl/private/dh2048.pem
fi fi
@ -31,7 +25,7 @@ fi
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Configuring system user..." --weight=3 ynh_script_progression "Configuring system user..."
# Create a system user # Create a system user
adduser turnserver ssl-cert adduser turnserver ssl-cert
@ -39,40 +33,40 @@ adduser turnserver ssl-cert
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1 ynh_script_progression "Configuring $app's systemd service..."
mkdir -p /var/log/$app mkdir -p /var/log/$app
# Create systemd service for turnserver # Create systemd service for turnserver
ynh_add_config --template="default.coturn" --destination="/etc/default/coturn" ynh_config_add --template="default.coturn" --destination="/etc/default/coturn"
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_config_add_systemd
#================================================= #=================================================
# SET COTURN CONFIG # SET COTURN CONFIG
#================================================= #=================================================
ynh_script_progression --message="Configuring Coturn..." --weight=1 ynh_script_progression "Configuring Coturn..."
# Find password for turnserver # Find password for turnserver
turnserver_pwd=$(ynh_string_random --length=30) turnserver_pwd=$(ynh_string_random --length=30)
ynh_app_setting_set --app=$app --key=turnserver_pwd --value=$turnserver_pwd ynh_app_setting_set --key=turnserver_pwd --value=$turnserver_pwd
coturn_config_path="/etc/turnserver.conf" coturn_config_path="/etc/turnserver.conf"
ynh_add_config --template="turnserver.conf" --destination="$coturn_config_path" ynh_config_add --template="turnserver.conf" --destination="$coturn_config_path"
# Get public IP and set as external IP for coturn # Get public IP and set as external IP for coturn
# note: '|| true' is used to ignore the errors if we can't get the public ipv4 or ipv6 # note: '|| true' is used to ignore the errors if we can't get the public ipv4 or ipv6
public_ip4="$(curl -s ip.yunohost.org)" || true public_ip4="$(curl -s ip.yunohost.org)" || true
public_ip6="$(curl -s ipv6.yunohost.org)" || true public_ip6="$(curl -s ipv6.yunohost.org)" || true
if ( [[ -n "$public_ip4" ]] && ynh_validate_ip4 --ip_address="$public_ip4" || [[ -n "$public_ip6" ]] && ynh_validate_ip6 --ip_address="$public_ip6" ) if ( [[ -n "$public_ip4" ]] && ynh_validate_ip --family=4 --ip_address="$public_ip4" || [[ -n "$public_ip6" ]] && ynh_validate_ip6 --ip_address="$public_ip6" )
then then
echo "external-ip=${public_ip4}/${public_ip6}" >> "$coturn_config_path" echo "external-ip=${public_ip4}/${public_ip6}" >> "$coturn_config_path"
fi fi
ynh_store_file_checksum --file="$coturn_config_path" ynh_store_file_checksum "$coturn_config_path"
#================================================= #=================================================
# ADD SCRIPT FOR COTURN CRON # ADD SCRIPT FOR COTURN CRON
@ -80,7 +74,7 @@ ynh_store_file_checksum --file="$coturn_config_path"
# For any update do it in all files # For any update do it in all files
cp -f ../sources/Coturn_config_rotate.sh $data_dir/ 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 ynh_replace --match="__APP__" --replace=$app --file=$data_dir/Coturn_config_rotate.sh
chmod +x $data_dir/Coturn_config_rotate.sh chmod +x $data_dir/Coturn_config_rotate.sh
@ -88,44 +82,42 @@ chmod +x $data_dir/Coturn_config_rotate.sh
# SET COTURN CRON # SET COTURN CRON
#================================================= #=================================================
ynh_add_config --template="cron_coturn" --destination="/etc/cron.d/$app" ynh_config_add --template="cron_coturn" --destination="/etc/cron.d/$app"
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
#================================================= #=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1 ynh_script_progression "Configuring log rotation..."
ynh_use_logrotate --logfile "/var/log/$app" ynh_config_add_logrotate "/var/log/$app"
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
# Set permissions to app files # Set permissions to app files
chown root: -R $data_dir chown root: -R $data_dir
chown -R turnserver:root /var/log/$app #REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R turnserver:root /var/log/$app
chown turnserver:root /etc/turnserver.conf chown turnserver:root /etc/turnserver.conf
setfacl -R -m user:turnserver:rwX /var/log/$app setfacl -R -m user:turnserver:rwX /var/log/$app
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=2 ynh_script_progression "Integrating service in YunoHost..."
yunohost service add $app --description="Coturn TURN server" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port_turnserver_tls" yunohost service add $app --description="Coturn TURN server" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port_turnserver_tls"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression "Starting $app's systemd service..."
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action=restart --log_path="/var/log/$app/$app.log" ynh_systemctl --service=$app --action=restart
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of Coturn completed" --last ynh_script_progression "Installation of Coturn completed"

View file

@ -1,11 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -14,32 +8,30 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST # REMOVE SERVICE INTEGRATION IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 ynh_script_progression "Removing system configurations related to $app..."
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) # Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null if ynh_hide_warnings yunohost service status $app >/dev/null
then then
ynh_script_progression --message="Removing $app service integration..." --weight=1 ynh_script_progression "Removing $app service integration..."
yunohost service remove $app yunohost service remove $app
fi fi
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_config_remove_systemd
ynh_secure_remove --file="/etc/turnserver.conf" ynh_safe_rm "/etc/turnserver.conf"
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
ynh_remove_logrotate ynh_config_remove_logrotate
# Remove a cron file # Remove a cron file
ynh_secure_remove --file=/etc/cron.d/$app ynh_safe_rm /etc/cron.d/$app
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# REMOVE DEDICATED USER # REMOVE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Removing the dedicated system user..." --weight=1 ynh_script_progression "Removing the dedicated system user..."
# Delete a system user # Delete a system user
deluser turnserver ssl-cert deluser turnserver ssl-cert
@ -48,4 +40,4 @@ deluser turnserver ssl-cert
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Removal of $app completed" --last ynh_script_progression "Removal of $app completed"

View file

@ -1,27 +1,21 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# RESTORE COTURN CONFIGURATION # RESTORE COTURN CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restoring Coturn configuration..." --weight=1 ynh_script_progression "Restoring Coturn configuration..."
ynh_restore_file --origin_path="/etc/turnserver.conf" ynh_restore "/etc/turnserver.conf"
#================================================= #=================================================
# RESTORE THE COTURN DATAPATH # RESTORE THE COTURN DATAPATH
#================================================= #=================================================
ynh_script_progression --message="Restoring the data directory..." --weight=1 ynh_script_progression "Restoring the data directory..."
ynh_restore_file --origin_path="$data_dir" --not_mandatory ynh_restore "$data_dir"
# (Same as for install dir) # (Same as for install dir)
chown -R $app:www-data "$data_dir" chown -R $app:www-data "$data_dir"
@ -30,12 +24,12 @@ chown -R $app:www-data "$data_dir"
# RESTORE LOG # RESTORE LOG
#================================================= #=================================================
ynh_restore_file --origin_path="/var/log/$app" ynh_restore "/var/log/$app"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 ynh_script_progression "Recreating the dedicated system user..."
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
adduser turnserver ssl-cert adduser turnserver ssl-cert
@ -43,12 +37,12 @@ adduser turnserver ssl-cert
#================================================= #=================================================
# RECREATE A DH FILE # RECREATE A DH FILE
#================================================= #=================================================
ynh_script_progression --message="Creating a dhparam file..." --weight=3 ynh_script_progression "Creating a dhparam file..."
# Make dhparam cert for Coturn if it doesn't exist # Make dhparam cert for Coturn if it doesn't exist
if [ ! -e /etc/ssl/private/dh2048.pem ] if [ ! -e /etc/ssl/private/dh2048.pem ]
then then
ynh_exec_warn_less openssl dhparam -out /etc/ssl/private/dh2048.pem -outform PEM -dsaparam 2048 ynh_hide_warnings openssl dhparam -out /etc/ssl/private/dh2048.pem -outform PEM -dsaparam 2048
chown root:ssl-cert /etc/ssl/private/dh2048.pem chown root:ssl-cert /etc/ssl/private/dh2048.pem
chmod 640 /etc/ssl/private/dh2048.pem chmod 640 /etc/ssl/private/dh2048.pem
fi fi
@ -60,16 +54,16 @@ fi
# Restore permissions on app files # Restore permissions on app files
# Set permissions to app files # Set permissions to app files
chown root: -R /home/yunohost.app/$app chown root: -R /home/yunohost.app/$app
chown -R turnserver:root /var/log/$app #REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R turnserver:root /var/log/$app
chown turnserver:root /etc/turnserver.conf chown turnserver:root /etc/turnserver.conf
setfacl -R -m user:turnserver:rwX /var/log/$app setfacl -R -m user:turnserver:rwX /var/log/$app
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 ynh_script_progression "Restoring $app's systemd service..."
ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore "/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet systemctl enable $app.service --quiet
yunohost service add $app --description="Coturn TURN server" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port_turnserver_tls" yunohost service add $app --description="Coturn TURN server" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port_turnserver_tls"
@ -77,12 +71,12 @@ yunohost service add $app --description="Coturn TURN server" --log="/var/log/$ap
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression "Starting $app's systemd service..."
ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log" ynh_systemctl --service=$app --action=start
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Restoration completed for $app" --last ynh_script_progression "Restoration completed for $app"

View file

@ -1,33 +1,19 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#================================================= #=================================================
# STOP SYSTEMD SERVICE # STOP SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_script_progression "Stopping $app's systemd service..."
ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log" ynh_systemctl --service=$app --action=stop
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 ynh_script_progression "Making sure dedicated system user exists..."
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
adduser turnserver ssl-cert adduser turnserver ssl-cert
@ -35,43 +21,43 @@ adduser turnserver ssl-cert
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1 ynh_script_progression "Configuring $app's systemd service..."
mkdir -p /var/log/$app mkdir -p /var/log/$app
# Create systemd service for turnserver # Create systemd service for turnserver
ynh_add_config --template="default.coturn" --destination="/etc/default/coturn" ynh_config_add --template="default.coturn" --destination="/etc/default/coturn"
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_config_add_systemd
#================================================= #=================================================
# SET COTURN CONFIG # SET COTURN CONFIG
#================================================= #=================================================
ynh_script_progression --message="Configuring Coturn..." --weight=2 ynh_script_progression "Configuring Coturn..."
coturn_config_path="/etc/turnserver.conf" coturn_config_path="/etc/turnserver.conf"
ynh_add_config --template="../conf/turnserver.conf" --destination="$coturn_config_path" ynh_config_add --template="turnserver.conf" --destination="$coturn_config_path"
# Get public IP and set as external IP for coturn # Get public IP and set as external IP for coturn
# note: '|| true' is used to ignore the errors if we can't get the public ipv4 or ipv6 # note: '|| true' is used to ignore the errors if we can't get the public ipv4 or ipv6
public_ip4="$(curl -s ip.yunohost.org)" || true public_ip4="$(curl -s ip.yunohost.org)" || true
public_ip6="$(curl -s ipv6.yunohost.org)" || true public_ip6="$(curl -s ipv6.yunohost.org)" || true
if ( [[ -n "$public_ip4" ]] && ynh_validate_ip4 --ip_address="$public_ip4" || [[ -n "$public_ip6" ]] && ynh_validate_ip6 --ip_address="$public_ip6" ) if ( [[ -n "$public_ip4" ]] && ynh_validate_ip --family=4 --ip_address="$public_ip4" || [[ -n "$public_ip6" ]] && ynh_validate_ip6 --ip_address="$public_ip6" )
then then
echo "external-ip=${public_ip4}/${public_ip6}" >> "$coturn_config_path" echo "external-ip=${public_ip4}/${public_ip6}" >> "$coturn_config_path"
fi fi
ynh_store_file_checksum --file="$coturn_config_path" ynh_store_file_checksum "$coturn_config_path"
#================================================= #=================================================
# ADD SCRIPT FOR COTURN CRON # ADD SCRIPT FOR COTURN CRON
#================================================= #=================================================
cp -f ../sources/Coturn_config_rotate.sh $data_dir/ 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 ynh_replace --match="__APP__" --replace=$app --file=$data_dir/Coturn_config_rotate.sh
chmod +x $data_dir/Coturn_config_rotate.sh chmod +x $data_dir/Coturn_config_rotate.sh
@ -79,7 +65,7 @@ chmod +x $data_dir/Coturn_config_rotate.sh
# SET COTURN CRON # SET COTURN CRON
#================================================= #=================================================
ynh_add_config --template="cron_coturn" --destination="/etc/cron.d/$app" ynh_config_add --template="cron_coturn" --destination="/etc/cron.d/$app"
#================================================= #=================================================
# MIGRATION 3 : USE STANDARD ACCESS FOR CERTIFCATE # MIGRATION 3 : USE STANDARD ACCESS FOR CERTIFCATE
@ -88,7 +74,7 @@ ynh_add_config --template="cron_coturn" --destination="/etc/cron.d/$app"
# Fix issue about certificates access # Fix issue about certificates access
# if [ ! $(grep "ssl-cert:x:[0-9]*:.*$app" /etc/group) ] # if [ ! $(grep "ssl-cert:x:[0-9]*:.*$app" /etc/group) ]
# then # then
# ynh_script_progression --message="Use standard access for certificate..." --weight=1 # ynh_script_progression "Use standard access for certificate..."
# adduser turnserver ssl-cert # adduser turnserver ssl-cert
# fi # fi
@ -96,39 +82,37 @@ ynh_add_config --template="cron_coturn" --destination="/etc/cron.d/$app"
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
#================================================= #=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=5 ynh_script_progression "Configuring log rotation..."
ynh_use_logrotate --logfile "/var/log/$app" ynh_config_add_logrotate "/var/log/$app"
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
# Set permissions to app files # Set permissions to app files
chown root: -R $data_dir chown root: -R $data_dir
chown -R turnserver:root /var/log/$app #REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R turnserver:root /var/log/$app
chown turnserver:root /etc/turnserver.conf chown turnserver:root /etc/turnserver.conf
setfacl -R -m user:turnserver:rwX /var/log/$app setfacl -R -m user:turnserver:rwX /var/log/$app
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=2 ynh_script_progression "Integrating service in YunoHost..."
yunohost service add $app --description="Coturn TURN server" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port_turnserver_tls" yunohost service add $app --description="Coturn TURN server" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port_turnserver_tls"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression "Starting $app's systemd service..."
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action=restart --log_path="/var/log/$app/$app.log" ynh_systemctl --service=$app --action=restart
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of Coturn completed" --last ynh_script_progression "Upgrade of Coturn completed"