From 1be4caaaf2787e614cd315ca8564573d4268032a Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 9 Apr 2021 00:27:39 +0200 Subject: [PATCH 01/28] Fix #216 --- manifest.json | 2 +- scripts/install | 5 ++++- scripts/restore | 2 +- scripts/upgrade | 5 ++++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index 5105873..f7eb226 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Video streaming platform using P2P directly in the web browser, connected to a federated network", "fr": "Plateforme de diffusion vidéo par P2P directement dans le navigateur, et connectée à un réseau fédéralisé" }, - "version": "3.1.0~ynh1", + "version": "3.1.0~ynh2", "url": "https://github.com/Chocobozzz/PeerTube", "license": "AGPL-3.0-only", "maintainer": [ diff --git a/scripts/install b/scripts/install index 98434c2..a2b1c90 100644 --- a/scripts/install +++ b/scripts/install @@ -149,7 +149,7 @@ ynh_script_progression --message="Creating the data directory..." mkdir -p "$datadir" # Give permission to the datadir -chown -R "$app":"$app" "$datadir" +chown -R $app:$app $datadir #================================================= # MODIFY A CONFIG FILE @@ -224,6 +224,9 @@ ynh_script_progression --message="Securing files and directories..." # Set permissions to app files chown -R $app:$app $final_path +# Give permission to the datadir +chown -R $app:$app $datadir + #================================================= # SETUP LOGROTATE #================================================= diff --git a/scripts/restore b/scripts/restore index 8b4b2e8..033dc18 100644 --- a/scripts/restore +++ b/scripts/restore @@ -92,7 +92,7 @@ ynh_restore_file --origin_path="$datadir" --not_mandatory mkdir -p "$datadir" # Give permission to the datadir -chown -R "$app":"$app" "$datadir" +chown -R $app:$app $datadir #================================================= # REINSTALL DEPENDENCIES diff --git a/scripts/upgrade b/scripts/upgrade index a8d7517..d960814 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -224,7 +224,7 @@ then fi # Give permission to the datadir -chown -R "$app":"$app" "$datadir" +chown -R $app:$app $datadir #================================================= # MODIFY A CONFIG FILE @@ -276,6 +276,9 @@ ynh_script_progression --message="Securing files and directories..." # Set permissions on app files chown -R $app:$app $final_path +# Give permission to the datadir +chown -R $app:$app $datadir + #================================================= # SETUP LOGROTATE #================================================= From 37d40d14f7529976a4e016e2b945e9686f5f290f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 9 Apr 2021 23:37:52 +0200 Subject: [PATCH 02/28] Apply example_ynh --- README.md | 4 ++-- README_fr.md | 4 ++-- check_process | 11 +++++------ manifest.json | 14 +------------- scripts/backup | 2 +- scripts/install | 4 ++-- scripts/remove | 2 +- scripts/restore | 8 ++++---- scripts/upgrade | 8 ++++---- 9 files changed, 22 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 8afc36f..a4c43f8 100644 --- a/README.md +++ b/README.md @@ -69,8 +69,8 @@ Want to see in action? #### Supported architectures -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/peertube%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/peertube/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/peertube%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/peertube/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/peertube.svg)](https://ci-apps.yunohost.org/ci/apps/peertube/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/peertube.svg)](https://ci-apps-arm.yunohost.org/ci/apps/peertube/) ## Links diff --git a/README_fr.md b/README_fr.md index f363581..70694f9 100644 --- a/README_fr.md +++ b/README_fr.md @@ -64,8 +64,8 @@ En regardant une vidéo, vous aidez l'hébergeur à la diffuser en devenant vous #### Architectures supportées -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/peertube%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/peertube/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/peertube%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/peertube/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/peertube.svg)](https://ci-apps.yunohost.org/ci/apps/peertube/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/peertube.svg)](https://ci-apps-arm.yunohost.org/ci/apps/peertube/) ## Liens diff --git a/check_process b/check_process index b4f25f8..184542e 100644 --- a/check_process +++ b/check_process @@ -1,8 +1,3 @@ -# See here for more informations -# https://github.com/YunoHost/package_check#syntax-check_process-file - -# Move this file from check_process.default to check_process when you have filled it. - ;; Test complet ; Manifest domain="domain.tld" (DOMAIN) @@ -29,10 +24,12 @@ upgrade=1 from_commit=10d79175a8a45137d271931cbd6d14e927400729 # 3.0.1~ynh1 upgrade=1 from_commit=5a74f4033eafa657fcd32a9713cd77ba0f4f79c9 + # 3.1.0~ynh2 + upgrade=1 from_commit=1be4caaaf2787e614cd315ca8564573d4268032a backup_restore=1 multi_instance=0 port_already_use=0 - change_url=0 + change_url=1 ;;; Options Email=anmol@datamol.org;yalh@yahoo.com Notification=yes @@ -49,4 +46,6 @@ Notification=yes name=2.4.0~ynh1 ; commit=5a74f4033eafa657fcd32a9713cd77ba0f4f79c9 name=3.0.1~ynh1 + ; commit=1be4caaaf2787e614cd315ca8564573d4268032a + name=3.1.0~ynh2 \ No newline at end of file diff --git a/manifest.json b/manifest.json index f7eb226..0fc6968 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Video streaming platform using P2P directly in the web browser, connected to a federated network", "fr": "Plateforme de diffusion vidéo par P2P directement dans le navigateur, et connectée à un réseau fédéralisé" }, - "version": "3.1.0~ynh2", + "version": "3.1.0~ynh3", "url": "https://github.com/Chocobozzz/PeerTube", "license": "AGPL-3.0-only", "maintainer": [ @@ -30,28 +30,16 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain name for PeerTube", - "fr": "Choisissez un nom de domaine pour PeerTube" - }, "example": "example.com" }, { "name": "admin", "type": "user", - "ask": { - "en": "Choose an admin user", - "fr": "Choisissez l'administrateur" - }, "example": "johndoe" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, "default": true } ] diff --git a/scripts/backup b/scripts/backup index 8c58481..1e20dde 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers diff --git a/scripts/install b/scripts/install index a2b1c90..0cc1db1 100644 --- a/scripts/install +++ b/scripts/install @@ -127,7 +127,7 @@ ynh_setup_source --dest_dir="$final_path" #================================================= ynh_script_progression --message="Configuring NGINX web server..." -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config "datadir" #================================================= @@ -240,7 +240,7 @@ ynh_use_logrotate --logfile="$datadir/logs/peertube.log" #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description "$app daemon for Peertube" --log "$datadir/logs/peertube.log" --needs_exposed_ports $rtmp_port +yunohost service add $app --description="$app daemon for Peertube" --log="$datadir/logs/peertube.log" --needs_exposed_ports $rtmp_port #================================================= # START SYSTEMD SERVICE diff --git a/scripts/remove b/scripts/remove index 7950022..1dfe2e4 100644 --- a/scripts/remove +++ b/scripts/remove @@ -79,7 +79,7 @@ ynh_secure_remove --file="$final_path" #================================================= ynh_script_progression --message="Removing NGINX web server configuration..." -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= diff --git a/scripts/restore b/scripts/restore index 033dc18..4ff69f3 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -23,7 +23,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -52,7 +52,7 @@ test ! -d $final_path \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." +ynh_script_progression --message="Restoring the NGINX web server configuration..." ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" @@ -145,7 +145,7 @@ systemctl enable $app.service --quiet #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description "$app daemon for Peertube" --log "$datadir/logs/peertube.log" --needs_exposed_ports $rtmp_port +yunohost service add $app --description="$app daemon for Peertube" --log="$datadir/logs/peertube.log" --needs_exposed_ports $rtmp_port #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index d960814..69422ea 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -100,7 +100,7 @@ if ! ynh_permission_exists --permission="api"; then fi #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." @@ -115,7 +115,7 @@ ynh_backup_before_upgrade ynh_app_setting_delete --app=$app --key=backup_core_only ynh_clean_setup () { - # restore it if the upgrade fails + # Restore it if the upgrade fails ynh_clean_check_starting ynh_restore_upgradebackup } @@ -174,7 +174,7 @@ fi #================================================= ynh_script_progression --message="Upgrading NGINX web server configuration..." -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config "datadir" #================================================= @@ -292,7 +292,7 @@ ynh_use_logrotate --non-append #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description "$app daemon for Peertube" --log "$datadir/logs/peertube.log" --needs_exposed_ports $rtmp_port +yunohost service add $app --description="$app daemon for Peertube" --log="$datadir/logs/peertube.log" --needs_exposed_ports $rtmp_port #================================================= # START SYSTEMD SERVICE From 768e7c4a50a8e2a63e1dcb39b5f953ad077539db Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 9 Apr 2021 23:51:13 +0200 Subject: [PATCH 03/28] Typo --- scripts/install | 2 +- scripts/remove | 2 +- scripts/restore | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 0cc1db1..d46d3a3 100644 --- a/scripts/install +++ b/scripts/install @@ -136,7 +136,7 @@ ynh_add_nginx_config "datadir" ynh_script_progression --message="Configuring system user..." # Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # SPECIFIC SETUP diff --git a/scripts/remove b/scripts/remove index 1dfe2e4..8149dd4 100644 --- a/scripts/remove +++ b/scripts/remove @@ -34,7 +34,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= -# 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 >/dev/null then ynh_script_progression --message="Removing $app service integration..." diff --git a/scripts/restore b/scripts/restore index 4ff69f3..24a99d4 100644 --- a/scripts/restore +++ b/scripts/restore @@ -69,7 +69,7 @@ ynh_restore_file --origin_path="$final_path" ynh_script_progression --message="Recreating the dedicated system user..." # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$final_path +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # RESTORE USER RIGHTS From 5a39e7ab86e546849154a075b7002559853e2422 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 19:38:56 +0200 Subject: [PATCH 04/28] Apply last example_ynh --- scripts/backup | 14 +++++------ scripts/install | 62 ++++++++++++++++++++++----------------------- scripts/restore | 39 +++++++++++++--------------- scripts/upgrade | 67 ++++++++++++++++++++----------------------------- 4 files changed, 82 insertions(+), 100 deletions(-) diff --git a/scripts/backup b/scripts/backup index 1e20dde..2fc99d4 100644 --- a/scripts/backup +++ b/scripts/backup @@ -63,13 +63,6 @@ ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/systemd/system/$app.service" -#================================================= -# BACKUP THE POSTGRESQL DATABASE -#================================================= -ynh_print_info --message="Backing up the PostgreSQL database..." - -ynh_psql_dump_db --database="$db_name" > db.sql - #================================================= # BACKUP THE DATA DIRECTORY #================================================= @@ -77,6 +70,13 @@ ynh_print_info --message="Backing up data directory..." ynh_backup --src_path="$datadir" --is_big +#================================================= +# BACKUP THE POSTGRESQL DATABASE +#================================================= +ynh_print_info --message="Backing up the PostgreSQL database..." + +ynh_psql_dump_db --database="$db_name" > db.sql + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index d46d3a3..07fe1fe 100644 --- a/scripts/install +++ b/scripts/install @@ -97,6 +97,14 @@ fi # Install Yarn ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." + +# Create a system user +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # CREATE A POSTGRESQL DATABASE #================================================= @@ -122,6 +130,10 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R root:$app "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -130,14 +142,6 @@ ynh_script_progression --message="Configuring NGINX web server..." # Create a dedicated NGINX config ynh_add_nginx_config "datadir" -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." - -# Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" - #================================================= # SPECIFIC SETUP #================================================= @@ -148,25 +152,15 @@ ynh_script_progression --message="Creating the data directory..." # Create app folders mkdir -p "$datadir" -# Give permission to the datadir -chown -R $app:$app $datadir - -#================================================= -# MODIFY A CONFIG FILE -#================================================= -ynh_script_progression --message="Modifying a config file..." - -ynh_add_config --template="../conf/production.yaml" --destination="$final_path/config/production.yaml" - -ynh_add_config --template="../conf/local-production.json" --destination="$final_path/config/local-production.json" +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R root:$app "$datadir" #================================================= # BUILD YARN DEPENDENCIES #================================================= ynh_script_progression --message="Building Yarn dependencies..." -chown -R "$app":"$app" $final_path - pushd "$final_path" ynh_use_nodejs ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --production --pure-lockfile @@ -180,6 +174,21 @@ ynh_script_progression --message="Configuring a systemd service..." # Create a dedicated systemd config ynh_add_systemd_config --others_var="ynh_node_load_PATH" +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a config file..." + +ynh_add_config --template="../conf/production.yaml" --destination="$final_path/config/production.yaml" + +chmod 400 "$final_path/config/production.yaml" +chown $app:$app "$final_path/config/production.yaml" + +ynh_add_config --template="../conf/local-production.json" --destination="$final_path/config/local-production.json" + +chmod 400 "$final_path/config/local-production.json" +chown $app:$app "$final_path/config/local-production.json" + #================================================= # START SYSTEMD SERVICE #================================================= @@ -216,17 +225,6 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." - -# Set permissions to app files -chown -R $app:$app $final_path - -# Give permission to the datadir -chown -R $app:$app $datadir - #================================================= # SETUP LOGROTATE #================================================= diff --git a/scripts/restore b/scripts/restore index 24a99d4..f1002f5 100644 --- a/scripts/restore +++ b/scripts/restore @@ -56,13 +56,6 @@ ynh_script_progression --message="Restoring the NGINX web server configuration.. ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE THE APP MAIN DIR -#================================================= -ynh_script_progression --message="Restoring the app main directory..." - -ynh_restore_file --origin_path="$final_path" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -72,12 +65,15 @@ ynh_script_progression --message="Recreating the dedicated system user..." ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= -# RESTORE USER RIGHTS +# RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring user rights..." +ynh_script_progression --message="Restoring the app main directory..." -# Restore permissions on app files -chown -R $app:$app $final_path +ynh_restore_file --origin_path="$final_path" + +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R root:$app "$final_path" #================================================= # SPECIFIC RESTORATION @@ -91,8 +87,17 @@ ynh_restore_file --origin_path="$datadir" --not_mandatory mkdir -p "$datadir" -# Give permission to the datadir -chown -R $app:$app $datadir +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R root:$app "$datadir" + +#================================================= +# OPEN A PORT +#================================================= +ynh_script_progression --message="Configuring firewall..." + +# Open the port +ynh_exec_warn_less yunohost firewall allow TCP $rtmp_port #================================================= # REINSTALL DEPENDENCIES @@ -124,14 +129,6 @@ ynh_psql_test_if_first_run ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name -#================================================= -# OPEN A PORT -#================================================= -ynh_script_progression --message="Configuring firewall..." - -# Open the port -ynh_exec_warn_less yunohost firewall allow TCP $rtmp_port - #================================================= # RESTORE SYSTEMD #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 69422ea..1ce2fad 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -100,20 +100,12 @@ if ! ynh_permission_exists --permission="api"; then fi #================================================= -# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." -# Inform the backup/restore process that it should not save the data directory -# Use only for the previous backup script that doesn't set 'is_big' -ynh_app_setting_set --app=$app --key=backup_core_only --value=1 - # Backup the current version of the app ynh_backup_before_upgrade - -# Remove the option backup_core_only after the backup. -ynh_app_setting_delete --app=$app --key=backup_core_only - ynh_clean_setup () { # Restore it if the upgrade fails ynh_clean_check_starting @@ -131,6 +123,14 @@ ynh_script_progression --message="Stopping a systemd service..." ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -169,6 +169,10 @@ then ynh_secure_remove --file="$tmpdir" fi +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R root:$app "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -202,14 +206,6 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app" yunohost tools regen-conf nginx -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # SPECIFIC UPGRADE #================================================= @@ -217,25 +213,27 @@ ynh_system_user_create --username=$app #================================================= ynh_script_progression --message="Creating the data directory..." -if [ ! -d "$datadir" ] -then - # Create app folders - mkdir -p "$datadir" -fi +# Create app folders +mkdir -p "$datadir" -# Give permission to the datadir -chown -R $app:$app $datadir +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R root:$app "$datadir" #================================================= -# MODIFY A CONFIG FILE +# UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Modifying a config file..." +ynh_script_progression --message="Updating a config file..." ynh_add_config --template="../conf/production.yaml" --destination="$final_path/config/production.yaml" -local_config="$final_path/config/local-production.json" -ynh_backup_if_checksum_is_different --file="$local_config" -ynh_store_file_checksum --file="$local_config" +chmod 400 "$final_path/config/production.yaml" +chown $app:$app "$final_path/config/production.yaml" + +ynh_add_config --template="../conf/local-production.json" --destination="$final_path/config/local-production.json" + +chmod 400 "$final_path/config/local-production.json" +chown $app:$app "$final_path/config/local-production.json" #================================================= # BUILD YARN DEPENDENCIES @@ -268,17 +266,6 @@ ynh_add_systemd_config --others_var="ynh_node_load_PATH" #================================================= # GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." - -# Set permissions on app files -chown -R $app:$app $final_path - -# Give permission to the datadir -chown -R $app:$app $datadir - #================================================= # SETUP LOGROTATE #================================================= From 55b28881bed32fb4859341b895c3aaff0f000ee9 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 11 Apr 2021 20:40:25 +0200 Subject: [PATCH 05/28] Fix rights --- scripts/install | 4 ++-- scripts/restore | 4 ++-- scripts/upgrade | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 07fe1fe..28ed43b 100644 --- a/scripts/install +++ b/scripts/install @@ -132,7 +132,7 @@ ynh_setup_source --dest_dir="$final_path" chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R root:$app "$final_path" +chown -R $app:$app "$final_path" #================================================= # NGINX CONFIGURATION @@ -154,7 +154,7 @@ mkdir -p "$datadir" chmod 750 "$datadir" chmod -R o-rwx "$datadir" -chown -R root:$app "$datadir" +chown -R $app:$app "$datadir" #================================================= # BUILD YARN DEPENDENCIES diff --git a/scripts/restore b/scripts/restore index f1002f5..9b06575 100644 --- a/scripts/restore +++ b/scripts/restore @@ -73,7 +73,7 @@ ynh_restore_file --origin_path="$final_path" chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R root:$app "$final_path" +chown -R $app:$app "$final_path" #================================================= # SPECIFIC RESTORATION @@ -89,7 +89,7 @@ mkdir -p "$datadir" chmod 750 "$datadir" chmod -R o-rwx "$datadir" -chown -R root:$app "$datadir" +chown -R $app:$app "$datadir" #================================================= # OPEN A PORT diff --git a/scripts/upgrade b/scripts/upgrade index 1ce2fad..d2a7031 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -171,7 +171,7 @@ fi chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R root:$app "$final_path" +chown -R $app:$app "$final_path" #================================================= # NGINX CONFIGURATION @@ -218,7 +218,7 @@ mkdir -p "$datadir" chmod 750 "$datadir" chmod -R o-rwx "$datadir" -chown -R root:$app "$datadir" +chown -R $app:$app "$datadir" #================================================= # UPDATE A CONFIG FILE From 082854402899d698a60494a4bc47b70eba924e50 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 11 Apr 2021 20:43:53 +0200 Subject: [PATCH 06/28] Several reorder --- scripts/_common.sh | 2 +- scripts/install | 18 +++++++++--------- scripts/restore | 2 +- scripts/upgrade | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 1441eb6..d6aa49f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,7 +7,7 @@ # dependencies used by the app pkg_dependencies="ffmpeg postgresql postgresql-contrib openssl g++ redis-server redis-tools mailutils apt-transport-https" -YNH_NODEJS_VERSION=14 +NODEJS_VERSION=14 #================================================= # PERSONAL HELPERS diff --git a/scripts/install b/scripts/install index 28ed43b..65b76d2 100644 --- a/scripts/install +++ b/scripts/install @@ -82,7 +82,7 @@ ynh_exec_warn_less yunohost firewall allow TCP $rtmp_port ynh_script_progression --message="Installing dependencies..." # Install nodejs -ynh_install_nodejs --nodejs_version=$YNH_NODEJS_VERSION +ynh_install_nodejs --nodejs_version=$NODEJS_VERSION # Install dependencies ynh_install_app_dependencies $pkg_dependencies @@ -166,14 +166,6 @@ pushd "$final_path" ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --production --pure-lockfile popd -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." - -# Create a dedicated systemd config -ynh_add_systemd_config --others_var="ynh_node_load_PATH" - #================================================= # ADD A CONFIGURATION #================================================= @@ -189,6 +181,14 @@ ynh_add_config --template="../conf/local-production.json" --destination="$final_ chmod 400 "$final_path/config/local-production.json" chown $app:$app "$final_path/config/local-production.json" +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Configuring a systemd service..." + +# Create a dedicated systemd config +ynh_add_systemd_config --others_var="ynh_node_load_PATH" + #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/restore b/scripts/restore index 9b06575..219f03e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -105,7 +105,7 @@ ynh_exec_warn_less yunohost firewall allow TCP $rtmp_port ynh_script_progression --message="Reinstalling dependencies..." # Install nodejs -ynh_install_nodejs --nodejs_version=$YNH_NODEJS_VERSION +ynh_install_nodejs --nodejs_version=$NODEJS_VERSION # Install dependencies ynh_install_app_dependencies $pkg_dependencies diff --git a/scripts/upgrade b/scripts/upgrade index d2a7031..73bb2d3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -107,8 +107,8 @@ ynh_script_progression --message="Backing up the app before upgrading (may take # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { - # Restore it if the upgrade fails ynh_clean_check_starting + # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script @@ -187,7 +187,7 @@ ynh_add_nginx_config "datadir" ynh_script_progression --message="Upgrading dependencies..." # Install nodejs -ynh_install_nodejs --nodejs_version=$YNH_NODEJS_VERSION +ynh_install_nodejs --nodejs_version=$NODEJS_VERSION # Install dependencies ynh_install_app_dependencies $pkg_dependencies From fd89035a375124a4efe4698009f62f75f1f7533f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 12 Apr 2021 08:22:21 +0200 Subject: [PATCH 07/28] Update check_process --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index 184542e..ce713f1 100644 --- a/check_process +++ b/check_process @@ -29,7 +29,7 @@ backup_restore=1 multi_instance=0 port_already_use=0 - change_url=1 + change_url=0 ;;; Options Email=anmol@datamol.org;yalh@yahoo.com Notification=yes From 290e1299fc823e6d217c9016e453d82862081e8e Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 14 Apr 2021 20:55:31 +0200 Subject: [PATCH 08/28] Fix cp --- scripts/upgrade | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 73bb2d3..bd2d62b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -143,10 +143,10 @@ then tmpdir="$(mktemp -d)" # Backup the config file in the temp dir - cp -a "$final_path/config/production.yaml" "$tmpdir/production.yaml" + cp -af "$final_path/config/production.yaml" "$tmpdir/production.yaml" if [ -s "$final_path/config/local-production.json" ] then - cp -a "$final_path/config/local-production.json" "$tmpdir/local-production.json" + cp -af "$final_path/config/local-production.json" "$tmpdir/local-production.json" fi # Remove the app directory securely @@ -156,11 +156,11 @@ then ynh_setup_source --dest_dir="$final_path" #Copy the admin saved settings from tmp directory to final path - cp -a "$tmpdir/production.yaml" "$final_path/config/production.yaml" + cp -af "$tmpdir/production.yaml" "$final_path/config/production.yaml" if [ -s "$tmpdir/local-production.json" ] then - cp -a "$tmpdir/local-production.json" "$final_path/config/local-production.json" + cp -af "$tmpdir/local-production.json" "$final_path/config/local-production.json" else cp ../conf/local-production.json "$final_path/config/local-production.json" fi From 0e66238cb963ac15c2273238a6b2ed24032179ef Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 15 Apr 2021 20:29:01 +0200 Subject: [PATCH 09/28] Fix chmod --- scripts/install | 4 ++-- scripts/restore | 4 ++-- scripts/upgrade | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 65b76d2..a48ecdc 100644 --- a/scripts/install +++ b/scripts/install @@ -130,7 +130,7 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" -chmod 750 "$final_path" +chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" @@ -152,7 +152,7 @@ ynh_script_progression --message="Creating the data directory..." # Create app folders mkdir -p "$datadir" -chmod 750 "$datadir" +chmod -R 750 "$datadir" chmod -R o-rwx "$datadir" chown -R $app:$app "$datadir" diff --git a/scripts/restore b/scripts/restore index 219f03e..639268f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -71,7 +71,7 @@ ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" -chmod 750 "$final_path" +chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" @@ -87,7 +87,7 @@ ynh_restore_file --origin_path="$datadir" --not_mandatory mkdir -p "$datadir" -chmod 750 "$datadir" +chmod -R 750 "$datadir" chmod -R o-rwx "$datadir" chown -R $app:$app "$datadir" diff --git a/scripts/upgrade b/scripts/upgrade index bd2d62b..e88c791 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -169,7 +169,7 @@ then ynh_secure_remove --file="$tmpdir" fi -chmod 750 "$final_path" +chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" @@ -216,7 +216,7 @@ ynh_script_progression --message="Creating the data directory..." # Create app folders mkdir -p "$datadir" -chmod 750 "$datadir" +chmod -R 750 "$datadir" chmod -R o-rwx "$datadir" chown -R $app:$app "$datadir" From ed96881283b5985dcea76a245133f2a8bc3d1caa Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 17 Apr 2021 15:35:19 +0200 Subject: [PATCH 10/28] Fix rights --- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index a48ecdc..42d51af 100644 --- a/scripts/install +++ b/scripts/install @@ -132,7 +132,7 @@ ynh_setup_source --dest_dir="$final_path" chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chown -R $app:www-data "$final_path" #================================================= # NGINX CONFIGURATION diff --git a/scripts/restore b/scripts/restore index 639268f..e210367 100644 --- a/scripts/restore +++ b/scripts/restore @@ -73,7 +73,7 @@ ynh_restore_file --origin_path="$final_path" chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chown -R $app:www-data "$final_path" #================================================= # SPECIFIC RESTORATION diff --git a/scripts/upgrade b/scripts/upgrade index e88c791..9b65839 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -171,7 +171,7 @@ fi chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chown -R $app:www-data "$final_path" #================================================= # NGINX CONFIGURATION From b5475a003c46897f7a91327f2a6e7ac4a5d6e40f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 17 Apr 2021 18:31:58 +0200 Subject: [PATCH 11/28] Fix recursive chmod --- scripts/install | 4 ++-- scripts/restore | 4 ++-- scripts/upgrade | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 42d51af..50849a3 100644 --- a/scripts/install +++ b/scripts/install @@ -130,7 +130,7 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" -chmod -R 750 "$final_path" +chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" @@ -152,7 +152,7 @@ ynh_script_progression --message="Creating the data directory..." # Create app folders mkdir -p "$datadir" -chmod -R 750 "$datadir" +chmod 750 "$datadir" chmod -R o-rwx "$datadir" chown -R $app:$app "$datadir" diff --git a/scripts/restore b/scripts/restore index e210367..7f7fe79 100644 --- a/scripts/restore +++ b/scripts/restore @@ -71,7 +71,7 @@ ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" -chmod -R 750 "$final_path" +chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" @@ -87,7 +87,7 @@ ynh_restore_file --origin_path="$datadir" --not_mandatory mkdir -p "$datadir" -chmod -R 750 "$datadir" +chmod 750 "$datadir" chmod -R o-rwx "$datadir" chown -R $app:$app "$datadir" diff --git a/scripts/upgrade b/scripts/upgrade index 9b65839..07f9da9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -169,7 +169,7 @@ then ynh_secure_remove --file="$tmpdir" fi -chmod -R 750 "$final_path" +chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" @@ -216,7 +216,7 @@ ynh_script_progression --message="Creating the data directory..." # Create app folders mkdir -p "$datadir" -chmod -R 750 "$datadir" +chmod 750 "$datadir" chmod -R o-rwx "$datadir" chown -R $app:$app "$datadir" From c5603e546cb46a0ddde3e032b02836486b9e5d42 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 23 Apr 2021 14:45:57 +0200 Subject: [PATCH 12/28] Fix blank page --- scripts/upgrade | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 07f9da9..a190244 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -240,8 +240,6 @@ chown $app:$app "$final_path/config/local-production.json" #================================================= ynh_script_progression --message="Building Yarn dependencies..." -chown -R "$app":"$app" $final_path - pushd "$final_path" ynh_use_nodejs ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --production --pure-lockfile From e1432ff50a96f7e7d53b62236c8ba419576ee6aa Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 23 Apr 2021 16:00:39 +0200 Subject: [PATCH 13/28] Fix rights --- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 50849a3..6261a8b 100644 --- a/scripts/install +++ b/scripts/install @@ -154,7 +154,7 @@ mkdir -p "$datadir" chmod 750 "$datadir" chmod -R o-rwx "$datadir" -chown -R $app:$app "$datadir" +chown -R $app:www-data "$datadir" #================================================= # BUILD YARN DEPENDENCIES diff --git a/scripts/restore b/scripts/restore index 7f7fe79..908d617 100644 --- a/scripts/restore +++ b/scripts/restore @@ -89,7 +89,7 @@ mkdir -p "$datadir" chmod 750 "$datadir" chmod -R o-rwx "$datadir" -chown -R $app:$app "$datadir" +chown -R $app:www-data "$datadir" #================================================= # OPEN A PORT diff --git a/scripts/upgrade b/scripts/upgrade index a190244..c84d97e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -218,7 +218,7 @@ mkdir -p "$datadir" chmod 750 "$datadir" chmod -R o-rwx "$datadir" -chown -R $app:$app "$datadir" +chown -R $app:www-data "$datadir" #================================================= # UPDATE A CONFIG FILE From c31b4fd1f1db60bd881d8e80b61e91af7ad7421e Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 23 Apr 2021 16:09:24 +0200 Subject: [PATCH 14/28] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 0fc6968..e0a4b16 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Video streaming platform using P2P directly in the web browser, connected to a federated network", "fr": "Plateforme de diffusion vidéo par P2P directement dans le navigateur, et connectée à un réseau fédéralisé" }, - "version": "3.1.0~ynh3", + "version": "3.1.0~ynh4", "url": "https://github.com/Chocobozzz/PeerTube", "license": "AGPL-3.0-only", "maintainer": [ From 7a925b8f71525a4b88df43cee5dd38bf1d4b9021 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 24 Apr 2021 19:12:23 +0200 Subject: [PATCH 15/28] Update upgrade --- scripts/upgrade | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index c84d97e..aaac2ba 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -230,8 +230,6 @@ ynh_add_config --template="../conf/production.yaml" --destination="$final_path/c chmod 400 "$final_path/config/production.yaml" chown $app:$app "$final_path/config/production.yaml" -ynh_add_config --template="../conf/local-production.json" --destination="$final_path/config/local-production.json" - chmod 400 "$final_path/config/local-production.json" chown $app:$app "$final_path/config/local-production.json" From 82a45f77f7f84c38ba87fb58129a41ba441f7817 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 25 Apr 2021 12:26:33 +0200 Subject: [PATCH 16/28] Manage rights on local.json --- manifest.json | 2 +- scripts/install | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index e0a4b16..8099950 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Video streaming platform using P2P directly in the web browser, connected to a federated network", "fr": "Plateforme de diffusion vidéo par P2P directement dans le navigateur, et connectée à un réseau fédéralisé" }, - "version": "3.1.0~ynh4", + "version": "3.1.0~ynh5", "url": "https://github.com/Chocobozzz/PeerTube", "license": "AGPL-3.0-only", "maintainer": [ diff --git a/scripts/install b/scripts/install index 6261a8b..ea739dd 100644 --- a/scripts/install +++ b/scripts/install @@ -178,7 +178,7 @@ chown $app:$app "$final_path/config/production.yaml" ynh_add_config --template="../conf/local-production.json" --destination="$final_path/config/local-production.json" -chmod 400 "$final_path/config/local-production.json" +chmod 600 "$final_path/config/local-production.json" chown $app:$app "$final_path/config/local-production.json" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index aaac2ba..0db403a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -230,7 +230,7 @@ ynh_add_config --template="../conf/production.yaml" --destination="$final_path/c chmod 400 "$final_path/config/production.yaml" chown $app:$app "$final_path/config/production.yaml" -chmod 400 "$final_path/config/local-production.json" +chmod 600 "$final_path/config/local-production.json" chown $app:$app "$final_path/config/local-production.json" #================================================= From dec0494ef854f58c4cdb9bdb9b363f0fa9ce677c Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 4 May 2021 22:23:09 +0200 Subject: [PATCH 17/28] Fix #230 --- check_process | 4 ++++ conf/systemd.service | 3 +-- manifest.json | 2 +- scripts/install | 2 +- scripts/upgrade | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/check_process b/check_process index ce713f1..644d844 100644 --- a/check_process +++ b/check_process @@ -26,6 +26,8 @@ upgrade=1 from_commit=5a74f4033eafa657fcd32a9713cd77ba0f4f79c9 # 3.1.0~ynh2 upgrade=1 from_commit=1be4caaaf2787e614cd315ca8564573d4268032a + # 3.1.0~ynh5 + upgrade=1 from_commit=343f2b80e0f3bddc87ad8ed143411a0920c21150 backup_restore=1 multi_instance=0 port_already_use=0 @@ -48,4 +50,6 @@ Notification=yes name=3.0.1~ynh1 ; commit=1be4caaaf2787e614cd315ca8564573d4268032a name=3.1.0~ynh2 + ; commit=343f2b80e0f3bddc87ad8ed143411a0920c21150 + name=3.1.0~ynh5 \ No newline at end of file diff --git a/conf/systemd.service b/conf/systemd.service index 794068e..b2b50fb 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,8 +8,7 @@ Environment=NODE_ENV=production Environment=NODE_CONFIG_DIR=__FINALPATH__/config User=__APP__ Group=__APP__ -Environment="__YNH_NODE_LOAD_PATH__" -ExecStart=/bin/sh -c ' npm start' +ExecStart=__YNH_NODE__ __FINALPATH__/dist/server WorkingDirectory=__FINALPATH__/ StandardOutput=syslog StandardError=syslog diff --git a/manifest.json b/manifest.json index 8099950..071f03e 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Video streaming platform using P2P directly in the web browser, connected to a federated network", "fr": "Plateforme de diffusion vidéo par P2P directement dans le navigateur, et connectée à un réseau fédéralisé" }, - "version": "3.1.0~ynh5", + "version": "3.1.0~ynh6", "url": "https://github.com/Chocobozzz/PeerTube", "license": "AGPL-3.0-only", "maintainer": [ diff --git a/scripts/install b/scripts/install index ea739dd..a416115 100644 --- a/scripts/install +++ b/scripts/install @@ -187,7 +187,7 @@ chown $app:$app "$final_path/config/local-production.json" ynh_script_progression --message="Configuring a systemd service..." # Create a dedicated systemd config -ynh_add_systemd_config --others_var="ynh_node_load_PATH" +ynh_add_systemd_config --others_var="ynh_node ynh_node_load_PATH" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 0db403a..7335c47 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -258,7 +258,7 @@ popd ynh_script_progression --message="Upgrading systemd configuration..." # Create a dedicated systemd config -ynh_add_systemd_config --others_var="ynh_node_load_PATH" +ynh_add_systemd_config --others_var="ynh_node ynh_node_load_PATH" #================================================= # GENERIC FINALIZATION From 1f50487377006a6faaf4e5aecedbf399c191a4a1 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Thu, 13 May 2021 17:50:50 +0200 Subject: [PATCH 18/28] [autopatch] Update issue and PR templates --- issue_template.md => .github/ISSUE_TEMPLATE.md | 4 ++-- .github/PULL_REQUEST_TEMPLATE.md | 16 ++++++++++++++++ pull_request_template.md | 16 ---------------- 3 files changed, 18 insertions(+), 18 deletions(-) rename issue_template.md => .github/ISSUE_TEMPLATE.md (94%) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 pull_request_template.md diff --git a/issue_template.md b/.github/ISSUE_TEMPLATE.md similarity index 94% rename from issue_template.md rename to .github/ISSUE_TEMPLATE.md index 4bd409c..2729a6b 100644 --- a/issue_template.md +++ b/.github/ISSUE_TEMPLATE.md @@ -8,7 +8,7 @@ about: When creating a bug report, please use the following template to provide 1. *Read this whole template first.* 2. *Determine if you are on the right place:* - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* - - *Otherwise, the issue may be due to PeerTube itself. Refer to its documentation or repository for help.* + - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.* - *When in doubt, post here and we will figure it out together.* 3. *Delete the italic comments as you write over them below, and remove this guide.* --- @@ -31,7 +31,7 @@ about: When creating a bug report, please use the following template to provide - *If you performed a command from the CLI, the command itself is enough. For example:* ```sh - sudo yunohost app install peertube + sudo yunohost app install the_app ``` - *If you used the webadmin, please perform the equivalent command from the CLI first.* - *If the error occurs in your browser, explain what you did:* diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..ef70e18 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,16 @@ +## Problem + +- *Description of why you made this PR* + +## Solution + +- *And how do you fix that problem* + +## PR Status + +- [ ] Code finished and ready to be reviewed/tested +- [ ] The fix/enhancement were manually tested (if applicable) + +## Automatic tests + +Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization) diff --git a/pull_request_template.md b/pull_request_template.md deleted file mode 100644 index 6c28fc5..0000000 --- a/pull_request_template.md +++ /dev/null @@ -1,16 +0,0 @@ -## Problem -- *Description of why you made this PR* - -## Solution -- *And how do you fix that problem* - -## PR Status -- [ ] Code finished. -- [ ] Tested with Package_check. -- [ ] Fix or enhancement tested. -- [ ] Upgrade from last version tested. -- [ ] Can be reviewed and tested. - -## Package_check results ---- -* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* From 07dd5a839ebb322ef33fcb83f8e4a10521db327e Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 13 May 2021 22:41:53 +0200 Subject: [PATCH 19/28] remove others_var --- manifest.json | 2 +- scripts/install | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index 071f03e..3fcc55f 100644 --- a/manifest.json +++ b/manifest.json @@ -19,7 +19,7 @@ } ], "requirements": { - "yunohost": ">= 4.1.7.3" + "yunohost": ">= 4.2.0" }, "multi_instance": false, "services": [ diff --git a/scripts/install b/scripts/install index a416115..ac5a919 100644 --- a/scripts/install +++ b/scripts/install @@ -187,7 +187,7 @@ chown $app:$app "$final_path/config/local-production.json" ynh_script_progression --message="Configuring a systemd service..." # Create a dedicated systemd config -ynh_add_systemd_config --others_var="ynh_node ynh_node_load_PATH" +ynh_add_systemd_config #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 7335c47..fb026ff 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -258,7 +258,7 @@ popd ynh_script_progression --message="Upgrading systemd configuration..." # Create a dedicated systemd config -ynh_add_systemd_config --others_var="ynh_node ynh_node_load_PATH" +ynh_add_systemd_config #================================================= # GENERIC FINALIZATION From 730510ef71da122d33ed5c0c27b0a73d91ecd87a Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 14 May 2021 00:14:17 +0200 Subject: [PATCH 20/28] Update ynh_send_readme_to_admin --- scripts/install | 1 - scripts/remove | 1 - scripts/upgrade | 3 +++ scripts/ynh_send_readme_to_admin__2 | 25 +++++++------------------ 4 files changed, 10 insertions(+), 20 deletions(-) diff --git a/scripts/install b/scripts/install index ac5a919..36f03b7 100644 --- a/scripts/install +++ b/scripts/install @@ -275,7 +275,6 @@ ynh_systemd_action --service_name=nginx --action=reload #================================================= ynh_script_progression --message="Sending a readme for the admin..." -ynh_add_config --template="../conf/message_install" --destination="../conf/msg_install" ynh_send_readme_to_admin --app_message="../conf/msg_install" --recipients=$admin_email --type='install' #================================================= diff --git a/scripts/remove b/scripts/remove index 8149dd4..318ce53 100644 --- a/scripts/remove +++ b/scripts/remove @@ -121,7 +121,6 @@ ynh_system_user_delete --username=$app #================================================= ynh_script_progression --message="Sending a readme for the admin..." -ynh_add_config --template="../conf/message_remove" --destination="../conf/msg_remove" ynh_send_readme_to_admin --app_message="../conf/msg_remove" --recipients=$admin_email --type='remove' #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index fb026ff..a307da6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -76,6 +76,9 @@ ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --datab ynh_secure_remove --file="/etc/apt/sources.list.d/jessie-backports.list" ynh_secure_remove --file="/etc/apt/sources.list.d/yarn.list" +# Remove not needed checksum +ynh_delete_file_checksum --file="../conf/msg_install" + if [ -z "$rtmp_port" ]; then rtmp_port=1935 diff --git a/scripts/ynh_send_readme_to_admin__2 b/scripts/ynh_send_readme_to_admin__2 index 06cff8c..ee571cc 100644 --- a/scripts/ynh_send_readme_to_admin__2 +++ b/scripts/ynh_send_readme_to_admin__2 @@ -9,6 +9,8 @@ # If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you # example: "root admin@domain user1 user2" # | arg: -t, --type= - Type of mail, could be 'backup', 'change_url', 'install', 'remove', 'restore', 'upgrade' +# +# Requires YunoHost version 4.1.0 or higher. ynh_send_readme_to_admin() { # Declare an array to define the options of this helper. declare -Ar args_array=( [m]=app_message= [r]=recipients= [t]=type= ) @@ -68,21 +70,15 @@ ynh_send_readme_to_admin() { mail_subject="$mail_subject has just been installed!" fi + ynh_add_config --template="$app_message" --destination="../conf/msg__to_send" + + ynh_delete_file_checksum --file="../conf/msg__to_send" + local mail_message="This is an automated message from your beloved YunoHost server. Specific information for the application $app. -$(if [ -n "$app_message" ] -then - cat "$app_message" -else - echo "...No specific information..." -fi) - ---- -Automatic diagnosis data from YunoHost - -__PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')__PRE_TAG2__" +$(cat "../conf/msg__to_send")" # Store the message into a file for further modifications. echo "$mail_message" > mail_to_send @@ -103,10 +99,6 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service # Insert url links tags ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "\1" mail_to_send - # Insert pre tags - ynh_replace_string "__PRE_TAG1__" "
" mail_to_send
-		ynh_replace_string "__PRE_TAG2__" "<\pre>" mail_to_send
-
 		# Insert finishing HTML tags
 		echo -e "\n\n" >> mail_to_send
 
