From de61d69b31bee3eed19a0c34122aad0287f8921c Mon Sep 17 00:00:00 2001 From: rosbeef andino Date: Wed, 6 Apr 2022 02:28:14 -0400 Subject: [PATCH] add max memory for vm configuration (#70) * add max video member parameter to set max memory usage * add max memory usage * add VIDEOBRIDGE_MAX_MEMORY config * Update manifest.json * Update manifest.json * add max_memory parameter * add max memory unit * add max memory unit * add max member test value * Update manifest.json * Update manifest.json * Update jitsi-jicofo-config * Update jitsi-videobridge.config * Update install * Update install * Update install * Update upgrade * Update restore * Create config_panel.toml * Update config_panel.toml * Update config_panel.toml * fix bug * Create config * Update config_panel.toml * Update config * fix cannot restart service "" * Update config * change max users to max memory for better undertand * change max user to max memory for better understand * Update config_panel.toml edit help text * Update config * max_memory not needed during restore * remove max_memory question during install * default max_memory reduced * Cleanup * adding max_memory informations * Auto-update README * typo Co-authored-by: yalh76 Co-authored-by: yunohost-bot --- README.md | 1 + README_fr.md | 1 + conf/jitsi-jicofo-config | 3 ++ conf/jitsi-videobridge.config | 3 ++ config_panel.toml | 14 ++++++ doc/DISCLAIMER.md | 1 + doc/DISCLAIMER_fr.md | 1 + scripts/config | 88 +++++++++++++++++++++++++++++++++++ scripts/install | 3 ++ scripts/upgrade | 8 ++++ 10 files changed, 123 insertions(+) create mode 100644 config_panel.toml create mode 100644 scripts/config diff --git a/README.md b/README.md index 85ae5b6..f68e9ba 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ Jitsi Meet is a libre software (Apache) WebRTC JavaScript app that uses Jitsi Vi 2. **Jitsi** requires the ports TCP/4443 and UDP/10000 to be forwarded to your YunoHost (The same way you forwarded 80 (HTTP), 443 (HTTPS), etc... https://yunohost.org/#/isp_box_config) 3. **Jitsi** will stop and disable Metronome XMPP. 4. LDAP authentication is activated, only authenticated users to create new conference rooms. Whenever a new room is about to be created, Jitsi Meet will prompt for a user name and password. After the room is created, others will be able to join from anonymous domain. +5. **Jitsi** is configured for 50 users maximum, this number can be increase going to the Yunohost config panel ## Documentation and resources diff --git a/README_fr.md b/README_fr.md index eeb3aea..3f5af92 100644 --- a/README_fr.md +++ b/README_fr.md @@ -30,6 +30,7 @@ Jitsi Meet est un logiciel libre (Apache) dont Jitsi Videobridge, avec WebRTC Ja 2. **Jitsi** demande que les ports TCP/4443 et UDP/10000 soient routés vers votre YunoHost (De la même manière que le sont les ports 80 (HTTP), 443 (HTTPS), etc... https://yunohost.org/#/isp_box_config) 3. **Jitsi** va arréter et désactiver le service XMPP Metronome. 4. L'authentification LDAP est activée, seuls les utilisateurs authentifiés peuvent créer de nouvelles salles de conférence. Chaque fois qu'une nouvelle salle est sur le point d'être créée, Jitsi Meet vous demandera un nom d'utilisateur et un mot de passe. Une fois la salle créée, d'autres personnes pourront la rejoindre à partir d'un domaine anonyme. +5. **Jitsi** est configuré pour 50 utilisateurs maximum, ce nombre peut être augmenté en allant dans le panneau de configuration Yunohost ## Documentations et ressources diff --git a/conf/jitsi-jicofo-config b/conf/jitsi-jicofo-config index 15ee558..36d1778 100644 --- a/conf/jitsi-jicofo-config +++ b/conf/jitsi-jicofo-config @@ -17,5 +17,8 @@ JICOFO_AUTH_PASSWORD=__FOCUS_PASSWORD__ # extra options to pass to the jicofo daemon JICOFO_OPTS="" +# set the max memory used during VM alocation +JICOFO_MAX_MEMORY=__MAX_MEMORY__m + # adds java system props that are passed to jicofo (default are for home and logging config file) JAVA_SYS_PROPS="-Dconfig.file=/etc/__APP__/jicofo/jicofo.conf -Dnet.java.sip.communicator.SC_HOME_DIR_LOCATION=/etc/__APP__ -Dnet.java.sip.communicator.SC_HOME_DIR_NAME=jicofo -Dnet.java.sip.communicator.SC_LOG_DIR_LOCATION=/var/log/__APP__ -Djava.util.logging.config.file=/etc/__APP__/jicofo/logging.properties" diff --git a/conf/jitsi-videobridge.config b/conf/jitsi-videobridge.config index 7b356a0..72fc1bc 100644 --- a/conf/jitsi-videobridge.config +++ b/conf/jitsi-videobridge.config @@ -12,5 +12,8 @@ JVB_PORT=__PORT_COMPONENT__ # sets the shared secret used to authenticate to the XMPP server JVB_SECRET=__VIDEOBRIDGE_SECRET__ +# add max memory used during VM alocation +VIDEOBRIDGE_MAX_MEMORY=__MAX_MEMORY__m + # adds java system props that are passed to jvb (default are for home and logging config file) JAVA_SYS_PROPS="-Dconfig.file=/etc/__APP__/videobridge/jvb.conf -Dnet.java.sip.communicator.SC_HOME_DIR_LOCATION=/etc/__APP__ -Dnet.java.sip.communicator.SC_HOME_DIR_NAME=videobridge -Dnet.java.sip.communicator.SC_LOG_DIR_LOCATION=/var/log/__APP__ -Djava.util.logging.config.file=/etc/__APP__/videobridge/logging.properties" diff --git a/config_panel.toml b/config_panel.toml new file mode 100644 index 0000000..53f6da1 --- /dev/null +++ b/config_panel.toml @@ -0,0 +1,14 @@ +version = "1.0" + +[main] +name = "Main configuration" +services = ["__APP__-jicofo","__APP__-videobridge"] + + [main.config] + name = "Global configurations" + + [main.config.max_memory] + bind = "null" + ask.en = "Max memory to use for VM" + type = "number" + help = "One user consume about 1,5 Mib memory, for example if plan to have max 50 simultaneous users this parameter should be set to 75 mb" diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index d069ebb..b033633 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -4,3 +4,4 @@ 2. **Jitsi** requires the ports TCP/4443 and UDP/10000 to be forwarded to your YunoHost (The same way you forwarded 80 (HTTP), 443 (HTTPS), etc... https://yunohost.org/#/isp_box_config) 3. **Jitsi** will stop and disable Metronome XMPP. 4. LDAP authentication is activated, only authenticated users to create new conference rooms. Whenever a new room is about to be created, Jitsi Meet will prompt for a user name and password. After the room is created, others will be able to join from anonymous domain. +5. **Jitsi** is configured for 50 users maximum, this number can be increase going to the Yunohost config panel diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md index 02abc34..6f609d4 100644 --- a/doc/DISCLAIMER_fr.md +++ b/doc/DISCLAIMER_fr.md @@ -4,3 +4,4 @@ 2. **Jitsi** demande que les ports TCP/4443 et UDP/10000 soient routés vers votre YunoHost (De la même manière que le sont les ports 80 (HTTP), 443 (HTTPS), etc... https://yunohost.org/#/isp_box_config) 3. **Jitsi** va arréter et désactiver le service XMPP Metronome. 4. L'authentification LDAP est activée, seuls les utilisateurs authentifiés peuvent créer de nouvelles salles de conférence. Chaque fois qu'une nouvelle salle est sur le point d'être créée, Jitsi Meet vous demandera un nom d'utilisateur et un mot de passe. Une fois la salle créée, d'autres personnes pourront la rejoindre à partir d'un domaine anonyme. +5. **Jitsi** est configuré pour 50 utilisateurs maximum, ce nombre peut être augmenté en allant dans le panneau de configuration Yunohost diff --git a/scripts/config b/scripts/config new file mode 100644 index 0000000..c4baffc --- /dev/null +++ b/scripts/config @@ -0,0 +1,88 @@ +#!/bin/bash + +#================================================= +# GENERIC STARTING +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +source _common.sh +source /usr/share/yunohost/helpers + +ynh_abort_if_errors + +#================================================= +# RETRIEVE ARGUMENTS +#================================================= + + +#================================================= +# SPECIFIC GETTERS FOR TOML SHORT KEY +#================================================= + +get__max_memory(){ + local max_memory=$(ynh_app_setting_get --app=$app --key=max_memory) + + # If max_memory doesn't exist, create it and set to default 75 mb value + if [ -z "$max_memory" ]; then + max_memory=75 + ynh_app_setting_set --app=$app --key=max_memory --value=$max_memory + fi + + cat << EOF +value: $max_memory +EOF +} + +#================================================= +# SPECIFIC VALIDATORS FOR TOML SHORT KEYS +#================================================= + +#================================================= +# SPECIFIC SETTERS FOR TOML SHORT KEYS +#================================================= + +set__max_memory(){ + + #================================================= + # LOAD SETTINGS + #================================================= + + ynh_script_progression --message="Loading installation settings..." + + domain=$(ynh_app_setting_get --app=$app --key=domain) + path_url=$(ynh_app_setting_get --app=$app --key=path) + final_path=$(ynh_app_setting_get --app=$app --key=final_path) + + focus_user=$(ynh_app_setting_get --app=$app --key=focus_user) + focus_password=$(ynh_app_setting_get --app=$app --key=focus_password) + focus_secret=$(ynh_app_setting_get --app=$app --key=focus_secret) + + videobridge_user=$(ynh_app_setting_get --app=$app --key=videobridge_user) + videobridge_secret=$(ynh_app_setting_get --app=$app --key=videobridge_secret) + + port=$(ynh_app_setting_get --app=$app --key=port) + port_videobridge=$(ynh_app_setting_get --app=$app --key=port_videobridge) + port_component=$(ynh_app_setting_get --app=$app --key=port_component) + + #================================================= + # SET SETTINGS + #================================================= + + ynh_app_setting_set --app=$app --key=max_memory --value=$max_memory + + #================================================= + # UPDATE CONFIG FILES + #================================================= + + ynh_add_config --template="../conf/jitsi-videobridge.config" --destination="/etc/$app/videobridge/config" + ynh_add_config --template="../conf/jitsi-jicofo-config" --destination="/etc/$app/jicofo/config" + + ynh_script_progression -l --message="Configuration of $app updated" +} + +#================================================= +# GENERIC FINALIZATION +#================================================= + +ynh_app_config_run $1 diff --git a/scripts/install b/scripts/install index 8f5f49d..102e153 100644 --- a/scripts/install +++ b/scripts/install @@ -42,6 +42,8 @@ focus_user="focus" videobridge_user="jvb" +max_memory=75 + #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= @@ -60,6 +62,7 @@ ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url +ynh_app_setting_set --app=$app --key=max_memory --value=$max_memory ynh_app_setting_set --app=$app --key=focus_user --value=$focus_user ynh_app_setting_set --app=$app --key=focus_password --value=$focus_password ynh_app_setting_set --app=$app --key=focus_secret --value=$focus_secret diff --git a/scripts/upgrade b/scripts/upgrade index f08ebec..b716c03 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,6 +20,8 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +max_memory=$(ynh_app_setting_get --app=$app --key=max_memory) + focus_user=$(ynh_app_setting_get --app=$app --key=focus_user) focus_password=$(ynh_app_setting_get --app=$app --key=focus_password) focus_secret=$(ynh_app_setting_get --app=$app --key=focus_secret) @@ -78,6 +80,12 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi +# If max_memory doesn't exist, create it and set to default 75 mb value +if [ -z "$max_memory" ]; then + max_memory=75 + ynh_app_setting_set --app=$app --key=max_memory --value=$max_memory +fi + #================================================= # CREATE DEDICATED USER #=================================================