1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jitsi_ynh.git synced 2024-09-03 19:35:57 +02:00

Merge branch 'YunoHost-Apps:master' into fix-js-uncaught-reference-error

This commit is contained in:
CodeShakingSheep 2024-01-21 22:13:08 +01:00 committed by GitHub
commit 9297923b68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 332 additions and 1042 deletions

View file

@ -1,156 +0,0 @@
#!/bin/bash
#=================================================
# PACKAGE UPDATING HELPER
#=================================================
# This script is meant to be run by GitHub Actions
# The YunoHost-Apps organisation offers a template Action to run this script periodically
# Since each app is different, maintainers can adapt its contents so as to perform
# automatic actions when a new upstream release is detected.
#=================================================
# FETCHING LATEST RELEASE AND ITS ASSETS
#=================================================
# Fetching information
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .name' | sort -V | tail -1)
package_repository="https://download.jitsi.org/stable"
tempdir="$(mktemp -d)"
curl -o $tempdir/Release "$package_repository/Packages"
dependencies=$(sed -n '/Version: '$version'*/,/Package:/p' $tempdir/Release | grep "^Pre-Depends:" | cut -d " " -f2-)
dependencies="$dependencies, $(sed -n '/Version: '$version'*/,/Package:/p' $tempdir/Release | grep "^Depends:" | cut -d " " -f2-)"
IFS=',' read -ra dependencies_array <<< "$dependencies"
assets=()
for onedependency in "${dependencies_array[@]}"
do
app=$(echo $onedependency | cut -d " " -f1)
appversion=$(echo $onedependency | grep -oP "(?<== ).*(?=\))")
assets+=("$package_repository/${app}_${appversion}_all.deb")
done
rm -rf $tempdir
# Later down the script, we assume the version has only digits and dots
# Sometimes the release name starts with a "v", so let's filter it out.
# You may need more tweaks here if the upstream repository has different naming conventions.
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
version=${version:1}
fi
# Setting up the environment variables
echo "Current version: $current_version"
echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $GITHUB_ENV
echo "REPO=$repo" >> $GITHUB_ENV
# For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV
# Proceed only if the retrieved version is greater than the current one
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
echo "::warning ::No new version available"
exit 0
# Proceed only if a PR for this new version does not already exist
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
echo "::warning ::A branch already exists for this update"
exit 0
fi
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
echo "${#assets[@]} available asset(s)"
#=================================================
# UPDATE SOURCE FILES
#=================================================
# Here we use the $assets variable to get the resources published in the upstream release.
# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like.
# Let's loop over the array of assets URLs
for asset_url in ${assets[@]}; do
echo "Handling asset at $asset_url"
# Assign the asset to a source file in conf/ directory
# Here we base the source file name upon a unique keyword in the assets url (admin vs. update)
# Leave $src empty to ignore the asset
case $asset_url in
*"jitsi-videobridge"*)
src="jitsi-videobridge"
;;
*"jicofo"*)
src="jitsi-jicofo"
;;
*"jitsi-meet-web_"*)
src="jitsi-meet-web"
;;
*"jitsi-meet-prosody"*)
src="jitsi-meet-prosody"
;;
*)
src=""
;;
esac
# If $src is not empty, let's process the asset
if [ ! -z "$src" ]; then
# Create the temporary directory
tempdir="$(mktemp -d)"
# Download sources and calculate checksum
filename=${asset_url##*/}
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
# Delete temporary directory
rm -rf $tempdir
# Get extension
if [[ $filename == *.tar.gz ]]; then
extension=tar.gz
else
extension=${filename##*.}
fi
# Rewrite source file
cat <<EOT > conf/$src.src
SOURCE_URL=$asset_url
SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=$src.deb
SOURCE_EXTRACT=false
EOT
echo "... conf/$src.src updated"
else
echo "... asset ignored"
fi
done
#=================================================
# SPECIFIC UPDATE STEPS
#=================================================
# Any action on the app's source code can be done.
# The GitHub Action workflow takes care of committing all changes after this script ends.
#=================================================
# GENERIC FINALIZATION
#=================================================
# Replace new version in manifest
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
# No need to update the README, yunohost-bot takes care of it
# The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV
exit 0

View file

@ -1,49 +0,0 @@
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
# This file should be enough by itself, but feel free to tune it to your needs.
# It calls updater.sh, which is where you should put the app-specific update steps.
name: Check for new upstream releases
on:
# Allow to manually trigger the workflow
workflow_dispatch:
# Run it every day at 6:00 UTC
schedule:
- cron: '0 6 * * *'
jobs:
updater:
runs-on: ubuntu-latest
steps:
- name: Fetch the source code
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script
id: run_updater
run: |
# Setting up Git user
git config --global user.name 'yunohost-bot'
git config --global user.email 'yunohost-bot@users.noreply.github.com'
# Run the updater script
/bin/bash .github/workflows/updater.sh
- name: Commit changes
id: commit
if: ${{ env.PROCEED == 'true' }}
run: |
git commit -am "Upgrade to v$VERSION"
- name: Create Pull Request
id: cpr
if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }}
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
signoff: false
base: testing
branch: ci-auto-update-v${{ env.VERSION }}
delete-branch: true
title: 'Upgrade to version ${{ env.VERSION }}'
body: |
Upgrade to v${{ env.VERSION }}
draft: false

View file

@ -27,16 +27,6 @@ Jitsi Meet is a libre software (Apache) WebRTC JavaScript app that uses Jitsi Vi
![Screenshot of Jitsi Meet](./doc/screenshots/screenshot.png) ![Screenshot of Jitsi Meet](./doc/screenshots/screenshot.png)
## Disclaimers / important information
## Important points before installing
1. **Jitsi** requires a dedicated **root domain**, eg. jitsi.domain.tld
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 ## Documentation and resources
* Official app website: <https://jitsi.org/> * Official app website: <https://jitsi.org/>

View file

@ -27,16 +27,6 @@ Jitsi Meet est un logiciel libre (Apache) dont Jitsi Videobridge, avec WebRTC Ja
![Capture décran de Jitsi Meet](./doc/screenshots/screenshot.png) ![Capture décran de Jitsi Meet](./doc/screenshots/screenshot.png)
## Avertissements / informations importantes
## Points importants à préparer avant l'installation
1. **Jitsi** a besoin d'un **domaine racine** dédié, par exemple : jitsi.domain.tld
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 ## Documentations et ressources
* Site officiel de lapp : <https://jitsi.org/> * Site officiel de lapp : <https://jitsi.org/>

View file

@ -1,28 +0,0 @@
;; Test complet
; Manifest
domain="domain.tld"
; Checks
pkg_linter=1
setup_sub_dir=0
setup_root=1
setup_nourl=0
setup_private=0
setup_public=1
upgrade=1
# 1.0.4466~ynh1
upgrade=1 from_commit=f967b101803c49655e460bdb2c1b0fb73320d0e3
# 1.0.4466~ynh2
upgrade=1 from_commit=ba635a58f8184b5dd4a6682b8da96909d3d31060
# 1.0.5913~ynh1
upgrade=1 from_commit=12d4758ea7582c9d15d0bd80e2eb5f03ccac8484
# 1.0.5913~ynh3
upgrade=1 from_commit=afbc84d313452267cd97b9df44801d0ae085b1f2
# 2.0.8719~ynh2
upgrade=1 from_commit=4a043dfd46acc078e6c222a83958b2f64f16a79f
backup_restore=1
multi_instance=0
port_already_use=0
change_url=0
;;; Options
Email=yalh@yahoo.com
Notification=all

View file

