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

Add recordig and groups to user folder

This commit is contained in:
ericgaspar 2021-09-05 22:50:30 +02:00
parent a542c43501
commit d50ce2b5f2
No known key found for this signature in database
GPG key ID: 574F281483054D44
6 changed files with 73 additions and 27 deletions

View file

@ -8,7 +8,7 @@ Type=simple
WorkingDirectory=__FINALPATH__/
User=__APP__
Group=__APP__
ExecStart=__FINALPATH__/galene -turn __PUBLIC_IP4__:__TURN_PORT__ -udp-range 49152-65535
ExecStart=__FINALPATH__/galene -turn __PUBLIC_IP4__:__TURN_PORT__ -udp-range 49152-65535 -groups /home/yunohost.app/__APP__/groups -recordings /home/yunohost.app/__APP__/recordings
LimitNOFILE=65536
# Sandboxing options to harden security

View file

@ -28,6 +28,7 @@ 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)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
@ -40,6 +41,12 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE DATA DIR
#=================================================
ynh_backup --src_path="$datadir" --is_big
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================

View file

@ -106,10 +106,10 @@ data="$final_path/data"
# Create data folder
mkdir -p "$data"
# Define app's groups directory
groups="$final_path/groups"
# Create groups folder
mkdir -p "$groups"
# # Define app's groups directory
# groups="$final_path/groups"
# # Create groups folder
# mkdir -p "$groups"
#=================================================
# NGINX CONFIGURATION
@ -119,6 +119,20 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# CREATE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Creating a data directory..." --weight=1
datadir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
mkdir -p $datadir/{groups,recordings}
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
#=================================================
# SETUP SYSTEMD
#=================================================
@ -151,7 +165,7 @@ yunohost service add $app --description="Videoconferencing server" --log="/var/l
ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service
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="systemd"
#=================================================
# SETUP SSOWAT

View file

@ -20,6 +20,7 @@ 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)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# STANDARD REMOVE
@ -50,6 +51,17 @@ ynh_script_progression --message="Removing app main directory..." --weight=2
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE DATA DIR
#=================================================
# # Remove the app data directory with the command `yunohost app remove --purge`
# if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
# then
# ynh_script_progression --message="Removing $app data directory..." --weight=2
# ynh_secure_remove --file="$datadir"
# fi
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================

View file

@ -68,6 +68,19 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring the data directory..." --weight=1
ynh_restore_file --origin_path="$datadir" --not_mandatory
mkdir -p $datadir/{groups,recordings}
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
#=================================================
# RESTORE SYSTEMD
#=================================================
@ -88,7 +101,7 @@ yunohost service add $app --description="Videoconferencing server" --log="/var/l
#=================================================
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="systemd"
#=================================================
# GENERIC FINALIZATION

View file

@ -31,6 +31,20 @@ architecture=$(ynh_detect_arch)
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
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
@ -50,18 +64,12 @@ if ynh_legacy_permissions_exists; then
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
ynh_script_progression --message="Making sure dedicated system user exists..." --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
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# STANDARD UPGRADE STEPS
@ -90,7 +98,7 @@ then
# # Remove the app directory securely
# ynh_secure_remove --file="$final_path"
ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" --keep="$final_path/groups $final_path/data/passwd"
ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" --keep="$final_path/data/passwd"
# # Create data and groups folder
# mkdir -p "$final_path/data" "$final_path/groups"
@ -115,14 +123,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# 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=$app --home_dir="$final_path"
#=================================================
# SETUP SYSTEMD
#=================================================
@ -145,7 +145,7 @@ yunohost service add $app --description="Videoconferencing server" --log="/var/l
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
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="systemd"
#=================================================
# RELOAD NGINX