diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh deleted file mode 100644 index 90b5e7c..0000000 --- a/.github/workflows/updater.sh +++ /dev/null @@ -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 < 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 diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml deleted file mode 100644 index a56d7cb..0000000 --- a/.github/workflows/updater.yml +++ /dev/null @@ -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 ' - author: 'yunohost-bot ' - 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 diff --git a/README.md b/README.md index 5be805f..1c544c4 100644 --- a/README.md +++ b/README.md @@ -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) -## 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 * Official app website: diff --git a/README_fr.md b/README_fr.md index 92d24fd..5af2429 100644 --- a/README_fr.md +++ b/README_fr.md @@ -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) -## 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 * Site officiel de l’app : diff --git a/check_process b/check_process deleted file mode 100644 index c33fe9d..0000000 --- a/check_process +++ /dev/null @@ -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 diff --git a/conf/jitsi-jicofo.service b/conf/jitsi-jicofo.service index ab64bd9..b21c3fc 100644 --- a/conf/jitsi-jicofo.service +++ b/conf/jitsi-jicofo.service @@ -6,8 +6,8 @@ After=network.target EnvironmentFile=/etc/__APP__/jicofo/config Environment=LOGFILE=/var/log/__APP__/jitsi-jicofo.log User=__APP__ -WorkingDirectory=__FINALPATH__/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" +WorkingDirectory=__INSTALL_DIR__/jitsi-jicofo/ +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] WantedBy=multi-user.target diff --git a/conf/jitsi-jicofo.src b/conf/jitsi-jicofo.src deleted file mode 100644 index 317712b..0000000 --- a/conf/jitsi-jicofo.src +++ /dev/null @@ -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 diff --git a/conf/jitsi-meet-prosody.src b/conf/jitsi-meet-prosody.src deleted file mode 100644 index 268fc1f..0000000 --- a/conf/jitsi-meet-prosody.src +++ /dev/null @@ -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 diff --git a/conf/jitsi-meet-web.src b/conf/jitsi-meet-web.src deleted file mode 100644 index dc7f23b..0000000 --- a/conf/jitsi-meet-web.src +++ /dev/null @@ -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 diff --git a/conf/jitsi-sctp.src b/conf/jitsi-sctp.src deleted file mode 100644 index efc66c1..0000000 --- a/conf/jitsi-sctp.src +++ /dev/null @@ -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 diff --git a/conf/jitsi-videobridge.service b/conf/jitsi-videobridge.service index 4341d1a..1d40f04 100644 --- a/conf/jitsi-videobridge.service +++ b/conf/jitsi-videobridge.service @@ -17,8 +17,8 @@ TasksMax=65000 # allow more open files for this process LimitNPROC=65000 LimitNOFILE=65000 -WorkingDirectory=__FINALPATH__/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" +WorkingDirectory=__INSTALL_DIR__/jitsi-videobridge/ +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" [Install] diff --git a/conf/jitsi-videobridge.src b/conf/jitsi-videobridge.src deleted file mode 100644 index d4c934d..0000000 --- a/conf/jitsi-videobridge.src +++ /dev/null @@ -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 diff --git a/conf/mod_auth_ldap.src b/conf/mod_auth_ldap.src deleted file mode 100644 index 6fed26c..0000000 --- a/conf/mod_auth_ldap.src +++ /dev/null @@ -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 diff --git a/conf/nginx.conf b/conf/nginx.conf index 6d3f6f6..f19975c 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -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 more_set_headers "Content-Security-Policy: frame-ancestors 'self'"; @@ -15,14 +15,14 @@ location = /config.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 location ~ ^/(libs|css|static|images|fonts|lang|sounds|connection_optimization|.well-known)/(.*)$ { 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 if ($arg_v) { diff --git a/conf/prosody.cfg.lua b/conf/prosody.cfg.lua index 8e270ed..aad671d 100644 --- a/conf/prosody.cfg.lua +++ b/conf/prosody.cfg.lua @@ -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 muc_mapper_domain_base = "__DOMAIN__"; diff --git a/conf/usrsctp.src b/conf/usrsctp.src deleted file mode 100644 index 2d232cd..0000000 --- a/conf/usrsctp.src +++ /dev/null @@ -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 diff --git a/doc/DISCLAIMER.md b/doc/PRE_INSTALL.md similarity index 93% rename from doc/DISCLAIMER.md rename to doc/PRE_INSTALL.md index b033633..671c74b 100644 --- a/doc/DISCLAIMER.md +++ b/doc/PRE_INSTALL.md @@ -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) 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 +5. **Jitsi** is configured for 50 users maximum, this number can be increased in the Yunohost config panel diff --git a/doc/DISCLAIMER_fr.md b/doc/PRE_INSTALL_fr.md similarity index 100% rename from doc/DISCLAIMER_fr.md rename to doc/PRE_INSTALL_fr.md diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 54f07dc..0000000 --- a/manifest.json +++ /dev/null @@ -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" - } - ] - } -} diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..dfd7ff8 --- /dev/null +++ b/manifest.toml @@ -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 + """ diff --git a/scripts/_common.sh b/scripts/_common.sh index 03a6585..f3cb8e5 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,31 +4,38 @@ # 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 #================================================= -ynh_version_gt () -{ - dpkg --compare-versions "$1" gt "$2" +_setup_sources() { + # Download, check integrity, uncompress and patch the source from app.src + 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 () { - - # set openjdk-8 as default + + # set openjdk-8 as default # update-alternatives --set java /usr/lib/jvm/java-8-openjdk-armhf/jre/bin/java tempdir="$(mktemp -d)" @@ -39,30 +46,28 @@ ynh_jniwrapper_armhf () packages_arm[jitsi-sctp]="jitsi-sctp" packages_arm[usrsctp]="jitsi-sctp/usrsctp/usrsctp" - for package_arm in "${!packages_arm[@]}" - do - ynh_setup_source --dest_dir="$tempdir/${packages_arm[$package_arm]}" --source_id=$package_arm + for package_arm in "${!packages_arm[@]}"; do + ynh_setup_source --dest_dir="$tempdir/${packages_arm[$package_arm]}" --source_id=$package_arm done # needed to make compile works - if [ ! -d "$tempdir/jitsi-sctp/jniwrapper/native/src/main/resources/lib/linux-arm/" ] - then - mkdir -p $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 + mkdir -p $tempdir/jitsi-sctp/jniwrapper/native/src/main/resources/lib/linux-arm/ fi pushd "$tempdir/jitsi-sctp" - mvn package -DbuildSctp -DbuildNativeWrapper -DdeployNewJnilib -DskipTests - mvn package + mvn package -DbuildSctp -DbuildNativeWrapper -DdeployNewJnilib -DskipTests + mvn package popd - # rm official jniwrapper to copy - original_jniwrapper=$(ls $final_path/jitsi-videobridge/lib/jniwrapper-native-*.jar) + # rm official jniwrapper to copy + original_jniwrapper=$(ls $install_dir/jitsi-videobridge/lib/jniwrapper-native-*.jar) 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" - chown -R $app:$app "$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 "$install_dir/jitsi-videobridge/lib/jniwrapper-native-1.0-SNAPSHOT.jar" ynh_secure_remove --file="$tempdir" } diff --git a/scripts/backup b/scripts/backup index 392e32c..3a167ba 100644 --- a/scripts/backup +++ b/scripts/backup @@ -10,26 +10,6 @@ source ../settings/scripts/_common.sh 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 #================================================= @@ -39,29 +19,27 @@ ynh_print_info --message="Declaring files to be backed up..." # 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" -#================================================= -# SPECIFIC BACKUP -#================================================= -# BACKUP LOGROTATE -#================================================= - -ynh_backup --src_path="/etc/logrotate.d/$app" - -#================================================= -# BACKUP SYSTEMD -#================================================= - +# Backup the systemd service units ynh_backup --src_path="/etc/systemd/system/$app-videobridge.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 #================================================= @@ -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="/var/log/$app/" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index d4d4759..96472cd 100644 --- a/scripts/install +++ b/scripts/install @@ -10,151 +10,57 @@ source _common.sh 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_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_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 +ynh_app_setting_set --app="$app" --key=max_memory --value="$max_memory" -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -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 +muc_nickname=$(uuidgen) +ynh_app_setting_set --app="$app" --key=muc_nickname --value="$muc_nickname" #================================================= # CREATE DEDICATED USER #================================================= ynh_script_progression --message="Configuring system user..." --weight=1 -# Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" -gpasswd --add prosody $app -gpasswd --add www-data $app +gpasswd --add prosody "$app" +gpasswd --add www-data "$app" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 -ynh_app_setting_set --app=$app --key=final_path --value=$final_path -# 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" +_setup_sources -for package in "${!packages[@]}" -do - 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" -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" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R "$app:$app" "$install_dir" #================================================= -# 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 -ynh_add_nginx_config +if [ "$YNH_ARCH" == "armhf" ]; then + ynh_script_progression --message="Configuring jniwrapper for armhf ..." --weight=1 + ynh_jniwrapper_armhf +fi #================================================= # SPECIFIC SETUP @@ -163,16 +69,16 @@ ynh_add_nginx_config #================================================= 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" 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.crt" "/etc/prosody/certs/$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.crt" "/etc/prosody/certs/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" prosodyctl register "$focus_user" "auth.$domain" "$focus_password" - 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 #================================================= 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 -muc_nickname=$(uuidgen) -ynh_app_setting_set --app=$app --key=muc_nickname --value=$muc_nickname - 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="../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-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 +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="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="jitsi-videobridge.config" --destination="/etc/$app/videobridge/config" #================================================= # CONFIGURE JITSI-JICOFO @@ -228,11 +114,9 @@ ynh_script_progression --message="Configuring Jitsi-Jicofo..." --weight=1 mkdir -p "/etc/$app/jicofo" -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-logging.properties" --destination="/etc/$app/jicofo/logging.properties" +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="jitsi-jicofo-logging.properties" --destination="/etc/$app/jicofo/logging.properties" #================================================= # CONFIGURE JITSI-MEET @@ -241,52 +125,37 @@ ynh_script_progression --message="Configuring Jitsi-Meet..." --weight=1 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" -#================================================= -# 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 #================================================= ynh_script_progression --message="Securing files and directories..." --weight=1 # 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 -ynh_add_systemd_config --service=$app-videobridge --template="jitsi-videobridge.service" -ynh_add_systemd_config --service=$app-jicofo --template="jitsi-jicofo.service" +ynh_add_systemd_config --service="$app-videobridge" --template="jitsi-videobridge.service" +yunohost service add "$app-videobridge" --log "/var/log/$app/$app-videobridge.log" --needs_exposed_ports "$port" "$port_videobridge" -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 +ynh_add_systemd_config --service="$app-jicofo" --template="jitsi-jicofo.service" +yunohost service add "$app-jicofo" --log "/var/log/$app/$app-jicofo.log" # Use logrotate to manage application logfile(s) ynh_use_logrotate -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -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" +chown -R "$app:" "/var/log/$app" +chmod -R 770 "/var/log/$app" #================================================= # 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 # 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-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 +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" #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index ea7b87c..d7a6509 100644 --- a/scripts/remove +++ b/scripts/remove @@ -10,63 +10,36 @@ source _common.sh 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) -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 +# REMOVE SYSTEM CONFIGURATIONS #================================================= +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`) -if ynh_exec_warn_less yunohost service status $app-videobridge >/dev/null -then - ynh_script_progression --message="Removing $app-videobridge service..." --weight=1 - yunohost service remove $app-videobridge +if ynh_exec_warn_less yunohost service status "$app-videobridge" >/dev/null; then + yunohost service remove "$app-videobridge" fi -if ynh_exec_warn_less yunohost service status $app-jicofo >/dev/null -then - ynh_script_progression --message="Removing $app-jicofo service..." --weight=1 - yunohost service remove $app-jicofo +if ynh_exec_warn_less yunohost service status "$app-jicofo" >/dev/null; then + yunohost service remove "$app-jicofo" fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - # Remove the dedicated systemd config -ynh_remove_systemd_config --service=$app-videobridge -ynh_remove_systemd_config --service=$app-jicofo - -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 +ynh_remove_systemd_config --service="$app-videobridge" +ynh_remove_systemd_config --service="$app-jicofo" # Remove the app-specific logrotate config ynh_remove_logrotate +# Remove the dedicated NGINX config +ynh_remove_nginx_config + #================================================= # RECONFIGURE PROSODY #================================================= ynh_script_progression --message="Reconfiguring Prosody..." --weight=1 -prosodyctl deluser $focus_user@auth.$domain || true -prosodyctl deluser $videobridge_user@auth.$domain || true +prosodyctl deluser "$focus_user@auth.$domain" || true +prosodyctl deluser "$videobridge_user@auth.$domain" || true # Remove domain conf template 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 +gpasswd --delete prosody "$app" + 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 #================================================= ynh_script_progression --message="Removing dependencies..." --weight=1 -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - -# Remove Prosody -ynh_app_setting_delete --app=$app --key=require_prosody -gpasswd --delete prosody $app +ynh_app_setting_delete --app="$app" --key=require_prosody 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 #================================================= @@ -146,17 +84,6 @@ ynh_secure_remove --file="/etc/$app" # Remove the log files 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 #================================================= diff --git a/scripts/restore b/scripts/restore index 5aed508..1915a16 100644 --- a/scripts/restore +++ b/scripts/restore @@ -10,102 +10,26 @@ source ../settings/scripts/_common.sh 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 #================================================= # 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) -ynh_system_user_create --username=$app --home_dir="$final_path" -gpasswd --add www-data $app +gpasswd --add prosody "$app" +gpasswd --add www-data "$app" #================================================= # RESTORE THE APP MAIN DIR #================================================= 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 -R o-rwx "$final_path" -chown -R $app:$app "$final_path" - -#================================================= -# 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 +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R "$app:$app" "$install_dir" #================================================= # 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" 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 -ln -sf /var/lib/prosody/$domain.crt /etc/prosody/certs/$domain.crt +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.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.crt" "/etc/prosody/certs/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" prosodyctl register "$focus_user" "auth.$domain" "$focus_password" - 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" - -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/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/systemd/system/$app-videobridge.service" -systemctl enable $app-videobridge.service --quiet -ynh_restore_file --origin_path="/etc/systemd/system/$app-jicofo.service" -systemctl enable $app-jicofo.service --quiet +systemctl enable "$app-videobridge.service" --quiet +yunohost service add "$app-videobridge" --log "/var/log/$app/$app-videobridge.log" --needs_exposed_ports $port $port_videobridge -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 +ynh_restore_file --origin_path="/etc/systemd/system/$app-jicofo.service" +systemctl enable "$app-jicofo.service" --quiet +yunohost service add "$app-jicofo" --log "/var/log/$app/$app-jicofo.log" 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 -yunohost service add $app-jicofo --log "/var/log/$app/$app-jicofo.log" +ynh_restore_file --origin_path="/etc/$app/" +chmod 644 "/etc/$app/meet/$domain-config.js" + +ynh_restore_file --origin_path="/var/log/$app/" #================================================= # 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-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="$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=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index 9b31041..791d617 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,55 +9,6 @@ source _common.sh 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 #================================================= @@ -65,182 +16,81 @@ ynh_abort_if_errors #================================================= 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-jicofo --action="stop" --log_path="/var/log/$app/$app-jicofo.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" #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= 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 [ -z "$max_memory" ]; then - max_memory=200 - ynh_app_setting_set --app=$app --key=max_memory --value=$max_memory +if [ -z "${max_memory:-}" ]; then + max_memory=200 + ynh_app_setting_set --app="$app" --key=max_memory --value="$max_memory" fi -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" -gpasswd --add www-data $app +gpasswd --add prosody "$app" +gpasswd --add www-data "$app" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=1 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." --weight=1 +_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" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R "$app:$app" "$install_dir" - for package in "${!packages[@]}" - do - ynh_secure_remove --file="$final_path/${package}" - 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 +#================================================= +# REPLACE JNIWRAPPER FOR ARMHF ARCHITECTURE IN JITSI-VIDEOBRIDGE +#================================================= - 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 +if [ "$YNH_ARCH" == "armhf" ]; then + ynh_script_progression --message="Configuring jniwrapper for armhf ..." --weight=1 + ynh_jniwrapper_armhf 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 #================================================= 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" - chmod 644 "/etc/prosody/conf.avail/$domain.cfg.lua" -fi +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" #================================================= # CONFIGURE JITSI-VIDEOBRIDGE #================================================= ynh_script_progression --message="Configuring Jitsi-Videobridge..." --weight=1 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - public_ipv4="$(curl ip.yunohost.org)" || true - private_ipv4="$(ip route get 1 | sed -n 's/^.*src \([0-9.]*\) .*$/\1/p')" || 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 - 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-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.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 +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-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.config" --destination="/etc/$app/videobridge/config" #================================================= # CONFIGURE JITSI-JICOFO #================================================= 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-jicofo.conf" --destination="/etc/$app/jicofo/jicofo.conf" - - ynh_add_config --template="../conf/jitsi-jicofo-logging.properties" --destination="/etc/$app/jicofo/logging.properties" -fi +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-logging.properties" --destination="/etc/$app/jicofo/logging.properties" #================================================= # CONFIGURE JITSI-MEET #================================================= 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" - 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 +ynh_add_config --template="../conf/jitsi-meet-config.js" --destination="/etc/$app/meet/$domain-config.js" +chmod 644 "/etc/$app/meet/$domain-config.js" #================================================= # SECURE FILES AND DIRECTORIES @@ -248,49 +98,36 @@ chmod -R 770 /var/log/$app ynh_script_progression --message="Securing files and directories..." --weight=1 # 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 -ynh_add_systemd_config --service=$app-videobridge --template="jitsi-videobridge.service" -ynh_add_systemd_config --service=$app-jicofo --template="jitsi-jicofo.service" +ynh_add_systemd_config --service="$app-videobridge" --template="jitsi-videobridge.service" +yunohost service add "$app-videobridge" --log "/var/log/$app/$app-videobridge.log" --needs_exposed_ports "$port" "$port_videobridge" -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 +ynh_add_systemd_config --service="$app-jicofo" --template="jitsi-jicofo.service" +yunohost service add "$app-jicofo" --log "/var/log/$app/$app-jicofo.log" # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -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" +chown -R "$app:" "/var/log/$app" +chmod -R 770 "/var/log/$app" #================================================= # START SYSTEMD SERVICE #================================================= 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-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 +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" #================================================= # END OF SCRIPT diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..f6653ca --- /dev/null +++ b/tests.toml @@ -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"