@@ -115,9 +107,6 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service
 		# Remove URL tags
 		ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send
 		ynh_replace_string "__URL_TAG2__" ": " mail_to_send
-
-		# Remove PRE tags
-		ynh_replace_string "__PRE_TAG[1-2]__" "" mail_to_send
 	fi
 
 	# Define binary to use for mail command

From 10cb98613bce20c9e0aa38250839ff364dceb193 Mon Sep 17 00:00:00 2001
From: yalh76 
Date: Fri, 14 May 2021 00:24:59 +0200
Subject: [PATCH 21/28] Fix messages

---
 conf/{message_install => msg_install} | 0
 conf/{message_remove => msg_remove}   | 0
 2 files changed, 0 insertions(+), 0 deletions(-)
 rename conf/{message_install => msg_install} (100%)
 rename conf/{message_remove => msg_remove} (100%)

diff --git a/conf/message_install b/conf/msg_install
similarity index 100%
rename from conf/message_install
rename to conf/msg_install
diff --git a/conf/message_remove b/conf/msg_remove
similarity index 100%
rename from conf/message_remove
rename to conf/msg_remove

From f4b43fd85ad3a169d27c53865a13548e44f17ebf Mon Sep 17 00:00:00 2001
From: oufmilo <44617467+oufmilo@users.noreply.github.com>
Date: Thu, 3 Jun 2021 21:09:44 +0200
Subject: [PATCH 22/28] Update app.src

