diff --git a/type/__jitsi_meet/explorer/jitsi-status b/type/__jitsi_meet/explorer/jitsi-status new file mode 100755 index 0000000..ce3d9f7 --- /dev/null +++ b/type/__jitsi_meet/explorer/jitsi-status @@ -0,0 +1,6 @@ +#!/bin/sh -eu + +if [ ! -f "${__object}/parameter/disable-prometheus-exporter" ]; then + # TODO: detect curl / depend on it? + curl -s localhost:9888/metrics +fi diff --git a/type/__jitsi_meet/man.rst b/type/__jitsi_meet/man.rst index 03a4a35..e69275b 100644 --- a/type/__jitsi_meet/man.rst +++ b/type/__jitsi_meet/man.rst @@ -47,6 +47,14 @@ NOTE: This type currently does not deal with setting up coturn. OPTIONAL PARAMETERS ------------------- +abort-conference-count + Only has an effect if the prometheus exporter is enabled and if it is not + empty (default). + If at least this many conferences are active on the server, the type will + bail out before making any changes. + This is useful if you want to avoid service disruptions due to e.g. an SLA. + + turn-secret The shared secret for the TURN server. diff --git a/type/__jitsi_meet/manifest b/type/__jitsi_meet/manifest index 20e91a7..78b3524 100755 --- a/type/__jitsi_meet/manifest +++ b/type/__jitsi_meet/manifest @@ -10,6 +10,20 @@ case "${os}" in ;; esac +current_conferences="$(cat "${__object}/explorer/jitsi-status" | grep -E "^jitsi_conferences[[:space:]]" | cut -d ' ' -f 2)" + +ABORT_CONFERENCE_COUNT="$(cat "${__object}/parameter/abort-conference-count")" + +if [ -n "${current_conferences}" ] && [ -n "${ABORT_CONFERENCE_COUNT}" ] && \ + [ "${ABORT_CONFERENCE_COUNT}" -le "${current_conferences}" ]; then + cat <<-EOF +Early bail out was requested when at least ${ABORT_CONFERENCE_COUNT} conferences are taking place. +There are currently ${current_conferences} active conferences. + +Try again at a later time or remove or increase --abort-conference-count + EOF + exit 1 +fi JITSI_HOST="${__target_host}" if [ -f "${__object}/parameter/jitsi-version" ]; then diff --git a/type/__jitsi_meet/parameter/default/abort-conference-count b/type/__jitsi_meet/parameter/default/abort-conference-count new file mode 100644 index 0000000..e69de29 diff --git a/type/__jitsi_meet/parameter/optional b/type/__jitsi_meet/parameter/optional index e7581af..e18bd6a 100644 --- a/type/__jitsi_meet/parameter/optional +++ b/type/__jitsi_meet/parameter/optional @@ -1,3 +1,4 @@ +abort-conference-count jitsi-version turn-secret turn-server