@ -6,8 +6,8 @@ After=network.target
EnvironmentFile=/etc/__APP__/jicofo/config EnvironmentFile=/etc/__APP__/jicofo/config
Environment=LOGFILE=/var/log/__APP__/jitsi-jicofo.log Environment=LOGFILE=/var/log/__APP__/jitsi-jicofo.log
User=__APP__ User=__APP__
WorkingDirectory=__FINALPATH__/jitsi-jicofo/ WorkingDirectory=__INSTALL_DIR__/jitsi-jicofo/
ExecStart=/bin/bash -c "exec __FINALPATH__/jitsi-jicofo/jicofo.sh --host=${JICOFO_HOST} --domain=${JICOFO_HOSTNAME} --user_name=${JICOFO_AUTH_USER} --user_domain=${JICOFO_AUTH_DOMAIN} --user_password=${JICOFO_AUTH_PASSWORD} ${JICOFO_OPTS} < /dev/null >> ${LOGFILE} 2>&1" ExecStart=/bin/bash -c "exec __INSTALL_DIR__/jitsi-jicofo/jicofo.sh --host=${JICOFO_HOST} --domain=${JICOFO_HOSTNAME} --user_name=${JICOFO_AUTH_USER} --user_domain=${JICOFO_AUTH_DOMAIN} --user_password=${JICOFO_AUTH_PASSWORD} ${JICOFO_OPTS} < /dev/null >> ${LOGFILE} 2>&1"
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://download.jitsi.org/stable/jicofo_1.0-1059-1_all.deb
SOURCE_SUM=365051508e23ff99e3152fd3b414ec695ff920b16da9677a485f85aa91a9d549
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=jitsi-jicofo.deb
SOURCE_EXTRACT=false

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://download.jitsi.org/stable/jitsi-meet-prosody_1.0.7712-1_all.deb
SOURCE_SUM=30e360d42c4badf07e7269979b8af71eac05d689febc367420e0ca4abecfb16a
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=jitsi-meet-prosody.deb
SOURCE_EXTRACT=false

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://download.jitsi.org/stable/jitsi-meet-web_1.0.7712-1_all.deb
SOURCE_SUM=43917b5d3fd003823933d84beaf822a8a9edaa8f06f897e13b6b575bba3f3c18
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=jitsi-meet-web.deb
SOURCE_EXTRACT=false

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://github.com/jitsi/jitsi-sctp/archive/45bf9f296167f79a52cdc1b0e93bbfa4dc8c4976.tar.gz
SOURCE_SUM=1eead17b10d059bafe8e1b06a8351936b608e7514b131588deac61d24b859397
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_EXTRACT=true

View file

@ -17,8 +17,8 @@ TasksMax=65000
# allow more open files for this process # allow more open files for this process
LimitNPROC=65000 LimitNPROC=65000
LimitNOFILE=65000 LimitNOFILE=65000
WorkingDirectory=__FINALPATH__/jitsi-videobridge/ WorkingDirectory=__INSTALL_DIR__/jitsi-videobridge/
ExecStart=/bin/bash -c "exec __FINALPATH__/jitsi-videobridge/jvb.sh --host=${JVB_HOST} --domain=${JVB_HOSTNAME} --port=${JVB_PORT} --secret=${JVB_SECRET} ${JVB_OPTS} < /dev/null >> ${LOGFILE} 2>&1" ExecStart=/bin/bash -c "exec __INSTALL_DIR__/jitsi-videobridge/jvb.sh --host=${JVB_HOST} --domain=${JVB_HOSTNAME} --port=${JVB_PORT} --secret=${JVB_SECRET} ${JVB_OPTS} < /dev/null >> ${LOGFILE} 2>&1"
ExecStartPost=/bin/bash -c "echo $MAINPID > /var/run/jitsi-videobridge/jitsi-videobridge.pid" ExecStartPost=/bin/bash -c "echo $MAINPID > /var/run/jitsi-videobridge/jitsi-videobridge.pid"
[Install] [Install]

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://download.jitsi.org/stable/jitsi-videobridge2_2.3-64-g719465d1-1_all.deb
SOURCE_SUM=cd960148768c846cc97ce37211490f5026a5c4bc81fc48ea2ea22024f83667ca
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=jitsi-videobridge.deb
SOURCE_EXTRACT=false

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://hg.prosody.im/prosody-modules/raw-file/tip/mod_auth_ldap/mod_auth_ldap.lua
SOURCE_SUM=49c67ec86ec75ac8de93803be2ac7f907d1e9d3d22cd4c88fd48aaeed7a411e3
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=lua
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=mod_auth_ldap.lua
SOURCE_EXTRACT=false

View file