---
 conf/app.src | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/conf/app.src b/conf/app.src
index 6aadf59..2c02890 100644
--- a/conf/app.src
+++ b/conf/app.src
@@ -1,5 +1,5 @@
-SOURCE_URL=https://github.com/Chocobozzz/PeerTube/releases/download/v3.1.0/peertube-v3.1.0.tar.xz
-SOURCE_SUM=94b4ac2e5dd880039b999e6891e96246b9655070c5d08aedbdc0926ecad1bfa5
+SOURCE_URL=https://github.com/Chocobozzz/PeerTube/releases/download/v3.2.1/peertube-v3.2.1.tar.xz
+SOURCE_SUM=2c8fb6c3796d50155e7c2d9533875b034a0aa3513188bf6281f4686e0d33c639
 SOURCE_SUM_PRG=sha256sum
 SOURCE_FORMAT=tar.xz
 SOURCE_IN_SUBDIR=true

From 6d7b290d496e466201e25aa1f4482ef81998f797 Mon Sep 17 00:00:00 2001
From: oufmilo <44617467+oufmilo@users.noreply.github.com>
Date: Thu, 3 Jun 2021 21:14:01 +0200
Subject: [PATCH 23/28] Update manifest.json

---
 manifest.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/manifest.json b/manifest.json
index 3fcc55f..6b7189f 100644
--- a/manifest.json
+++ b/manifest.json
@@ -6,7 +6,7 @@
         "en": "Video streaming platform using P2P directly in the web browser, connected to a federated network",
         "fr": "Plateforme de diffusion vidéo par P2P directement dans le navigateur, et connectée à un réseau fédéralisé"
     },
-    "version": "3.1.0~ynh6",
+    "version": "3.2.1~ynh6",
     "url": "https://github.com/Chocobozzz/PeerTube",
     "license": "AGPL-3.0-only",
     "maintainer": [

From 2f46cfc67f3ae28210c08511ba03b8cc0dd22038 Mon Sep 17 00:00:00 2001
From: oufmilo <44617467+oufmilo@users.noreply.github.com>
Date: Thu, 3 Jun 2021 21:14:39 +0200
Subject: [PATCH 24/28] Update README_fr.md

---
 README_fr.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README_fr.md b/README_fr.md
index 70694f9..0c5fd87 100644
--- a/README_fr.md
+++ b/README_fr.md
@@ -23,7 +23,7 @@ Les serveurs sont gérés indépendamment par différentes personnes et organisa
 
 En regardant une vidéo, vous aidez l'hébergeur à la diffuser en devenant vous-même un diffuseur de la vidéo. Chaque instance n'a pas besoin de beaucoup d'argent pour diffuser les vidéos de ses utilisateurs.
 
-**Version incluse :** 3.1.0
+**Version incluse :** 3.2.1
 
 ## Points importants à lire avant l'installation
 

From a93643d7b122312e758c8f7f0445ad0f4d8c0da7 Mon Sep 17 00:00:00 2001
From: oufmilo <44617467+oufmilo@users.noreply.github.com>
Date: Sat, 5 Jun 2021 19:27:11 +0200
Subject: [PATCH 25/28] Update check_process

---
 check_process | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/check_process b/check_process
index 644d844..c8f409b 100644
--- a/check_process
+++ b/check_process
@@ -28,6 +28,8 @@
 		upgrade=1	from_commit=1be4caaaf2787e614cd315ca8564573d4268032a
 		# 3.1.0~ynh5
 		upgrade=1	from_commit=343f2b80e0f3bddc87ad8ed143411a0920c21150
+		# 3.2.1~ynh6
+		upgrade=1	from_commit=f4b43fd85ad3a169d27c53865a13548e44f17ebf
 		backup_restore=1
 		multi_instance=0
 		port_already_use=0
@@ -52,4 +54,6 @@ Notification=yes
 		name=3.1.0~ynh2
 	; commit=343f2b80e0f3bddc87ad8ed143411a0920c21150
 		name=3.1.0~ynh5
-		
\ No newline at end of file
+	; commit=f4b43fd85ad3a169d27c53865a13548e44f17ebf
+		name=3.2.1~ynh6
+		

From 3f3a3d93e42d106c52573ebc2150fa22d3015e1b Mon Sep 17 00:00:00 2001
From: oufmilo <44617467+oufmilo@users.noreply.github.com>
Date: Mon, 7 Jun 2021 20:16:00 +0200
Subject: [PATCH 26/28] Update manifest.json

Co-authored-by: yalh76 
---
 manifest.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/manifest.json b/manifest.json
index 6b7189f..23bdc74 100644
--- a/manifest.json
+++ b/manifest.json
@@ -6,7 +6,7 @@
         "en": "Video streaming platform using P2P directly in the web browser, connected to a federated network",
         "fr": "Plateforme de diffusion vidéo par P2P directement dans le navigateur, et connectée à un réseau fédéralisé"
     },