@ -1,4 +1,4 @@
root __FINALPATH__/jitsi-meet-web; root __INSTALL_DIR__/jitsi-meet-web;
# fix https://github.com/YunoHost-Apps/jitsi_ynh/issues/113 # fix https://github.com/YunoHost-Apps/jitsi_ynh/issues/113
more_set_headers "Content-Security-Policy: frame-ancestors 'self'"; more_set_headers "Content-Security-Policy: frame-ancestors 'self'";
@ -15,14 +15,14 @@ location = /config.js {
} }
location = /external_api.js { location = /external_api.js {
alias __FINALPATH__/jitsi-meet-web/libs/external_api.min.js; alias __INSTALL_DIR__/jitsi-meet-web/libs/external_api.min.js;
} }
# ensure all static content can always be found first # ensure all static content can always be found first
location ~ ^/(libs|css|static|images|fonts|lang|sounds|connection_optimization|.well-known)/(.*)$ location ~ ^/(libs|css|static|images|fonts|lang|sounds|connection_optimization|.well-known)/(.*)$
{ {
more_set_headers "Access-Control-Allow-Origin: *"; more_set_headers "Access-Control-Allow-Origin: *";
alias __FINALPATH__/jitsi-meet-web/$1/$2; alias __INSTALL_DIR__/jitsi-meet-web/$1/$2;
# cache all versioned files # cache all versioned files
if ($arg_v) { if ($arg_v) {

View file

@ -1,4 +1,4 @@
plugin_paths = { "__FINALPATH__/jitsi-meet-prosody/" } plugin_paths = { "__INSTALL_DIR__/jitsi-meet-prosody/" }
-- domain mapper options, must at least have domain base set to use the mapper -- domain mapper options, must at least have domain base set to use the mapper
muc_mapper_domain_base = "__DOMAIN__"; muc_mapper_domain_base = "__DOMAIN__";

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://github.com/sctplab/usrsctp/archive/8e12cd9e01fc94d2e84ea1afa351c845966e116e.tar.gz
SOURCE_SUM=0574a31fecca543cf8e46c1bff441a3048ccf7d403da0543639db334e9a09b2f
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_EXTRACT=true

View file

@ -4,4 +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) 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. 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. 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 5. **Jitsi** is configured for 50 users maximum, this number can be increased in the Yunohost config panel

View file

@ -1,44 +0,0 @@
{
"name": "Jitsi Meet",
"id": "jitsi",
"packaging_format": 1,
"description": {
"en": "Video conferencing web application",
"fr": "Application web de conférence vidéo"
},
"version": "2.0.9164~ynh1",
"url": "https://jitsi.org/Projects/JitMeet",
"upstream": {
"license": "Apache-2.0",
"website": "https://jitsi.org/",
"demo": "https://meet.jit.si/",
"userdoc": "https://jitsi.org/user-faq/",
"code": "https://github.com/jitsi/jitsi-meet",
"cpe": "cpe:2.3:a:jitsi:jitsi"
},
"license": "Apache-2.0",
"maintainer": {
"name": "yalh76"
},
"previous_maintainers": [
{
"name": "ju",
"email": "julien.malik@paraiso.me"
}
],
"requirements": {
"yunohost": ">= 11.0.8"
},
"multi_instance": false,
"services": [
"nginx"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
}
]
}
}

115
manifest.toml Normal file
View file

@ -0,0 +1,115 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2
id = "jitsi"
name = "Jitsi Meet"
description.en = "Video conferencing web application"
description.fr = "Application web de conférence vidéo"
version = "2.0.9164~ynh1"
maintainers = ["yalh76"]
[upstream]
license = "Apache-2.0"
website = "https://jitsi.org/"
demo = "https://meet.jit.si/"
userdoc = "https://jitsi.org/user-faq/"
code = "https://github.com/jitsi/jitsi-meet"
[integration]
yunohost = ">= 11.2"
architectures = "all"
multi_instance = false
ldap = true
sso = false
disk = "50M"
ram.build = "50M"
ram.runtime = "50M"
[install]
[install.domain]
type = "domain"
[install.init_main_permission]
type = "group"
default = "visitors"
[resources]
[resources.sources]
[resources.sources.jitsi-meet-web]
url = "https://download.jitsi.org/stable/jitsi-meet-web_1.0.7712-1_all.deb"
sha256 = "43917b5d3fd003823933d84beaf822a8a9edaa8f06f897e13b6b575bba3f3c18"
format = "whatever"
extract = false
rename = "jitsi-meet-web.deb"
[resources.sources.jitsi-sctp]
url = "https://github.com/jitsi/jitsi-sctp/archive/45bf9f296167f79a52cdc1b0e93bbfa4dc8c4976.tar.gz"
sha256 = "1eead17b10d059bafe8e1b06a8351936b608e7514b131588deac61d24b859397"
[resources.sources.jitsi-jicofo]
url = "https://download.jitsi.org/stable/jicofo_1.0-1059-1_all.deb"
sha256 = "365051508e23ff99e3152fd3b414ec695ff920b16da9677a485f85aa91a9d549"
format = "whatever"
extract = false
rename = "jitsi-jicofo.deb"
[resources.sources.jitsi-videobridge]
url = "https://download.jitsi.org/stable/jitsi-videobridge2_2.3-64-g719465d1-1_all.deb"
sha256 = "cd960148768c846cc97ce37211490f5026a5c4bc81fc48ea2ea22024f83667ca"
format = "whatever"
extract = false
rename = "jitsi-videobridge.deb"
[resources.sources.usrsctp]
url = "https://github.com/sctplab/usrsctp/archive/8e12cd9e01fc94d2e84ea1afa351c845966e116e.tar.gz"
sha256 = "0574a31fecca543cf8e46c1bff441a3048ccf7d403da0543639db334e9a09b2f"
[resources.sources.jitsi-meet-prosody]
url = "https://download.jitsi.org/stable/jitsi-meet-prosody_1.0.7712-1_all.deb"
sha256 = "30e360d42c4badf07e7269979b8af71eac05d689febc367420e0ca4abecfb16a"
format = "whatever"
extract = false
rename = "jitsi-meet-prosody.deb"
[resources.sources.mod_auth_ldap]
url = "https://hg.prosody.im/prosody-modules/raw-file/tip/mod_auth_ldap/mod_auth_ldap.lua"
sha256 = "49c67ec86ec75ac8de93803be2ac7f907d1e9d3d22cd4c88fd48aaeed7a411e3"
format = "whatever"
extract = false
rename = "mod_auth_ldap.lua"
[resources.system_user]
[resources.install_dir]
[resources.ports]
main.default = 4443
main.exposed = "TCP"
videobridge.default = 10000
videobridge.exposed = "UDP"
component.default = 5347
[resources.permissions]
main.url = "/"
[resources.apt]
packages = [
"openjdk-17-jre-headless",
"debconf",
"procps",
"uuid-runtime",
"lua-ldap",
"prosody",
]
packages_from_raw_bash = """
if [[ "$YNH_ARCH" == "armhf" ]] || [[ "$YNH_ARCH" == "arm64" ]]; then
echo automake autoconf build-essential libtool git maven m4
fi
"""

View file

@ -4,27 +4,34 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
# dependencies used by the app
pkg_dependencies="openjdk-8-jre-headless|openjdk-11-jre-headless|openjdk-17-jre-headless debconf|debconf-2.0 procps uuid-runtime lua-ldap"
ynh_app_dependencies="prosody"
if [ $YNH_ARCH == "armhf" ]
then
pkg_dependencies_arm="automake autoconf build-essential libtool git maven m4"
pkg_dependencies="$pkg_dependencies $pkg_dependencies_arm"
pkg_extra_depedencies_arm="openjdk-8-jre|openjdk-11-jre|openjdk-17-jre openjdk-8-jre-headless|openjdk-11-jre-headless|openjdk-17-jre-headless openjdk-8-jdk|openjdk-11-jdk|openjdk-17-jdk openjdk-8-jdk-headless|openjdk-11-jdk-headless|openjdk-17-jdk-headless"
fi
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================
ynh_version_gt () _setup_sources() {
{ # Download, check integrity, uncompress and patch the source from app.src
dpkg --compare-versions "$1" gt "$2" declare -A packages=(
[jitsi-jicofo]="jicofo"
[jitsi-meet-prosody]="jitsi-meet/prosody-plugins"
[jitsi-meet-web]="jitsi-meet"
[jitsi-videobridge]="jitsi-videobridge"
)
for package in "${!packages[@]}"; do
ynh_setup_source --dest_dir="$install_dir/temp" --source_id="$package"
pushd "$install_dir/temp"
ar x "$package.deb" data.tar.xz
tar xf data.tar.xz
popd
mv "$install_dir/temp/usr/share/${packages[$package]}/" "$install_dir/$package/"
ynh_secure_remove --file="$install_dir/temp"
done
ynh_setup_source --dest_dir="$install_dir/jitsi-meet-prosody" --source_id=mod_auth_ldap
} }
ynh_jniwrapper_armhf () ynh_jniwrapper_armhf ()
{ {
@ -39,14 +46,12 @@ ynh_jniwrapper_armhf ()
packages_arm[jitsi-sctp]="jitsi-sctp" packages_arm[jitsi-sctp]="jitsi-sctp"
packages_arm[usrsctp]="jitsi-sctp/usrsctp/usrsctp" packages_arm[usrsctp]="jitsi-sctp/usrsctp/usrsctp"
for package_arm in "${!packages_arm[@]}" for package_arm in "${!packages_arm[@]}"; do
do
ynh_setup_source --dest_dir="$tempdir/${packages_arm[$package_arm]}" --source_id=$package_arm ynh_setup_source --dest_dir="$tempdir/${packages_arm[$package_arm]}" --source_id=$package_arm
done done
# needed to make compile works # needed to make compile works
if [ ! -d "$tempdir/jitsi-sctp/jniwrapper/native/src/main/resources/lib/linux-arm/" ] if [ ! -d "$tempdir/jitsi-sctp/jniwrapper/native/src/main/resources/lib/linux-arm/" ]; then
then
mkdir -p $tempdir/jitsi-sctp/jniwrapper/native/src/main/resources/lib/linux-arm/ mkdir -p $tempdir/jitsi-sctp/jniwrapper/native/src/main/resources/lib/linux-arm/
fi fi
@ -56,13 +61,13 @@ ynh_jniwrapper_armhf ()
popd popd
# rm official jniwrapper to copy # rm official jniwrapper to copy
original_jniwrapper=$(ls $final_path/jitsi-videobridge/lib/jniwrapper-native-*.jar) original_jniwrapper=$(ls $install_dir/jitsi-videobridge/lib/jniwrapper-native-*.jar)
ynh_secure_remove --file="$original_jniwrapper" ynh_secure_remove --file="$original_jniwrapper"
mv "$tempdir/jitsi-sctp/jniwrapper/native/target/jniwrapper-native-1.0-SNAPSHOT.jar" "$final_path/jitsi-videobridge/lib/" mv "$tempdir/jitsi-sctp/jniwrapper/native/target/jniwrapper-native-1.0-SNAPSHOT.jar" "$install_dir/jitsi-videobridge/lib/"
chmod 640 "$final_path/jitsi-videobridge/lib/jniwrapper-native-1.0-SNAPSHOT.jar" chmod 640 "$install_dir/jitsi-videobridge/lib/jniwrapper-native-1.0-SNAPSHOT.jar"
chown -R $app:$app "$final_path/jitsi-videobridge/lib/jniwrapper-native-1.0-SNAPSHOT.jar" chown -R $app:$app "$install_dir/jitsi-videobridge/lib/jniwrapper-native-1.0-SNAPSHOT.jar"
ynh_secure_remove --file="$tempdir" ynh_secure_remove --file="$tempdir"
} }

View file

@ -10,26 +10,6 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading settings..."
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)
#================================================= #=================================================
# DECLARE DATA AND CONF FILES TO BACKUP # DECLARE DATA AND CONF FILES TO BACKUP
#================================================= #=================================================
@ -39,29 +19,27 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup --src_path="$final_path" ynh_backup --src_path="$install_dir"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # SYSTEM CONFIGURATION
#================================================= #=================================================
# Backup the nginx configuration
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= # Backup the systemd service units
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_backup --src_path="/etc/logrotate.d/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup --src_path="/etc/systemd/system/$app-videobridge.service" ynh_backup --src_path="/etc/systemd/system/$app-videobridge.service"
ynh_backup --src_path="/etc/systemd/system/$app-jicofo.service" ynh_backup --src_path="/etc/systemd/system/$app-jicofo.service"
# Backup the logrotate configuration
ynh_backup --src_path="/etc/logrotate.d/$app"
# Backup the Fail2Ban config
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
#================================================= #=================================================
# BACKUP VARIOUS FILES # BACKUP VARIOUS FILES
#================================================= #=================================================
@ -70,6 +48,8 @@ ynh_backup --src_path="/etc/$app/"
ynh_backup --src_path="/etc/prosody/conf.avail/$domain.cfg.lua" ynh_backup --src_path="/etc/prosody/conf.avail/$domain.cfg.lua"
ynh_backup --src_path="/var/log/$app/"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -10,151 +10,57 @@ source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# MANAGE SCRIPT FAILURE # INITIALIZE AND STORE SETTINGS
#================================================= #=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url="/"
app=$YNH_APP_INSTANCE_NAME
#YOURSECRET3
focus_password=$(ynh_string_random --length=8)
#YOURSECRET1
videobridge_secret=$(ynh_string_random --length=8)
#YOURSECRET2
focus_secret=$(ynh_string_random --length=8)
#OTHER SECRET
turn_secret=$(ynh_string_random --length=8)
focus_user="focus" focus_user="focus"
focus_password=$(ynh_string_random --length=8)
ynh_app_setting_set --app="$app" --key=focus_user --value="$focus_user"
ynh_app_setting_set --app="$app" --key=focus_password --value="$focus_password"
videobridge_user="jvb" videobridge_user="jvb"
videobridge_secret=$(ynh_string_random --length=8)
ynh_app_setting_set --app="$app" --key=videobridge_user --value="$videobridge_user"
ynh_app_setting_set --app="$app" --key=videobridge_secret --value="$videobridge_secret"
focus_secret=$(ynh_string_random --length=8)
turn_secret=$(ynh_string_random --length=8)
ynh_app_setting_set --app="$app" --key=focus_secret --value="$focus_secret"
ynh_app_setting_set --app="$app" --key=turn_secret --value="$turn_secret"
max_memory=200 #125 mib with no user +1,5*50 users=75 mib max_memory=200 #125 mib with no user +1,5*50 users=75 mib
ynh_app_setting_set --app="$app" --key=max_memory --value="$max_memory"
#================================================= muc_nickname=$(uuidgen)
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS ynh_app_setting_set --app="$app" --key=muc_nickname --value="$muc_nickname"
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1
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
ynh_app_setting_set --app=$app --key=videobridge_user --value=$videobridge_user
ynh_app_setting_set --app=$app --key=videobridge_secret --value=$videobridge_secret
ynh_app_setting_set --app=$app --key=turn_secret --value=$turn_secret
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Finding an available port..." --weight=1
# Find an available port
port=4443
# Open this port
ynh_exec_warn_less yunohost firewall allow TCP $port
ynh_app_setting_set --app=$app --key=port --value=$port
# Find an available port
port_videobridge=10000
# Open this port
ynh_exec_warn_less yunohost firewall allow UDP $port_videobridge
ynh_app_setting_set --app=$app --key=port_videobridge --value=$port_videobridge
# Find an available port
port_component=5347
ynh_app_setting_set --app=$app --key=port_component --value=$port_component
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_apps --apps="$ynh_app_dependencies"
ynh_install_app_dependencies $pkg_dependencies
if [ $YNH_ARCH == "armhf" ]
then
ynh_script_progression --message="Installing specific arm dependencies..."
ynh_install_extra_app_dependencies --repo="deb http://security.debian.org/debian-security stretch/updates main" --package="$pkg_extra_depedencies_arm" --key="https://ftp-master.debian.org/keys/archive-key-9-security.asc"
fi
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Configuring system user..." --weight=1 ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user gpasswd --add prosody "$app"
ynh_system_user_create --username=$app --home_dir="$final_path" gpasswd --add www-data "$app"
gpasswd --add prosody $app
gpasswd --add www-data $app
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=1 ynh_script_progression --message="Setting up source files..." --weight=1
ynh_app_setting_set --app=$app --key=final_path --value=$final_path _setup_sources
# Download, check integrity, uncompress and patch the source from app.src
declare -A packages
packages[jitsi-jicofo]="jicofo"
packages[jitsi-meet-prosody]="jitsi-meet/prosody-plugins"
packages[jitsi-meet-web]="jitsi-meet"
packages[jitsi-videobridge]="jitsi-videobridge"
for package in "${!packages[@]}" chmod 750 "$install_dir"
do chmod -R o-rwx "$install_dir"
ynh_setup_source --dest_dir="$final_path/${package}_temp" --source_id=$package chown -R "$app:$app" "$install_dir"
pushd "$final_path/${package}_temp"
ar x $package.deb data.tar.xz
tar xf data.tar.xz
popd
mv "$final_path/${package}_temp/usr/share/${packages[$package]}/" "$final_path/${package}/"
ynh_secure_remove --file="$final_path/${package}_temp"
done
ynh_setup_source --dest_dir="$final_path/jitsi-meet-prosody" --source_id=mod_auth_ldap
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
#================================================= #=================================================
# NGINX CONFIGURATION # REPLACE JNIWRAPPER FOR ARMHF ARCHITECTURE IN JITSI-VIDEOBRIDGE
#================================================= #=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated NGINX config if [ "$YNH_ARCH" == "armhf" ]; then
ynh_add_nginx_config ynh_script_progression --message="Configuring jniwrapper for armhf ..." --weight=1
ynh_jniwrapper_armhf
fi
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
@ -163,16 +69,16 @@ ynh_add_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Configuring prosody..." --weight=1 ynh_script_progression --message="Configuring prosody..." --weight=1
ynh_add_config --template="../conf/prosody.cfg.lua" --destination="/etc/prosody/conf.avail/$domain.cfg.lua" ynh_add_config --template="prosody.cfg.lua" --destination="/etc/prosody/conf.avail/$domain.cfg.lua"
chmod 644 "/etc/prosody/conf.avail/$domain.cfg.lua" chmod 644 "/etc/prosody/conf.avail/$domain.cfg.lua"
ln -s "/etc/prosody/conf.avail/$domain.cfg.lua" "/etc/prosody/conf.d/$domain.cfg.lua" ln -s "/etc/prosody/conf.avail/$domain.cfg.lua" "/etc/prosody/conf.d/$domain.cfg.lua"
echo | prosodyctl cert generate $domain echo | ynh_exec_warn_less prosodyctl cert generate "$domain"
ln -sf "/var/lib/prosody/$domain.key" "/etc/prosody/certs/$domain.key" ln -sf "/var/lib/prosody/$domain.key" "/etc/prosody/certs/$domain.key"
ln -sf "/var/lib/prosody/$domain.crt" "/etc/prosody/certs/$domain.crt" ln -sf "/var/lib/prosody/$domain.crt" "/etc/prosody/certs/$domain.crt"
ln -sf "/var/lib/prosody/$domain.crt" "/usr/local/share/ca-certificates/$domain.crt" ln -sf "/var/lib/prosody/$domain.crt" "/usr/local/share/ca-certificates/$domain.crt"
echo | prosodyctl cert generate "auth.$domain" echo | ynh_exec_warn_less prosodyctl cert generate "auth.$domain"
ln -sf "/var/lib/prosody/auth.$domain.key" "/etc/prosody/certs/auth.$domain.key" ln -sf "/var/lib/prosody/auth.$domain.key" "/etc/prosody/certs/auth.$domain.key"
ln -sf "/var/lib/prosody/auth.$domain.crt" "/etc/prosody/certs/auth.$domain.crt" ln -sf "/var/lib/prosody/auth.$domain.crt" "/etc/prosody/certs/auth.$domain.crt"
ln -sf "/var/lib/prosody/auth.$domain.crt" "/usr/local/share/ca-certificates/auth.$domain.crt" ln -sf "/var/lib/prosody/auth.$domain.crt" "/usr/local/share/ca-certificates/auth.$domain.crt"
@ -182,44 +88,24 @@ update-ca-certificates -f
ynh_systemd_action --service_name="prosody" --action="restart" ynh_systemd_action --service_name="prosody" --action="restart"
prosodyctl register "$focus_user" "auth.$domain" "$focus_password" prosodyctl register "$focus_user" "auth.$domain" "$focus_password"
prosodyctl register "$videobridge_user" "auth.$domain" "$videobridge_secret" prosodyctl register "$videobridge_user" "auth.$domain" "$videobridge_secret"
prosodyctl mod_roster_command subscribe "$focus_user.$domain" "$focus_user@auth.$domain"
prosodyctl mod_roster_command subscribe $focus_user.$domain $focus_user@auth.$domain
#================================================= #=================================================
# CONFIGURE JITSI-VIDEOBRIDGE # CONFIGURE JITSI-VIDEOBRIDGE
#================================================= #=================================================
ynh_script_progression --message="Configuring Jitsi-Videobridge..." --weight=1 ynh_script_progression --message="Configuring Jitsi-Videobridge..." --weight=1
public_ipv4="$(curl ip.yunohost.org)" || true public_ipv4="$(curl --no-progress-meter ip.yunohost.org)" || true
private_ipv4="$(ip route get 1 | sed -n 's/^.*src \([0-9.]*\) .*$/\1/p')" || true private_ipv4="$(ip route get 1 | sed -n 's/^.*src \([0-9.]*\) .*$/\1/p')" || true
muc_nickname=$(uuidgen)
ynh_app_setting_set --app=$app --key=muc_nickname --value=$muc_nickname
mkdir -p "/etc/$app/videobridge" mkdir -p "/etc/$app/videobridge"
ynh_add_config --template="../conf/jitsi-videobridge-callstats-java-sdk.properties" --destination="/etc/$app/videobridge/callstats-java-sdk.properties" ynh_add_config --template="jitsi-videobridge-callstats-java-sdk.properties" --destination="/etc/$app/videobridge/callstats-java-sdk.properties"
ynh_add_config --template="jitsi-videobridge-jvb.conf" --destination="/etc/$app/videobridge/jvb.conf"
ynh_add_config --template="../conf/jitsi-videobridge-jvb.conf" --destination="/etc/$app/videobridge/jvb.conf" ynh_add_config --template="jitsi-videobridge-logging.properties" --destination="/etc/$app/videobridge/logging.properties"
ynh_add_config --template="jitsi-videobridge-sip-communicator.properties" --destination="/etc/$app/videobridge/sip-communicator.properties"
ynh_add_config --template="../conf/jitsi-videobridge-logging.properties" --destination="/etc/$app/videobridge/logging.properties" ynh_add_config --template="jitsi-videobridge.config" --destination="/etc/$app/videobridge/config"
ynh_add_config --template="../conf/jitsi-videobridge-sip-communicator.properties" --destination="/etc/$app/videobridge/sip-communicator.properties"
ynh_add_config --template="../conf/jitsi-videobridge.config" --destination="/etc/$app/videobridge/config"
#=================================================
# REPLACE JNIWRAPPER FOR ARMHF ARCHITECTURE IN JITSI-VIDEOBRIDGE
#=================================================
if [ $YNH_ARCH == "armhf" ]
then
ynh_script_progression --message="Configuring jniwrapper for armhf ..." --weight=1
ynh_jniwrapper_armhf
fi
#================================================= #=================================================
# CONFIGURE JITSI-JICOFO # CONFIGURE JITSI-JICOFO
@ -228,11 +114,9 @@ ynh_script_progression --message="Configuring Jitsi-Jicofo..." --weight=1
mkdir -p "/etc/$app/jicofo" mkdir -p "/etc/$app/jicofo"
ynh_add_config --template="../conf/jitsi-jicofo-config" --destination="/etc/$app/jicofo/config" ynh_add_config --template="jitsi-jicofo-config" --destination="/etc/$app/jicofo/config"
ynh_add_config --template="jitsi-jicofo-jicofo.conf" --destination="/etc/$app/jicofo/jicofo.conf"
ynh_add_config --template="../conf/jitsi-jicofo-jicofo.conf" --destination="/etc/$app/jicofo/jicofo.conf" ynh_add_config --template="jitsi-jicofo-logging.properties" --destination="/etc/$app/jicofo/logging.properties"
ynh_add_config --template="../conf/jitsi-jicofo-logging.properties" --destination="/etc/$app/jicofo/logging.properties"
#================================================= #=================================================
# CONFIGURE JITSI-MEET # CONFIGURE JITSI-MEET
@ -241,52 +125,37 @@ ynh_script_progression --message="Configuring Jitsi-Meet..." --weight=1
mkdir -p "/etc/$app/meet" mkdir -p "/etc/$app/meet"
ynh_add_config --template="../conf/jitsi-meet-config.js" --destination="/etc/$app/meet/$domain-config.js" ynh_add_config --template="jitsi-meet-config.js" --destination="/etc/$app/meet/$domain-config.js"
chmod 644 "/etc/$app/meet/$domain-config.js" chmod 644 "/etc/$app/meet/$domain-config.js"
#=================================================
# CREATE LOG DIR
#=================================================
ynh_script_progression --message="Creating log dir..." --weight=1
mkdir -p "/var/log/$app"
chown -R $app: /var/log/$app
chmod -R 770 /var/log/$app
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
ynh_script_progression --message="Securing files and directories..." --weight=1 ynh_script_progression --message="Securing files and directories..." --weight=1
# Set permissions to app files # Set permissions to app files
chown -R $app: /etc/$app chown -R "$app:" "/etc/$app"
#================================================= #=================================================
# SETUP SYSTEMD # SYSTEM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1 ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config --service=$app-videobridge --template="jitsi-videobridge.service" ynh_add_systemd_config --service="$app-videobridge" --template="jitsi-videobridge.service"
ynh_add_systemd_config --service=$app-jicofo --template="jitsi-jicofo.service" yunohost service add "$app-videobridge" --log "/var/log/$app/$app-videobridge.log" --needs_exposed_ports "$port" "$port_videobridge"
#================================================= ynh_add_systemd_config --service="$app-jicofo" --template="jitsi-jicofo.service"
# GENERIC FINALIZATION yunohost service add "$app-jicofo" --log "/var/log/$app/$app-jicofo.log"
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
ynh_use_logrotate ynh_use_logrotate
#================================================= chown -R "$app:" "/var/log/$app"
# INTEGRATE SERVICE IN YUNOHOST chmod -R 770 "/var/log/$app"
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app-videobridge --log "/var/log/$app/$app-videobridge.log" --needs_exposed_ports $port $port_videobridge
yunohost service add $app-jicofo --log "/var/log/$app/$app-jicofo.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
@ -294,23 +163,8 @@ yunohost service add $app-jicofo --log "/var/log/$app/$app-jicofo.log"
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app-jicofo --action="start" --log_path="/var/log/$app/$app-jicofo.log" ynh_systemd_action --service_name="$app-jicofo" --action="start" --log_path="/var/log/$app/$app-jicofo.log"
ynh_systemd_action --service_name=$app-videobridge --action="start" --log_path="/var/log/$app/$app-videobridge.log" ynh_systemd_action --service_name="$app-videobridge" --action="start" --log_path="/var/log/$app/$app-videobridge.log"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public
ynh_permission_update --permission="main" --add="visitors"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -10,63 +10,36 @@ source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # REMOVE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Loading settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port_videobridge=$(ynh_app_setting_get --app=$app --key=port_videobridge)
port_component=$(ynh_app_setting_get --app=$app --key=port_component)
focus_user=$(ynh_app_setting_get --app=$app --key=focus_user)
videobridge_user=$(ynh_app_setting_get --app=$app --key=videobridge_user)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# 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-videobridge >/dev/null if ynh_exec_warn_less yunohost service status "$app-videobridge" >/dev/null; then
then yunohost service remove "$app-videobridge"
ynh_script_progression --message="Removing $app-videobridge service..." --weight=1
yunohost service remove $app-videobridge
fi fi
if ynh_exec_warn_less yunohost service status $app-jicofo >/dev/null if ynh_exec_warn_less yunohost service status "$app-jicofo" >/dev/null; then
then yunohost service remove "$app-jicofo"
ynh_script_progression --message="Removing $app-jicofo service..." --weight=1
yunohost service remove $app-jicofo
fi fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config --service=$app-videobridge ynh_remove_systemd_config --service="$app-videobridge"
ynh_remove_systemd_config --service=$app-jicofo ynh_remove_systemd_config --service="$app-jicofo"
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
ynh_remove_logrotate ynh_remove_logrotate
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#================================================= #=================================================
# RECONFIGURE PROSODY # RECONFIGURE PROSODY
#================================================= #=================================================
ynh_script_progression --message="Reconfiguring Prosody..." --weight=1 ynh_script_progression --message="Reconfiguring Prosody..." --weight=1
prosodyctl deluser $focus_user@auth.$domain || true prosodyctl deluser "$focus_user@auth.$domain" || true
prosodyctl deluser $videobridge_user@auth.$domain || true prosodyctl deluser "$videobridge_user@auth.$domain" || true
# Remove domain conf template # Remove domain conf template
ynh_secure_remove --file="/etc/prosody/conf.d/$domain.cfg.lua" ynh_secure_remove --file="/etc/prosody/conf.d/$domain.cfg.lua"
@ -85,54 +58,19 @@ ynh_secure_remove --file="/usr/local/share/ca-certificates/auth.$domain.crt"
update-ca-certificates -f update-ca-certificates -f
gpasswd --delete prosody "$app"
ynh_systemd_action --service_name=prosody --action=restart ynh_systemd_action --service_name=prosody --action=restart
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1 ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies ynh_app_setting_delete --app="$app" --key=require_prosody
ynh_remove_app_dependencies
# Remove Prosody
ynh_app_setting_delete --app=$app --key=require_prosody
gpasswd --delete prosody $app
ynh_remove_apps ynh_remove_apps
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $port$"
then
ynh_script_progression --message="Closing port $port..." --weight=1
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
if yunohost firewall list | grep -q "\- $port_videobridge$"
then
ynh_script_progression --message="Closing port $port_videobridge..." --weight=1
ynh_exec_warn_less yunohost firewall disallow UDP $port_videobridge
fi
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE
#================================================= #=================================================
@ -146,17 +84,6 @@ ynh_secure_remove --file="/etc/$app"
# Remove the log files # Remove the log files
ynh_secure_remove --file="/var/log/$app" ynh_secure_remove --file="/var/log/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
gpasswd --delete www-data $app
# Delete a system user
ynh_system_user_delete --username=$app
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -10,102 +10,26 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
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)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 ynh_script_progression --message="Reconfiguring the dedicated system user..." --weight=1
# Create the dedicated user (if not existing) gpasswd --add prosody "$app"
ynh_system_user_create --username=$app --home_dir="$final_path" gpasswd --add www-data "$app"
gpasswd --add www-data $app
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$install_dir"
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R $app:$app "$final_path" chown -R "$app:$app" "$install_dir"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies
ynh_install_apps --apps="$ynh_app_dependencies"
ynh_install_app_dependencies $pkg_dependencies
if [ $YNH_ARCH == "armhf" ]
then
ynh_script_progression --message="Installing specific arm dependencies..." --weight=1
ynh_install_extra_app_dependencies --repo="deb http://security.debian.org/debian-security stretch/updates main" --package="$pkg_extra_depedencies_arm" --key="https://ftp-master.debian.org/keys/archive-key-9-security.asc"
fi
gpasswd --add prosody $app
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# CONFIGURE FIREWALL
#=================================================
ynh_script_progression --message="Configuring firewall..." --weight=1
# Open this port
ynh_exec_warn_less yunohost firewall allow TCP $port
ynh_exec_warn_less yunohost firewall allow UDP $port_videobridge
#================================================= #=================================================
# CONFIGURE PROSODY # CONFIGURE PROSODY
@ -116,9 +40,11 @@ ynh_restore_file --origin_path="/etc/prosody/conf.avail/$domain.cfg.lua"
chmod 644 "/etc/prosody/conf.avail/$domain.cfg.lua" chmod 644 "/etc/prosody/conf.avail/$domain.cfg.lua"
ln -s "/etc/prosody/conf.avail/$domain.cfg.lua" "/etc/prosody/conf.d/$domain.cfg.lua" ln -s "/etc/prosody/conf.avail/$domain.cfg.lua" "/etc/prosody/conf.d/$domain.cfg.lua"
ln -sf /var/lib/prosody/$domain.key /etc/prosody/certs/$domain.key echo | ynh_exec_warn_less prosodyctl cert generate "$domain"
ln -sf /var/lib/prosody/$domain.crt /etc/prosody/certs/$domain.crt ln -sf "/var/lib/prosody/$domain.key" "/etc/prosody/certs/$domain.key"
ln -sf "/var/lib/prosody/$domain.crt" "/etc/prosody/certs/$domain.crt"
echo | ynh_exec_warn_less prosodyctl cert generate "auth.$domain"
ln -sf "/var/lib/prosody/auth.$domain.key" "/etc/prosody/certs/auth.$domain.key" ln -sf "/var/lib/prosody/auth.$domain.key" "/etc/prosody/certs/auth.$domain.key"
ln -sf "/var/lib/prosody/auth.$domain.crt" "/etc/prosody/certs/auth.$domain.crt" ln -sf "/var/lib/prosody/auth.$domain.crt" "/etc/prosody/certs/auth.$domain.crt"
ln -sf "/var/lib/prosody/auth.$domain.crt" "/usr/local/share/ca-certificates/auth.$domain.crt" ln -sf "/var/lib/prosody/auth.$domain.crt" "/usr/local/share/ca-certificates/auth.$domain.crt"
@ -128,67 +54,42 @@ update-ca-certificates -f
ynh_systemd_action --service_name="prosody" --action="restart" ynh_systemd_action --service_name="prosody" --action="restart"
prosodyctl register "$focus_user" "auth.$domain" "$focus_password" prosodyctl register "$focus_user" "auth.$domain" "$focus_password"
prosodyctl register "$videobridge_user" "auth.$domain" "$videobridge_secret" prosodyctl register "$videobridge_user" "auth.$domain" "$videobridge_secret"
prosodyctl mod_roster_command subscribe "$focus_user.$domain" "$focus_user@auth.$domain"
prosodyctl mod_roster_command subscribe $focus_user.$domain $focus_user@auth.$domain
#================================================= #=================================================
# RESTORE THE APP CONFIG # RESTORE SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Restoring the app config..." --weight=1 ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/$app" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
chmod 644 "/etc/$app/meet/$domain-config.js"
#=================================================
# CREATE LOG DIR
#=================================================
ynh_script_progression --message="Creating log dir..." --weight=1
mkdir -p "/var/log/$app"
chown -R $app: /var/log/$app
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
ynh_restore_file --origin_path="/etc/systemd/system/$app-videobridge.service" ynh_restore_file --origin_path="/etc/systemd/system/$app-videobridge.service"
systemctl enable $app-videobridge.service --quiet systemctl enable "$app-videobridge.service" --quiet
ynh_restore_file --origin_path="/etc/systemd/system/$app-jicofo.service" yunohost service add "$app-videobridge" --log "/var/log/$app/$app-videobridge.log" --needs_exposed_ports $port $port_videobridge
systemctl enable $app-jicofo.service --quiet
#================================================= ynh_restore_file --origin_path="/etc/systemd/system/$app-jicofo.service"
# RESTORE THE LOGROTATE CONFIGURATION systemctl enable "$app-jicofo.service" --quiet
#================================================= yunohost service add "$app-jicofo" --log "/var/log/$app/$app-jicofo.log"
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
ynh_restore_file --origin_path="/etc/logrotate.d/$app" ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # RESTORE VARIOUS FILES
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app-videobridge --log "/var/log/$app/$app-videobridge.log" --needs_exposed_ports $port $port_videobridge ynh_restore_file --origin_path="/etc/$app/"
yunohost service add $app-jicofo --log "/var/log/$app/$app-jicofo.log" chmod 644 "/etc/$app/meet/$domain-config.js"
ynh_restore_file --origin_path="/var/log/$app/"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_systemd_action --service_name=$app-jicofo --action="start" --log_path="/var/log/$app/$app-jicofo.log" ynh_systemd_action --service_name="$app-jicofo" --action="start" --log_path="/var/log/$app/$app-jicofo.log"
ynh_systemd_action --service_name=$app-videobridge --action="start" --log_path="/var/log/$app/$app-videobridge.log" ynh_systemd_action --service_name="$app-videobridge" --action="start" --log_path="/var/log/$app/$app-videobridge.log"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload

View file

@ -9,55 +9,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
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)
videobridge_user=$(ynh_app_setting_get --app=$app --key=videobridge_user)
videobridge_secret=$(ynh_app_setting_get --app=$app --key=videobridge_secret)
turn_secret=$(ynh_app_setting_get --app=$app --key=turn_secret)
muc_nickname=$(ynh_app_setting_get --app=$app --key=muc_nickname)
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)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..." --weight=1
upgrade_type=$(ynh_check_app_version_changed)
current_version=$(ynh_read_manifest --manifest="/etc/yunohost/apps/$app/manifest.json" --manifest_key="version" || echo 1.0)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# 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
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#================================================= #=================================================
@ -65,182 +16,81 @@ ynh_abort_if_errors
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app-videobridge --action="stop" --log_path="/var/log/$app/$app-videobridge.log" ynh_systemd_action --service_name="$app-videobridge" --action="stop" --log_path="/var/log/$app/$app-videobridge.log"
ynh_systemd_action --service_name=$app-jicofo --action="stop" --log_path="/var/log/$app/$app-jicofo.log" ynh_systemd_action --service_name="$app-jicofo" --action="stop" --log_path="/var/log/$app/$app-jicofo.log"
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If final_path doesn't exist, create it
if [ -z "$final_path" ]; then
final_path=/var/www/$app
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 max_memory doesn't exist, create it and set to default 75 mb value
if [ -z "$max_memory" ]; then if [ -z "${max_memory:-}" ]; then
max_memory=200 max_memory=200
ynh_app_setting_set --app=$app --key=max_memory --value=$max_memory ynh_app_setting_set --app="$app" --key=max_memory --value="$max_memory"
fi fi
#================================================= gpasswd --add prosody "$app"
# CREATE DEDICATED USER gpasswd --add www-data "$app"
#=================================================
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"
gpasswd --add www-data $app
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=1 ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src _setup_sources
declare -A packages
packages[jitsi-jicofo]="jicofo"
packages[jitsi-meet-prosody]="jitsi-meet/prosody-plugins"
packages[jitsi-meet-web]="jitsi-meet"
packages[jitsi-videobridge]="jitsi-videobridge"
for package in "${!packages[@]}" chmod 750 "$install_dir"
do chmod -R o-rwx "$install_dir"
ynh_secure_remove --file="$final_path/${package}" chown -R "$app:$app" "$install_dir"
ynh_setup_source --dest_dir="$final_path/${package}_temp" --source_id=$package
pushd "$final_path/${package}_temp"
ar x $package.deb data.tar.xz
tar xf data.tar.xz
popd
mv "$final_path/${package}_temp/usr/share/${packages[$package]}/" "$final_path/${package}/" #=================================================
ynh_secure_remove --file="$final_path/${package}_temp" # REPLACE JNIWRAPPER FOR ARMHF ARCHITECTURE IN JITSI-VIDEOBRIDGE
done #=================================================
ynh_setup_source --dest_dir="$final_path/jitsi-meet-prosody" --source_id=mod_auth_ldap if [ "$YNH_ARCH" == "armhf" ]; then
ynh_script_progression --message="Configuring jniwrapper for armhf ..." --weight=1
ynh_jniwrapper_armhf
fi fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_install_apps --apps="$ynh_app_dependencies"
ynh_install_app_dependencies $pkg_dependencies
if [ $YNH_ARCH == "armhf" ]
then
ynh_script_progression --message="Installing specific arm dependencies..." --weight=1
ynh_install_extra_app_dependencies --repo="deb http://security.debian.org/debian-security stretch/updates main" --package="$pkg_extra_depedencies_arm" --key="https://ftp-master.debian.org/keys/archive-key-9-security.asc"
fi
gpasswd --add prosody $app
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC UPGRADE
#=================================================
# CONFIGURE FIREWALL
#=================================================
ynh_script_progression --message="Configuring firewall..." --weight=1
# Open this port
ynh_exec_warn_less yunohost firewall allow TCP $port
ynh_exec_warn_less yunohost firewall allow UDP $port_videobridge
#================================================= #=================================================
# CONFIGURE PROSODY # CONFIGURE PROSODY
#================================================= #=================================================
ynh_script_progression --message="Configuring Prosody..." --weight=1 ynh_script_progression --message="Configuring Prosody..." --weight=1
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_add_config --template="../conf/prosody.cfg.lua" --destination="/etc/prosody/conf.avail/$domain.cfg.lua" ynh_add_config --template="../conf/prosody.cfg.lua" --destination="/etc/prosody/conf.avail/$domain.cfg.lua"
chmod 644 "/etc/prosody/conf.avail/$domain.cfg.lua" chmod 644 "/etc/prosody/conf.avail/$domain.cfg.lua"
fi
#================================================= #=================================================
# CONFIGURE JITSI-VIDEOBRIDGE # CONFIGURE JITSI-VIDEOBRIDGE
#================================================= #=================================================
ynh_script_progression --message="Configuring Jitsi-Videobridge..." --weight=1 ynh_script_progression --message="Configuring Jitsi-Videobridge..." --weight=1
if [ "$upgrade_type" == "UPGRADE_APP" ] public_ipv4="$(curl --no-progress-meter ip.yunohost.org)" || true
then
public_ipv4="$(curl ip.yunohost.org)" || true
private_ipv4="$(ip route get 1 | sed -n 's/^.*src \([0-9.]*\) .*$/\1/p')" || true private_ipv4="$(ip route get 1 | sed -n 's/^.*src \([0-9.]*\) .*$/\1/p')" || true
ynh_add_config --template="../conf/jitsi-videobridge-callstats-java-sdk.properties" --destination="/etc/$app/videobridge/callstats-java-sdk.properties" ynh_add_config --template="../conf/jitsi-videobridge-callstats-java-sdk.properties" --destination="/etc/$app/videobridge/callstats-java-sdk.properties"
ynh_add_config --template="../conf/jitsi-videobridge-jvb.conf" --destination="/etc/$app/videobridge/jvb.conf" ynh_add_config --template="../conf/jitsi-videobridge-jvb.conf" --destination="/etc/$app/videobridge/jvb.conf"
ynh_add_config --template="../conf/jitsi-videobridge-logging.properties" --destination="/etc/$app/videobridge/logging.properties" ynh_add_config --template="../conf/jitsi-videobridge-logging.properties" --destination="/etc/$app/videobridge/logging.properties"
ynh_add_config --template="../conf/jitsi-videobridge-sip-communicator.properties" --destination="/etc/$app/videobridge/sip-communicator.properties" ynh_add_config --template="../conf/jitsi-videobridge-sip-communicator.properties" --destination="/etc/$app/videobridge/sip-communicator.properties"
ynh_add_config --template="../conf/jitsi-videobridge.config" --destination="/etc/$app/videobridge/config" ynh_add_config --template="../conf/jitsi-videobridge.config" --destination="/etc/$app/videobridge/config"
fi
#=================================================
# REPLACE JNIWRAPPER FOR ARMHF ARCHITECTURE IN JITSI-VIDEOBRIDGE
#=================================================
if [ $YNH_ARCH == "armhf" ]
then
ynh_script_progression --message="Configuring jniwrapper for armhf ..." --weight=1
ynh_jniwrapper_armhf
fi
#================================================= #=================================================
# CONFIGURE JITSI-JICOFO # CONFIGURE JITSI-JICOFO
#================================================= #=================================================
ynh_script_progression --message="configuring Jitsi-Jicofo..." --weight=1 ynh_script_progression --message="configuring Jitsi-Jicofo..." --weight=1
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_add_config --template="../conf/jitsi-jicofo-config" --destination="/etc/$app/jicofo/config" ynh_add_config --template="../conf/jitsi-jicofo-config" --destination="/etc/$app/jicofo/config"
ynh_add_config --template="../conf/jitsi-jicofo-jicofo.conf" --destination="/etc/$app/jicofo/jicofo.conf" ynh_add_config --template="../conf/jitsi-jicofo-jicofo.conf" --destination="/etc/$app/jicofo/jicofo.conf"
ynh_add_config --template="../conf/jitsi-jicofo-logging.properties" --destination="/etc/$app/jicofo/logging.properties" ynh_add_config --template="../conf/jitsi-jicofo-logging.properties" --destination="/etc/$app/jicofo/logging.properties"
fi
#================================================= #=================================================
# CONFIGURE JITSI-MEET # CONFIGURE JITSI-MEET
#================================================= #=================================================
ynh_script_progression --message="Configuring Jitsi-Meet..." --weight=1 ynh_script_progression --message="Configuring Jitsi-Meet..." --weight=1
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_add_config --template="../conf/jitsi-meet-config.js" --destination="/etc/$app/meet/$domain-config.js" ynh_add_config --template="../conf/jitsi-meet-config.js" --destination="/etc/$app/meet/$domain-config.js"
chmod 644 "/etc/$app/meet/$domain-config.js" chmod 644 "/etc/$app/meet/$domain-config.js"
fi
#=================================================
# CREATE LOG DIR
#=================================================
ynh_script_progression --message="Creating log dir..." --weight=1
mkdir -p "/var/log/$app"
chown -R $app: /var/log/$app
chmod -R 770 /var/log/$app
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
@ -248,49 +98,36 @@ chmod -R 770 /var/log/$app
ynh_script_progression --message="Securing files and directories..." --weight=1 ynh_script_progression --message="Securing files and directories..." --weight=1
# Set permissions on app files # Set permissions on app files
chown -R $app: /etc/$app chown -R "$app:" "/etc/$app"
#================================================= #=================================================
# SETUP SYSTEMD # REAPPLY SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config --service=$app-videobridge --template="jitsi-videobridge.service" ynh_add_systemd_config --service="$app-videobridge" --template="jitsi-videobridge.service"
ynh_add_systemd_config --service=$app-jicofo --template="jitsi-jicofo.service" yunohost service add "$app-videobridge" --log "/var/log/$app/$app-videobridge.log" --needs_exposed_ports "$port" "$port_videobridge"
#================================================= ynh_add_systemd_config --service="$app-jicofo" --template="jitsi-jicofo.service"
# GENERIC FINALIZATION yunohost service add "$app-jicofo" --log "/var/log/$app/$app-jicofo.log"
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
# Use logrotate to manage app-specific logfile(s) # Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append ynh_use_logrotate --non-append
#================================================= chown -R "$app:" "/var/log/$app"
# INTEGRATE SERVICE IN YUNOHOST chmod -R 770 "/var/log/$app"
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app-videobridge --log "/var/log/$app/$app-videobridge.log" --needs_exposed_ports $port $port_videobridge
yunohost service add $app-jicofo --log "/var/log/$app/$app-jicofo.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app-jicofo --action="start" --log_path="/var/log/$app/$app-jicofo.log" ynh_systemd_action --service_name="$app-jicofo" --action="start" --log_path="/var/log/$app/$app-jicofo.log"
ynh_systemd_action --service_name=$app-videobridge --action="start" --log_path="/var/log/$app/$app-videobridge.log" ynh_systemd_action --service_name="$app-videobridge" --action="start" --log_path="/var/log/$app/$app-videobridge.log"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

15
tests.toml Normal file
View file

@ -0,0 +1,15 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
test_format = 1.0
[default]
# ------------
# Tests to run
# ------------
test_upgrade_from.f967b101.name = "1.0.4466~ynh1"
test_upgrade_from.ba635a58.name = "1.0.4466~ynh2"
test_upgrade_from.12d4758e.name = "1.0.5913~ynh1"
test_upgrade_from.afbc84d3.name = "1.0.5913~ynh3"
test_upgrade_from.4a043dfd.name = "2.0.8719~ynh2"