-    "version": "3.2.1~ynh6",
+    "version": "3.2.1~ynh1",
     "url": "https://github.com/Chocobozzz/PeerTube",
     "license": "AGPL-3.0-only",
     "maintainer": [

From 50171b40daa274e8c45b098bfbdc8e60123ce9f0 Mon Sep 17 00:00:00 2001
From: oufmilo <44617467+oufmilo@users.noreply.github.com>
Date: Mon, 7 Jun 2021 20:47:30 +0200
Subject: [PATCH 27/28] Update nginx.conf

---
 conf/nginx.conf | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/conf/nginx.conf b/conf/nginx.conf
index 99fedf6..ad57753 100644
--- a/conf/nginx.conf
+++ b/conf/nginx.conf
@@ -19,6 +19,13 @@ location @api {
   proxy_pass http://127.0.0.1:__PORT__;
 }
 
+location = /api/v1/videos/upload-resumable {
+    client_max_body_size    0;
+    proxy_request_buffering off;
+
+    try_files /dev/null @api;
+  }
+
 location / {
   if ($scheme = http) {
     rewrite ^ https://$server_name$request_uri? permanent;
@@ -30,6 +37,7 @@ location / {
   include conf.d/yunohost_panel.conf.inc;
 }
 
+
 location = /api/v1/videos/upload {
   limit_except POST HEAD { deny all; }
 

From def317b0ed54eba159f70d96f95b747f6548725a Mon Sep 17 00:00:00 2001
From: oufmilo <44617467+oufmilo@users.noreply.github.com>
Date: Tue, 8 Jun 2021 23:02:10 +0200
Subject: [PATCH 28/28] Update nginx.conf

---
 conf/nginx.conf | 1 -
 1 file changed, 1 deletion(-)

diff --git a/conf/nginx.conf b/conf/nginx.conf
index ad57753..00e90cc 100644
--- a/conf/nginx.conf
+++ b/conf/nginx.conf
@@ -22,7 +22,6 @@ location @api {
 location = /api/v1/videos/upload-resumable {
     client_max_body_size    0;
     proxy_request_buffering off;
-
     try_files /dev/null @api;
   }