From 80a838b735f40a6716e34cb71a0789584668b03d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 21 Mar 2023 23:12:02 +0100 Subject: [PATCH 01/86] v2 --- conf/app.src | 6 --- conf/msg_install | 4 +- conf/msg_remove | 6 +-- conf/nginx.conf | 10 ++-- conf/production.yaml | 28 +++++----- conf/systemd.service | 6 +-- manifest.toml | 65 ++++++++++++++++++++++ scripts/_common.sh | 4 +- scripts/backup | 20 +++---- scripts/install | 124 +++++++++++++++++++++--------------------- scripts/remove | 42 +++++++-------- scripts/restore | 66 +++++++++++------------ scripts/upgrade | 126 +++++++++++++++++++++---------------------- 13 files changed, 283 insertions(+), 224 deletions(-) delete mode 100644 conf/app.src create mode 100644 manifest.toml diff --git a/conf/app.src b/conf/app.src deleted file mode 100644 index bacbed2..0000000 --- a/conf/app.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://github.com/Chocobozzz/PeerTube/releases/download/v5.0.1/peertube-v5.0.1.tar.xz -SOURCE_SUM=f43d36fb73b87dc1e6f86fc4d5039aba9f4619c5fff6d64669a900989bed80e2 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.xz -SOURCE_IN_SUBDIR=true -SOURCE_EXTRACT=true diff --git a/conf/msg_install b/conf/msg_install index 1243f11..1f0ad66 100644 --- a/conf/msg_install +++ b/conf/msg_install @@ -1,13 +1,13 @@ __APP__ was successfully installed :) -Please open your __APP__ domain: https://__DOMAIN____PATH_URL__ +Please open your __APP__ domain: https://__DOMAIN____PATH__ The admin username is: root The admin password is: __ADMIN_PASS__ To make PeerTube Live available, you also need to make the TCP port __RTMP_PORT__ available from internet (For example, opening the port on your ISP box if it's not automatically done). -To enable LDAP authentication open https://__DOMAIN____PATH_URL__admin/plugins/show/peertube-plugin-auth-ldap +To enable LDAP authentication open https://__DOMAIN____PATH__admin/plugins/show/peertube-plugin-auth-ldap Complete with the following informations : - URL: ldap://127.0.0.1 - Insecure TLS : checked diff --git a/conf/msg_remove b/conf/msg_remove index c21fde9..5869587 100644 --- a/conf/msg_remove +++ b/conf/msg_remove @@ -1,15 +1,15 @@ __APP__ was successfully removed :) -The domain https://__DOMAIN____PATH_URL__ is free for other apps to be installed on it. +The domain https://__DOMAIN____PATH__ is free for other apps to be installed on it. You should close the PeerTube Live TCP port __RTMP_PORT__ available from internet (For example, closing the port on your ISP box if it's not automatically done). But a futher action is required from your side to completely remove the __APP__ data folder. If you have backup and plan to restore this app in the future DON'T RUN THIS COMMAND. -And if you are going to migrate to othe server you will have to move __DATADIR__ to your new server. +And if you are going to migrate to othe server you will have to move __DATA_DIR__ to your new server. You need to run this command to remove the data (warning all your videos will be removed): -rm -R __DATADIR__ -f +rm -R __DATA_DIR__ -f If you facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/peertube_ynh diff --git a/conf/nginx.conf b/conf/nginx.conf index f8345c1..d74a70d 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -88,7 +88,7 @@ location ~ ^/plugins/[^/]+(/[^/]+)?/ws/ { # For extra performance please refer to https://github.com/denji/nginx-tuning ## -root __DATADIR__; +root __DATA_DIR__; # Enable compression for JS/CSS/HTML, for improved client load times. # It might be nice to compress JSON/XML as returned by the API, but # leaving that out to protect against potential BREACH attack. @@ -125,14 +125,14 @@ tcp_nodelay on; # don't buffer data sent, good for small data burs location ~ ^/client/(assets/images/(icons/icon-36x36\.png|icons/icon-48x48\.png|icons/icon-72x72\.png|icons/icon-96x96\.png|icons/icon-144x144\.png|icons/icon-192x192\.png|icons/icon-512x512\.png|logo\.svg|favicon\.png|default-playlist\.jpg|default-avatar-account\.png|default-avatar-account-48x48\.png|default-avatar-video-channel\.png|default-avatar-video-channel-48x48\.png))$ { more_set_headers "Cache-Control : public, max-age=31536000, immutable"; # Cache 1 year - try_files __DATADIR__/client-overrides/$1 __FINALPATH__/client/dist/$1 @api; + try_files __DATA_DIR__/client-overrides/$1 __INSTALL_DIR__/client/dist/$1 @api; } # Bypass PeerTube for performance reasons. Optional. location ~ ^/client/(.*\.(js|css|png|svg|woff2|otf|ttf|woff|eot))$ { more_set_headers "Cache-Control : public, max-age=31536000, immutable"; # Cache 1 year - alias __FINALPATH__/client/dist/$1; + alias __INSTALL_DIR__/client/dist/$1; } # Bypass PeerTube for performance reasons. Optional. @@ -154,7 +154,7 @@ location ~ ^/static/(thumbnails|avatars)/ { rewrite ^/static/(.*)$ /$1 break; - root __DATADIR__; + root __DATA_DIR__; try_files $uri @api; } @@ -216,7 +216,7 @@ location ~ ^/static/(webseed|redundancy|streaming-playlists)/ { rewrite ^/static/webseed/(.*)$ /videos/$1 break; rewrite ^/static/(.*)$ /$1 break; - root __DATADIR__; + root __DATA_DIR__; try_files $uri @api; } diff --git a/conf/production.yaml b/conf/production.yaml index 28731b5..8bc588e 100644 --- a/conf/production.yaml +++ b/conf/production.yaml @@ -113,20 +113,20 @@ defaults: # From the project root directory storage: - tmp: '__DATADIR__/tmp/' # Use to download data (imports etc), store uploaded files before processing... - bin: '__DATADIR__/bin/' - avatars: '__DATADIR__/avatars/' - videos: '__DATADIR__/videos/' - streaming_playlists: '__DATADIR__/streaming-playlists/' - redundancy: '__DATADIR__/redundancy/' + tmp: '__DATA_DIR__/tmp/' # Use to download data (imports etc), store uploaded files before processing... + bin: '__DATA_DIR__/bin/' + avatars: '__DATA_DIR__/avatars/' + videos: '__DATA_DIR__/videos/' + streaming_playlists: '__DATA_DIR__/streaming-playlists/' + redundancy: '__DATA_DIR__/redundancy/' logs: '/var/log/__APP__/' - previews: '__DATADIR__/previews/' - thumbnails: '__DATADIR__/thumbnails/' - torrents: '__DATADIR__/torrents/' - captions: '__DATADIR__/captions/' - cache: '__DATADIR__/cache/' - plugins: '__DATADIR__/plugins/' - well_known: '__DATADIR__/well-known/' + previews: '__DATA_DIR__/previews/' + thumbnails: '__DATA_DIR__/thumbnails/' + torrents: '__DATA_DIR__/torrents/' + captions: '__DATA_DIR__/captions/' + cache: '__DATA_DIR__/cache/' + plugins: '__DATA_DIR__/plugins/' + well_known: '__DATA_DIR__/well-known/' # Overridable client files in client/dist/assets/images: # - logo.svg # - favicon.png @@ -137,7 +137,7 @@ storage: # Could contain for example assets/images/favicon.png # If the file exists, peertube will serve it # If not, peertube will fallback to the default file - client_overrides: '__DATADIR__/client-overrides/' + client_overrides: '__DATA_DIR__/client-overrides/' static_files: # Require and check user authentication when accessing private files (internal/private video files) diff --git a/conf/systemd.service b/conf/systemd.service index 026ad03..ae0bb93 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -5,12 +5,12 @@ After=network.target postgresql.service redis-server.service [Service] Type=simple Environment=NODE_ENV=production -Environment=NODE_CONFIG_DIR=__FINALPATH__/config +Environment=NODE_CONFIG_DIR=__INSTALL_DIR__/config Environment="__YNH_NODE_LOAD_PATH__" User=__APP__ Group=__APP__ -ExecStart=__YNH_NODE__ __FINALPATH__/dist/server -WorkingDirectory=__FINALPATH__/ +ExecStart=__YNH_NODE__ __INSTALL_DIR__/dist/server +WorkingDirectory=__INSTALL_DIR__/ StandardOutput=syslog StandardError=syslog SyslogIdentifier=__APP__ diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..826a756 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,65 @@ +packaging_format = 2 + +id = "peertube" +name = "PeerTube" +description.en = "Federated video streaming platform using P2P directly in the web browser" +description.fr = "Plateforme fédéralisé de diffusion vidéo par P2P directement dans le navigateur" + +version = "5.0.1~ynh1" + +maintainers = ["yalh76"] + +[upstream] +license = "AGPL-3.0-only" +website = "https://joinpeertube.org/fr" +demo = "http://peertube.cpy.re" +admindoc = "https://docs.joinpeertube.org" +code = "https://github.com/Chocobozzz/PeerTube" +cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) +fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. + +[integration] +yunohost = ">= 11.0.0" +architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +multi_instance = false +ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. +sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. +disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... +ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... + +[install] + [install.domain] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "domain" + full_domain = true + + [install.init_main_permission] + type = "group" + default = "visitors" + + [install.admin] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "user" + +[resources] + [resources.sources.main] + url = "https://github.com/Chocobozzz/PeerTube/releases/download/v5.0.1/peertube-v5.0.1.tar.xz" + sha256 = "f43d36fb73b87dc1e6f86fc4d5039aba9f4619c5fff6d64669a900989bed80e2" + + + [resources.system_user] + + [resources.install_dir] + + [resources.data_dir] + + [resources.permissions] + main.url = "/" + [[resources.apt.extras]] + repo = "deb https://dl.yarnpkg.com/debian/ stable main" + key = "https://dl.yarnpkg.com/debian/pubkey.gpg" + packages = "yarn" + + [resources.database] + type = "postgresql" diff --git a/scripts/_common.sh b/scripts/_common.sh index 0c9d5a4..f019a88 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,8 +5,8 @@ #================================================= # dependencies used by the app -pkg_dependencies="ffmpeg postgresql postgresql-contrib openssl g++ mailutils apt-transport-https" -app_dependencies="prosody" +#REMOVEME? pkg_dependencies="ffmpeg postgresql postgresql-contrib openssl g++ mailutils apt-transport-https" +#REMOVEME? app_dependencies="prosody" nodejs_version=16 diff --git a/scripts/backup b/scripts/backup index 6ce4cc3..a0fa300 100644 --- a/scripts/backup +++ b/scripts/backup @@ -14,23 +14,23 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { true } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +#REMOVEME? ynh_print_info --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? 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) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -41,13 +41,13 @@ 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 DATA DIR #================================================= -ynh_backup --src_path="$datadir" --is_big +ynh_backup --src_path="$data_dir" --is_big #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/install b/scripts/install index 5c644ee..48938ba 100644 --- a/scripts/install +++ b/scripts/install @@ -16,48 +16,48 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -domain=$YNH_APP_ARG_DOMAIN -path_url="/" -is_public=$YNH_APP_ARG_IS_PUBLIC -admin=$YNH_APP_ARG_ADMIN +#REMOVEME? domain=$YNH_APP_ARG_DOMAIN +path="/" +#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC +#REMOVEME? admin=$YNH_APP_ARG_ADMIN -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME admin_mail=$(ynh_user_get_info --username=$admin --key="mail") admin_pass=$(ynh_string_random --length=24) secrets_peertube=$(ynh_string_random --length=24) # Define app's data directory -datadir="/home/yunohost.app/${app}/storage" +#REMOVEME? data_dir="/home/yunohost.app/${app}/storage" #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." +#REMOVEME? ynh_script_progression --message="Validating installation parameters..." -final_path=/var/www/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" +#REMOVEME? install_dir=/var/www/$app +#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" # Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." +#REMOVEME? ynh_script_progression --message="Storing installation settings..." -ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=admin --value=$admin +#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain +#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=secrets_peertube --value=$secrets_peertube #================================================= @@ -65,16 +65,16 @@ ynh_app_setting_set --app=$app --key=secrets_peertube --value=$secrets_peertube #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Finding an available port..." +#REMOVEME? ynh_script_progression --message="Finding an available port..." # Find an available port -port=$(ynh_find_port --port=8095) -ynh_app_setting_set --app=$app --key=port --value=$port +#REMOVEME? port=$(ynh_find_port --port=8095) +#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port # PeerTube Live port rtmp_port=1935 ynh_port_available --port=$rtmp_port || ynh_die --message="Port $rtmp_port is needs to be available for this app" -ynh_app_setting_set --app=$app --key=rtmp_port --value=$rtmp_port +#REMOVEME? ynh_app_setting_set --app=$app --key=rtmp_port --value=$rtmp_port # Open the port ynh_script_progression --message="Configuring firewall..." @@ -83,33 +83,33 @@ ynh_exec_warn_less yunohost firewall allow TCP $rtmp_port #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." +#REMOVEME? ynh_script_progression --message="Installing dependencies..." ynh_exec_warn_less ynh_install_apps --apps="$app_dependencies" -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" +#REMOVEME? ynh_exec_warn_less 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..." +#REMOVEME? ynh_script_progression --message="Configuring system user..." # Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # CREATE A POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Creating a PostgreSQL database..." +#REMOVEME? ynh_script_progression --message="Creating a PostgreSQL database..." -db_name="peertube_${app}" -db_user=$(ynh_sanitize_dbid --db_name=$app) -ynh_app_setting_set --app=$app --key=db_name --value=$db_name -ynh_app_setting_set --app=$app --key=db_user --value=$db_user -ynh_psql_test_if_first_run -ynh_psql_setup_db --db_user=$db_user --db_name=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +#REMOVEME? db_name="peertube_${app}" +#REMOVEME? db_user=$(ynh_sanitize_dbid --db_name=$app) +#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name +#REMOVEME? ynh_app_setting_set --app=$app --key=db_user --value=$db_user +#REMOVEME? ynh_psql_test_if_first_run +#REMOVEME? ynh_psql_setup_db --db_user=$db_user --db_name=$db_name +#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database=$db_name ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name @@ -126,13 +126,13 @@ ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" #================================================= ynh_script_progression --message="Setting up source files..." -ynh_app_setting_set --app=$app --key=final_path --value=$final_path +#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$final_path" +ynh_setup_source --dest_dir="$install_dir" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # NGINX CONFIGURATION @@ -149,20 +149,20 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Creating a data directory..." -ynh_app_setting_set --app=$app --key=datadir --value=$datadir +#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir -mkdir -p $datadir +mkdir -p $data_dir -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:www-data "$datadir" +chmod 750 "$data_dir" +chmod -R o-rwx "$data_dir" +chown -R $app:www-data "$data_dir" #================================================= # BUILD YARN DEPENDENCIES #================================================= -ynh_script_progression --message="Building Yarn dependencies..." +#REMOVEME? ynh_script_progression --message="Building Yarn dependencies..." -pushd "$final_path" +pushd "$install_dir" ynh_use_nodejs ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean @@ -173,15 +173,15 @@ popd #================================================= ynh_script_progression --message="Adding a configuration file..." -ynh_add_config --template="../conf/production.yaml" --destination="$final_path/config/production.yaml" +ynh_add_config --template="../conf/production.yaml" --destination="$install_dir/config/production.yaml" -chmod 400 "$final_path/config/production.yaml" -chown $app:$app "$final_path/config/production.yaml" +chmod 400 "$install_dir/config/production.yaml" +chown $app:$app "$install_dir/config/production.yaml" -ynh_add_config --template="../conf/local-production.json" --destination="$final_path/config/local-production.json" +ynh_add_config --template="../conf/local-production.json" --destination="$install_dir/config/local-production.json" -chmod 600 "$final_path/config/local-production.json" -chown $app:$app "$final_path/config/local-production.json" +chmod 600 "$install_dir/config/local-production.json" +chown $app:$app "$install_dir/config/local-production.json" #================================================= # SETUP SYSTEMD @@ -206,8 +206,8 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap #================================================= ynh_script_progression --message="Installing LDAP plugin..." -pushd "$final_path" - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap +pushd "$install_dir" + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap popd #================================================= @@ -215,8 +215,8 @@ popd #================================================= ynh_script_progression --message="Installing PeerTube livechat plugin..." -pushd "$final_path" - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-livechat +pushd "$install_dir" + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-livechat popd #================================================= @@ -224,8 +224,8 @@ popd #================================================= ynh_script_progression --message="Changing PeerTube admin password..." -pushd "$final_path" - echo $admin_pass | ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run reset-password -- -u root +pushd "$install_dir" + echo $admin_pass | ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run reset-password -- -u root popd #================================================= @@ -264,24 +264,24 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." +#REMOVEME? ynh_script_progression --message="Configuring permissions..." # Make app public if necessary -if [ $is_public -eq 1 ] +#REMOVEME? if [ $is_public -eq 1 ] then # Everyone can access the app. # The "main" permission is automatically created before the install script. - ynh_permission_update --permission="main" --add="visitors" +#REMOVEME? ynh_permission_update --permission="main" --add="visitors" fi -ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" +#REMOVEME? ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # SEND A README FOR THE ADMIN diff --git a/scripts/remove b/scripts/remove index 55d6cd9..e0dc23d 100644 --- a/scripts/remove +++ b/scripts/remove @@ -15,20 +15,20 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +#REMOVEME? ynh_script_progression --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) -rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$(ynh_app_setting_get --app=$app --key=db_user) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -admin=$(ynh_app_setting_get --app=$app --key=admin) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) -path_url=$(ynh_app_setting_get --app=$app --key=path) -redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$(ynh_app_setting_get --app=$app --key=db_user) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) admin_mail=$(ynh_user_get_info --username=$admin --key="mail") @@ -64,10 +64,10 @@ ynh_remove_logrotate #================================================= # REMOVE THE POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Removing the PostgreSQL database..." +#REMOVEME? ynh_script_progression --message="Removing the PostgreSQL database..." # Remove a database if it exists, along with the associated user -ynh_psql_remove_db --db_user=$db_user --db_name=$db_name +#REMOVEME? ynh_psql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE THE REDIS DATABASE @@ -79,10 +79,10 @@ ynh_redis_remove_db "$redis_db" #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." +#REMOVEME? ynh_script_progression --message="Removing app main directory..." # Remove the app directory securely -ynh_secure_remove --file="$final_path" +#REMOVEME? ynh_secure_remove --file="$install_dir" #================================================= # REMOVE DATA DIR @@ -92,7 +92,7 @@ ynh_secure_remove --file="$final_path" if [ "${YNH_APP_PURGE:-0}" -eq 1 ] then ynh_script_progression --message="Removing app data directory..." - ynh_secure_remove --file="$datadir" +#REMOVEME? ynh_secure_remove --file="$data_dir" fi #================================================= @@ -106,11 +106,11 @@ ynh_remove_nginx_config #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." +#REMOVEME? ynh_script_progression --message="Removing dependencies..." # Remove metapackage and its dependencies ynh_remove_nodejs -ynh_remove_app_dependencies +#REMOVEME? ynh_remove_app_dependencies ynh_remove_apps #================================================= @@ -138,10 +138,10 @@ ynh_secure_remove --file="/var/log/$app" #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." +#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." # Delete a system user -ynh_system_user_delete --username=$app +#REMOVEME? ynh_system_user_delete --username=$app #================================================= # SEND A README FOR THE ADMIN diff --git a/scripts/restore b/scripts/restore index 1cbd162..c6cda60 100644 --- a/scripts/restore +++ b/scripts/restore @@ -15,81 +15,81 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +#REMOVEME? ynh_script_progression --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? 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) -port=$(ynh_app_setting_get --app=$app --key=port) -rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$(ynh_app_setting_get --app=$app --key=db_user) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$(ynh_app_setting_get --app=$app --key=db_user) +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." +#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " +#REMOVEME? test ! -d $install_dir \ + || ynh_die --message="There is already a directory: $install_dir " #================================================= # STANDARD RESTORATION STEPS #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." +#REMOVEME? 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" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_script_progression --message="Restoring the app main directory..." -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:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # RESTORE THE DATA DIRECTORY #================================================= ynh_script_progression --message="Restoring the data directory..." -ynh_restore_file --origin_path="$datadir" --not_mandatory +ynh_restore_file --origin_path="$data_dir" --not_mandatory -mkdir -p $datadir +mkdir -p $data_dir -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:www-data "$datadir" +chmod 750 "$data_dir" +chmod -R o-rwx "$data_dir" +chown -R $app:www-data "$data_dir" #================================================= # SPECIFIC RESTORATION #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." +#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." ynh_exec_warn_less ynh_install_apps --apps="$app_dependencies" -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" +#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" #================================================= # RESTORE THE NGINX CONFIGURATION @@ -101,11 +101,11 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Restoring the PostgreSQL database..." +#REMOVEME? ynh_script_progression --message="Restoring the PostgreSQL database..." -ynh_psql_test_if_first_run -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) -ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +#REMOVEME? ynh_psql_test_if_first_run +#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +#REMOVEME? 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 #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 1e34cf9..7bedfca 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -14,23 +14,23 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +#REMOVEME? ynh_script_progression --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -admin=$(ynh_app_setting_get --app=$app --key=admin) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) -rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$(ynh_app_setting_get --app=$app --key=db_user) -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$(ynh_app_setting_get --app=$app --key=db_user) +#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) admin_mail=$(ynh_user_get_info --username=$admin --key="mail") -redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) -secrets_peertube=$(ynh_app_setting_get --app=$app --key=secrets_peertube) +#REMOVEME? redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) +#REMOVEME? secrets_peertube=$(ynh_app_setting_get --app=$app --key=secrets_peertube) #================================================= # CHECK VERSION @@ -42,17 +42,17 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." +#REMOVEME? 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 () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting # Restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # STANDARD UPGRADE STEPS @@ -74,19 +74,19 @@ ynh_app_setting_delete --app=$app --key=admin_mail # If db_name doesn't exist, create it if [ -z "$db_name" ]; then db_name="peertube_${app}" - ynh_app_setting_set --app=$app --key=db_name --value=$db_name +#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name fi # If db_user doesn't exist, create it if [ -z "$db_user" ]; then db_user=$app - ynh_app_setting_set --app=$app --key=db_user --value=$db_user +#REMOVEME? ynh_app_setting_set --app=$app --key=db_user --value=$db_user fi # If db_pwd doesn't exist, create it if [ -z "$db_pwd" ]; then - db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) - ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd +#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +#REMOVEME? ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd fi # If redis_db doesn't exist, create it @@ -95,10 +95,10 @@ if [ -z "$redis_db" ]; then ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" fi -if [ -z "$datadir" ]; +if [ -z "$data_dir" ]; then - datadir="/home/yunohost.app/${app}/storage" - ynh_app_setting_set --app=$app --key=datadir --value=$datadir + data_dir="/home/yunohost.app/${app}/storage" +#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir fi # Close a port @@ -122,7 +122,7 @@ if [ -z "$rtmp_port" ]; then rtmp_port=1935 ynh_port_available --port=$rtmp_port || ynh_die --message="Port $rtmp_port is needs to be available for this app" - ynh_app_setting_set --app=$app --key=rtmp_port --value=$rtmp_port +#REMOVEME? ynh_app_setting_set --app=$app --key=rtmp_port --value=$rtmp_port # Open the port ynh_script_progression --message="Configuring firewall..." @@ -130,15 +130,15 @@ then fi # Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all +#REMOVEME? if ynh_legacy_permissions_exists; then +#REMOVEME? ynh_legacy_permissions_delete_all ynh_app_setting_delete --app=$app --key=is_public fi # Create a permission if needed -if ! ynh_permission_exists --permission="api"; then - ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" +#REMOVEME? if ! ynh_permission_exists --permission="api"; then +#REMOVEME? ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" fi # Remove hook @@ -146,17 +146,17 @@ ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app" yunohost tools regen-conf nginx # Remove old log file -ynh_secure_remove --file="$datadir/logs" +#REMOVEME? ynh_secure_remove --file="$data_dir/logs" mkdir -p "/var/log/$app" chown -R $app:$app "/var/log/$app" #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." +#REMOVEME? 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" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -167,23 +167,23 @@ then ynh_script_progression --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --full_replace=1 --dest_dir="$final_path" \ + ynh_setup_source --full_replace=1 --dest_dir="$install_dir" \ --keep="config/production.yaml config/local-production.json config/local.yaml" fi -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." +#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." ynh_exec_warn_less ynh_install_apps --apps="$app_dependencies" -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" +#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" #================================================= # NGINX CONFIGURATION @@ -200,11 +200,11 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Creating a data directory..." -mkdir -p $datadir +mkdir -p $data_dir -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:www-data "$datadir" +chmod 750 "$data_dir" +chmod -R o-rwx "$data_dir" +chown -R $app:www-data "$data_dir" #================================================= # Generate secrets if they don't exist @@ -219,9 +219,9 @@ fi #================================================= # BUILD YARN DEPENDENCIES #================================================= -ynh_script_progression --message="Building Yarn dependencies..." +#REMOVEME? ynh_script_progression --message="Building Yarn dependencies..." -pushd "$final_path" +pushd "$install_dir" ynh_use_nodejs ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean @@ -232,15 +232,15 @@ popd #================================================= ynh_script_progression --message="Updating a config file..." -ynh_add_config --template="../conf/production.yaml" --destination="$final_path/config/production.yaml" +ynh_add_config --template="../conf/production.yaml" --destination="$install_dir/config/production.yaml" -chmod 400 "$final_path/config/production.yaml" -chown $app:$app "$final_path/config/production.yaml" +chmod 400 "$install_dir/config/production.yaml" +chown $app:$app "$install_dir/config/production.yaml" -ynh_backup_if_checksum_is_different --file="$final_path/config/local-production.json" +ynh_backup_if_checksum_is_different --file="$install_dir/config/local-production.json" -chmod 600 "$final_path/config/local-production.json" -chown $app:$app "$final_path/config/local-production.json" +chmod 600 "$install_dir/config/local-production.json" +chown $app:$app "$install_dir/config/local-production.json" #================================================= # SETUP SYSTEMD @@ -265,8 +265,8 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap #================================================= ynh_script_progression --message="Installing LDAP plugin..." -pushd "$final_path" - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap +pushd "$install_dir" + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap popd #================================================= @@ -274,8 +274,8 @@ popd #================================================= ynh_script_progression --message="Installing PeerTube livechat plugin..." -pushd "$final_path" - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-livechat +pushd "$install_dir" + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-livechat popd #================================================= @@ -284,15 +284,15 @@ popd if ynh_compare_current_package_version --comparison lt --version 4.0.0~ynh1; then ynh_script_progression --message="Running Peertube 4.0.0 migration script..." - pushd "$final_path" - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_node dist/scripts/migrations/peertube-4.0.js + pushd "$install_dir" + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_node dist/scripts/migrations/peertube-4.0.js popd fi if ynh_compare_current_package_version --comparison lt --version 4.2.0~ynh1; then ynh_script_progression --message="Running Peertube 4.2.0 migration script..." - pushd "$final_path" - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_node dist/scripts/migrations/peertube-4.2.js + pushd "$install_dir" + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_node dist/scripts/migrations/peertube-4.2.js popd fi @@ -332,9 +332,9 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT From 0dee899e2a2c657893745a95aadd613a28b7862c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 21 Mar 2023 23:33:23 +0100 Subject: [PATCH 02/86] v2 --- check_process | 64 ------- .../screenshots/POST_INSTALL.md | 4 +- manifest.json | 46 ----- manifest.toml | 36 ++-- scripts/_common.sh | 157 +++++++++++++++++- scripts/backup | 22 --- scripts/install | 126 +------------- scripts/remove | 74 +-------- scripts/restore | 62 +------ scripts/upgrade | 127 +------------- scripts/ynh_apps | 110 ------------ scripts/ynh_redis | 39 ----- scripts/ynh_send_readme_to_admin__2 | 129 -------------- tests.toml | 9 + 14 files changed, 200 insertions(+), 805 deletions(-) delete mode 100644 check_process rename conf/msg_install => doc/screenshots/POST_INSTALL.md (74%) delete mode 100644 manifest.json delete mode 100644 scripts/ynh_apps delete mode 100644 scripts/ynh_redis delete mode 100644 scripts/ynh_send_readme_to_admin__2 create mode 100644 tests.toml diff --git a/check_process b/check_process deleted file mode 100644 index 32edd4d..0000000 --- a/check_process +++ /dev/null @@ -1,64 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - is_public=1 - admin="john" - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - # 3.2.1~ynh1 - # upgrade=1 from_commit=f4b43fd85ad3a169d27c53865a13548e44f17ebf - # 3.2.1~ynh3 - #upgrade=1 from_commit=7a621c48f6bdd10334f2d0c06f787fe468788f62 - # 3.2.1~ynh4 - upgrade=1 from_commit=08bf3fce3ad99e27e7f7d251838a9f9c63243e44 - # 3.3.0~ynh1 - #upgrade=1 from_commit=c43548f6e0a0e5d172360945f6941255537ec18c - # 3.3.0~ynh2 - #upgrade=1 from_commit=6010986d58ef0caa8428e3d6e3ff3fd512401a53 - # 3.3.0~ynh2 - #upgrade=1 from_commit=f3bb02002c8fa28748744302475139b6fcf7c651 - # 3.3.0~ynh3 - #upgrade=1 from_commit=ed59a268e93910f8b35b0f87399f91b8cad9ede0 - # 3.3.0~ynh4 - #upgrade=1 from_commit=509ba9051facf65329dde20919a3254dcaf3f910 - # 3.4.0~ynh1 - #upgrade=1 from_commit=83a06ca4c96ccd941b49647b3698db2c6b771b79 - # 3.4.1~ynh1 - #upgrade=1 from_commit=96f010a9f72fed48660b3f962124b553397b283b - # 3.4.1~ynh2 - #upgrade=1 from_commit=0b6823def8230b3af7f9b484c526a49c3a640c4d - # 3.4.1~ynh3 - upgrade=1 from_commit=0f77bb6e7441698b762bde38698c510dc0a4438e - # 4.0.0~ynh1 - #upgrade=1 from_commit=602bf56af8582a38c7ee055f60e782e2da0efddc - # 4.0.0~ynh1 - #upgrade=1 from_commit=7c2bb0bb6a91b6b957b734f684aa3d64da892f4c - # 4.0.0~ynh1 - #upgrade=1 from_commit=9bdfda10d83519064adeb275f6aed1660bf24b88 - # 4.0.0~ynh2 - #upgrade=1 from_commit=16bc11e945c2b1a962a5deace7c0f27b8d5a5112 - # 4.0.0~ynh2 - #upgrade=1 from_commit=6995b27972e27c6cf8ee3e1f23a2de5cc8c8e8ee - # 4.1.0~ynh1 - upgrade=1 from_commit=d5aa8c2194297b332d26e68b5e9e8ada17377742 - # 4.1.1~ynh1 - upgrade=1 from_commit=24c8333d70312e9dcf8d278e64787ca561a10b2e - # 4.2.0~ynh1 - upgrade=1 from_commit=ddb937ecab9454e8dd0b07627a02bad27c9f6556 - # 4.2.1~ynh1 - upgrade=1 from_commit=5a488aebc53dafa5c431580ca4437eed0ad7da1e - # 4.2.2~ynh1 - upgrade=1 from_commit=9bf92ff65db0dcb188834738f180dbfa34ebef09 - backup_restore=1 - multi_instance=0 - port_already_use=0 - change_url=0 -;;; Options -Email= -Notification=none diff --git a/conf/msg_install b/doc/screenshots/POST_INSTALL.md similarity index 74% rename from conf/msg_install rename to doc/screenshots/POST_INSTALL.md index 1f0ad66..34d364b 100644 --- a/conf/msg_install +++ b/doc/screenshots/POST_INSTALL.md @@ -5,7 +5,7 @@ Please open your __APP__ domain: https://__DOMAIN____PATH__ The admin username is: root The admin password is: __ADMIN_PASS__ -To make PeerTube Live available, you also need to make the TCP port __RTMP_PORT__ available from internet (For example, opening the port on your ISP box if it's not automatically done). +To make PeerTube Live available, you also need to make the TCP port __PORT_RTMP__ available from internet (For example, opening the port on your ISP box if it's not automatically done). To enable LDAP authentication open https://__DOMAIN____PATH__admin/plugins/show/peertube-plugin-auth-ldap Complete with the following informations : @@ -13,5 +13,3 @@ Complete with the following informations : - Insecure TLS : checked - Search base : ou=users,dc=yunohost,dc=org All YunoHost users will be allowed to login as peertube user. - -If you are facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/peertube_ynh diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 955c8d6..0000000 --- a/manifest.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "PeerTube", - "id": "peertube", - "packaging_format": 1, - "description": { - "en": "Federated video streaming platform using P2P directly in the web browser", - "fr": "Plateforme fédéralisé de diffusion vidéo par P2P directement dans le navigateur" - }, - "version": "5.0.1~ynh1", - "url": "https://github.com/Chocobozzz/PeerTube", - "upstream": { - "license": "AGPL-3.0-only", - "website": "https://joinpeertube.org/fr", - "demo": "http://peertube.cpy.re", - "admindoc": "https://docs.joinpeertube.org", - "code": "https://github.com/Chocobozzz/PeerTube" - }, - "license": "AGPL-3.0-only", - "maintainer": { - "name": "yalh76" - }, - "requirements": { - "yunohost": ">= 11.0.0" - }, - "multi_instance": false, - "services": [ - "nginx" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "is_public", - "type": "boolean", - "default": true - }, - { - "name": "admin", - "type": "user" - } - ] - } -} diff --git a/manifest.toml b/manifest.toml index 826a756..ffeda6d 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "PeerTube" description.en = "Federated video streaming platform using P2P directly in the web browser" description.fr = "Plateforme fédéralisé de diffusion vidéo par P2P directement dans le navigateur" -version = "5.0.1~ynh1" +version = "5.1.0~ynh1" maintainers = ["yalh76"] @@ -15,22 +15,19 @@ website = "https://joinpeertube.org/fr" demo = "http://peertube.cpy.re" admindoc = "https://docs.joinpeertube.org" code = "https://github.com/Chocobozzz/PeerTube" -cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) -fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. [integration] -yunohost = ">= 11.0.0" -architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +yunohost = ">= 11.1.15" +architectures = "all" multi_instance = false -ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. -sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. -disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... -ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... -ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ldap = false +sso = false +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" full_domain = true @@ -39,14 +36,16 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen default = "visitors" [install.admin] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "user" [resources] [resources.sources.main] - url = "https://github.com/Chocobozzz/PeerTube/releases/download/v5.0.1/peertube-v5.0.1.tar.xz" - sha256 = "f43d36fb73b87dc1e6f86fc4d5039aba9f4619c5fff6d64669a900989bed80e2" + url = "https://github.com/Chocobozzz/PeerTube/releases/download/v5.1.0/peertube-v5.1.0.tar.xz" + sha256 = "5254562020e27a4d11364e4b6b348e0ce073d36b9a7a1c8d9e1e2d5248d77552" + [resources.ports] + rtmp.default = 1935 + rtmp.exposed = "TCP" [resources.system_user] @@ -56,6 +55,15 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.permissions] main.url = "/" + api.url = "/api" + api.allowed = "visitors" + api.auth_header = false + api.show_tile = false + api.protected = true + + [resources.apt] + packages = "ffmpeg postgresql postgresql-contrib openssl g++ mailutils apt-transport-https prosody" + [[resources.apt.extras]] repo = "deb https://dl.yarnpkg.com/debian/ stable main" key = "https://dl.yarnpkg.com/debian/pubkey.gpg" diff --git a/scripts/_common.sh b/scripts/_common.sh index f019a88..c4376f3 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,7 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -#REMOVEME? pkg_dependencies="ffmpeg postgresql postgresql-contrib openssl g++ mailutils apt-transport-https" -#REMOVEME? app_dependencies="prosody" +app_dependencies="prosody" nodejs_version=16 @@ -18,6 +16,159 @@ nodejs_version=16 # EXPERIMENTAL HELPERS #================================================= +#!/bin/bash + +# Install others YunoHost apps +# +# usage: ynh_install_apps --apps="appfoo?domain=domain.foo&path=/foo appbar?domain=domain.bar&path=/bar&admin=USER&language=fr&is_public=1&pass?word=pass&port=666" +# | arg: -a, --apps= - apps to install +# +# Requires YunoHost version *.*.* or higher. +ynh_install_apps() { + # Declare an array to define the options of this helper. + local legacy_args=a + local -A args_array=([a]=apps=) + local apps + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + + # Split the list of apps in an array + local apps_list=($(echo $apps | tr " " "\n")) + local apps_dependencies="" + + # For each app + for one_app_and_its_args in "${apps_list[@]}" + do + # Retrieve the name of the app (part before ?) + local one_app=$(cut -d "?" -f1 <<< "$one_app_and_its_args") + [ -z "$one_app" ] && ynh_die --message="You didn't provided a YunoHost app to install" + + yunohost tools update apps + + # Installing or upgrading the app depending if it's installed or not + if ! yunohost app list --output-as json --quiet | jq -e --arg id $one_app '.apps[] | select(.id == $id)' >/dev/null + then + # Retrieve the arguments of the app (part after ?) + local one_argument=$(cut -d "?" -f2- <<< "$one_app_and_its_args") + [ ! -z "$one_argument" ] && one_argument="--args $one_argument" + + # Install the app with its arguments + yunohost app install $one_app $one_argument + else + # Upgrade the app + yunohost app upgrade $one_app + fi + + if [ ! -z "$apps_dependencies" ] + then + apps_dependencies="$apps_dependencies, $one_app" + else + apps_dependencies="$one_app" + fi + done + + ynh_app_setting_set --app=$app --key=apps_dependencies --value="$apps_dependencies" +} + +# Remove other YunoHost apps +# +# Other YunoHost apps will be removed only if no other apps need them. +# +# usage: ynh_remove_apps +# +# Requires YunoHost version *.*.* or higher. +ynh_remove_apps() { + # Retrieve the apps dependencies of the app + local apps_dependencies=$(ynh_app_setting_get --app=$app --key=apps_dependencies) + ynh_app_setting_delete --app=$app --key=apps_dependencies + + if [ ! -z "$apps_dependencies" ] + then + # Split the list of apps dependencies in an array + local apps_dependencies_list=($(echo $apps_dependencies | tr ", " "\n")) + + # For each apps dependencies + for one_app in "${apps_dependencies_list[@]}" + do + # Retrieve the list of installed apps + local installed_apps_list=$(yunohost app list --output-as json --quiet | jq -r .apps[].id) + local required_by="" + local installed_app_required_by="" + + # For each other installed app + for one_installed_app in $installed_apps_list + do + # Retrieve the other apps dependencies + one_installed_apps_dependencies=$(ynh_app_setting_get --app=$one_installed_app --key=apps_dependencies) + if [ ! -z "$one_installed_apps_dependencies" ] + then + one_installed_apps_dependencies_list=($(echo $one_installed_apps_dependencies | tr ", " "\n")) + + # For each dependency of the other apps + for one_installed_app_dependency in "${one_installed_apps_dependencies_list[@]}" + do + if [[ $one_installed_app_dependency == $one_app ]]; then + required_by="$required_by $one_installed_app" + fi + done + fi + done + + # If $one_app is no more required + if [[ -z "$required_by" ]] + then + # Remove $one_app + ynh_print_info --message="Removing of $one_app" + yunohost app remove $one_app --purge + else + ynh_print_info --message="$one_app was not removed because it's still required by${required_by}" + fi + done + fi +} + + + + +# get the first available redis database +# +# usage: ynh_redis_get_free_db +# | returns: the database number to use +ynh_redis_get_free_db() { + local result max db + result=$(redis-cli INFO keyspace) + + # get the num + max=$(cat /etc/redis/redis.conf | grep ^databases | grep -Eow "[0-9]+") + + db=0 + # default Debian setting is 15 databases + for i in $(seq 0 "$max") + do + if ! echo "$result" | grep -q "db$i" + then + db=$i + break 1 + fi + db=-1 + done + + test "$db" -eq -1 && ynh_die --message="No available Redis databases..." + + echo "$db" +} + +# Create a master password and set up global settings +# Please always call this script in install and restore scripts +# +# usage: ynh_redis_remove_db database +# | arg: database - the database to erase +ynh_redis_remove_db() { + local db=$1 + redis-cli -n "$db" flushall +} + + #================================================= # FUTURE OFFICIAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index a0fa300..475a542 100644 --- a/scripts/backup +++ b/scripts/backup @@ -10,28 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - true -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/install b/scripts/install index 48938ba..c075705 100644 --- a/scripts/install +++ b/scripts/install @@ -7,32 +7,12 @@ #================================================= source _common.sh -source ynh_redis -source ynh_send_readme_to_admin__2 -source ynh_apps source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -#REMOVEME? domain=$YNH_APP_ARG_DOMAIN -path="/" -#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC -#REMOVEME? admin=$YNH_APP_ARG_ADMIN - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - admin_mail=$(ynh_user_get_info --username=$admin --key="mail") admin_pass=$(ynh_string_random --length=24) secrets_peertube=$(ynh_string_random --length=24) @@ -40,76 +20,26 @@ secrets_peertube=$(ynh_string_random --length=24) # Define app's data directory #REMOVEME? data_dir="/home/yunohost.app/${app}/storage" -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." - -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" - -# Register (book) web path -#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." +ynh_script_progression --message="Storing installation settings..." -#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain -#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=secrets_peertube --value=$secrets_peertube -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -#REMOVEME? ynh_script_progression --message="Finding an available port..." - -# Find an available port -#REMOVEME? port=$(ynh_find_port --port=8095) -#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port - -# PeerTube Live port -rtmp_port=1935 -ynh_port_available --port=$rtmp_port || ynh_die --message="Port $rtmp_port is needs to be available for this app" -#REMOVEME? ynh_app_setting_set --app=$app --key=rtmp_port --value=$rtmp_port - -# Open the port -ynh_script_progression --message="Configuring firewall..." -ynh_exec_warn_less yunohost firewall allow TCP $rtmp_port - #================================================= # INSTALL DEPENDENCIES #================================================= #REMOVEME? ynh_script_progression --message="Installing dependencies..." ynh_exec_warn_less ynh_install_apps --apps="$app_dependencies" -#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies + ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -#REMOVEME? ynh_exec_warn_less 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 -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring system user..." - -# Create a system user -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # CREATE A POSTGRESQL DATABASE #================================================= -#REMOVEME? ynh_script_progression --message="Creating a PostgreSQL database..." - -#REMOVEME? db_name="peertube_${app}" -#REMOVEME? db_user=$(ynh_sanitize_dbid --db_name=$app) -#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name -#REMOVEME? ynh_app_setting_set --app=$app --key=db_user --value=$db_user -#REMOVEME? ynh_psql_test_if_first_run -#REMOVEME? ynh_psql_setup_db --db_user=$db_user --db_name=$db_name -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +ynh_script_progression --message="Creating a PostgreSQL database..." ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database=$db_name ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name @@ -126,11 +56,9 @@ ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" #================================================= ynh_script_progression --message="Setting up source files..." -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" @@ -142,25 +70,10 @@ ynh_script_progression --message="Configuring NGINX web server..." # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# SPECIFIC SETUP -#================================================= -# CREATE DATA DIRECTORY -#================================================= -ynh_script_progression --message="Creating a data directory..." - -#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir - -mkdir -p $data_dir - -chmod 750 "$data_dir" -chmod -R o-rwx "$data_dir" -chown -R $app:www-data "$data_dir" - #================================================= # BUILD YARN DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Building Yarn dependencies..." +ynh_script_progression --message="Building Yarn dependencies..." pushd "$install_dir" ynh_use_nodejs @@ -251,7 +164,7 @@ ynh_use_logrotate #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description="$app daemon for Peertube" --log="/var/log/$app/$app.log" --needs_exposed_ports $rtmp_port +yunohost service add $app --description="$app daemon for Peertube" --log="/var/log/$app/$app.log" --needs_exposed_ports $port_rtmp #================================================= # START SYSTEMD SERVICE @@ -261,35 +174,6 @@ ynh_script_progression --message="Starting a systemd service..." # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="HTTP server listening on localhost" -#================================================= -# SETUP SSOWAT -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." - -# Make app public if necessary -#REMOVEME? if [ $is_public -eq 1 ] -then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. -#REMOVEME? ynh_permission_update --permission="main" --add="visitors" -fi - -#REMOVEME? ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" - -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - -#================================================= -# SEND A README FOR THE ADMIN -#================================================= -ynh_script_progression --message="Sending a readme for the admin..." - -ynh_send_readme_to_admin --app_message="../conf/msg_install" --recipients=$admin_mail --type='install' - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index e0dc23d..40bbb00 100644 --- a/scripts/remove +++ b/scripts/remove @@ -7,28 +7,11 @@ #================================================= source _common.sh -source ynh_redis -source ynh_send_readme_to_admin__2 -source ynh_apps source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$(ynh_app_setting_get --app=$app --key=db_user) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) -#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) admin_mail=$(ynh_user_get_info --username=$admin --key="mail") @@ -61,14 +44,6 @@ ynh_script_progression --message="Removing logrotate configuration..." # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# REMOVE THE POSTGRESQL DATABASE -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the PostgreSQL database..." - -# Remove a database if it exists, along with the associated user -#REMOVEME? ynh_psql_remove_db --db_user=$db_user --db_name=$db_name - #================================================= # REMOVE THE REDIS DATABASE #================================================= @@ -76,25 +51,6 @@ ynh_script_progression --message="Removing the redis database..." ynh_redis_remove_db "$redis_db" -#================================================= -# REMOVE APP MAIN DIR -#================================================= -#REMOVEME? ynh_script_progression --message="Removing app main directory..." - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" - -#================================================= -# REMOVE DATA DIR -#================================================= - -# Remove the data directory if --purge option is used -if [ "${YNH_APP_PURGE:-0}" -eq 1 ] -then - ynh_script_progression --message="Removing app data directory..." -#REMOVEME? ynh_secure_remove --file="$data_dir" -fi - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -106,23 +62,12 @@ ynh_remove_nginx_config #================================================= # REMOVE DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Removing dependencies..." +ynh_script_progression --message="Removing dependencies..." # Remove metapackage and its dependencies ynh_remove_nodejs -#REMOVEME? ynh_remove_app_dependencies ynh_remove_apps -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $rtmp_port$" -then - ynh_script_progression --message="Closing port $rtmp_port..." - ynh_exec_warn_less yunohost firewall disallow TCP $rtmp_port -fi - #================================================= # SPECIFIC REMOVE #================================================= @@ -133,23 +78,6 @@ ynh_script_progression --message="Removing various files..." # Remove the log files ynh_secure_remove --file="/var/log/$app" -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." - -# Delete a system user -#REMOVEME? ynh_system_user_delete --username=$app - -#================================================= -# SEND A README FOR THE ADMIN -#================================================= -ynh_script_progression --message="Sending a readme for the admin..." - -ynh_send_readme_to_admin --app_message="../conf/msg_remove" --recipients=$admin_mail --type='remove' - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index c6cda60..5505e83 100644 --- a/scripts/restore +++ b/scripts/restore @@ -8,53 +8,8 @@ # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh -source ../settings/scripts/ynh_apps source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$(ynh_app_setting_get --app=$app --key=db_user) -#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." - -#REMOVEME? test ! -d $install_dir \ - || ynh_die --message="There is already a directory: $install_dir " - -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." - -# Create the dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -62,7 +17,6 @@ ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" @@ -73,10 +27,6 @@ ynh_script_progression --message="Restoring the data directory..." ynh_restore_file --origin_path="$data_dir" --not_mandatory -mkdir -p $data_dir - -chmod 750 "$data_dir" -chmod -R o-rwx "$data_dir" chown -R $app:www-data "$data_dir" #================================================= @@ -84,12 +34,11 @@ chown -R $app:www-data "$data_dir" #================================================= # REINSTALL DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." +ynh_script_progression --message="Reinstalling dependencies..." ynh_exec_warn_less ynh_install_apps --apps="$app_dependencies" -#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies + ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" #================================================= # RESTORE THE NGINX CONFIGURATION @@ -101,11 +50,8 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= -#REMOVEME? ynh_script_progression --message="Restoring the PostgreSQL database..." +ynh_script_progression --message="Restoring the PostgreSQL database..." -#REMOVEME? ynh_psql_test_if_first_run -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) -#REMOVEME? 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 #================================================= @@ -138,7 +84,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description="$app daemon for Peertube" --log="/var/log/$app/$app.log" --needs_exposed_ports $rtmp_port +yunohost service add $app --description="$app daemon for Peertube" --log="/var/log/$app/$app.log" --needs_exposed_ports $port_rtmp #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 7bedfca..45542fb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -7,53 +7,20 @@ #================================================= source _common.sh -source ynh_redis -source ynh_apps source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$(ynh_app_setting_get --app=$app --key=db_user) -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) -#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) admin_mail=$(ynh_user_get_info --username=$admin --key="mail") -#REMOVEME? redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) -#REMOVEME? secrets_peertube=$(ynh_app_setting_get --app=$app --key=secrets_peertube) #================================================= # CHECK VERSION #================================================= -ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting - # Restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -71,43 +38,12 @@ ynh_script_progression --message="Ensuring downward compatibility..." ynh_app_setting_delete --app=$app --key=admin_pass ynh_app_setting_delete --app=$app --key=admin_mail -# If db_name doesn't exist, create it -if [ -z "$db_name" ]; then - db_name="peertube_${app}" -#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name -fi - -# If db_user doesn't exist, create it -if [ -z "$db_user" ]; then - db_user=$app -#REMOVEME? ynh_app_setting_set --app=$app --key=db_user --value=$db_user -fi - -# If db_pwd doesn't exist, create it -if [ -z "$db_pwd" ]; then -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) -#REMOVEME? ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd -fi - # If redis_db doesn't exist, create it if [ -z "$redis_db" ]; then redis_db=$(ynh_redis_get_free_db) ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" fi -if [ -z "$data_dir" ]; -then - data_dir="/home/yunohost.app/${app}/storage" -#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir -fi - -# Close a port -if yunohost firewall list | grep -q "\- $port$" -then - ynh_script_progression --message="Closing port $port" - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - # Add PostgreSQL extension for v1.0.0-beta.10.pre.1 ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database=$db_name ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name @@ -118,46 +54,15 @@ 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 - ynh_port_available --port=$rtmp_port || ynh_die --message="Port $rtmp_port is needs to be available for this app" -#REMOVEME? ynh_app_setting_set --app=$app --key=rtmp_port --value=$rtmp_port - - # Open the port - ynh_script_progression --message="Configuring firewall..." - ynh_exec_warn_less yunohost firewall allow TCP $rtmp_port -fi - -# Cleaning legacy permissions -#REMOVEME? if ynh_legacy_permissions_exists; then -#REMOVEME? ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - -# Create a permission if needed -#REMOVEME? if ! ynh_permission_exists --permission="api"; then -#REMOVEME? ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" -fi - # Remove hook ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app" yunohost tools regen-conf nginx # Remove old log file -#REMOVEME? ynh_secure_remove --file="$data_dir/logs" +ynh_secure_remove --file="$data_dir/logs" mkdir -p "/var/log/$app" chown -R $app:$app "/var/log/$app" -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." - -# Create a dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -171,19 +76,16 @@ then --keep="config/production.yaml config/local-production.json config/local.yaml" fi -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= # UPGRADE DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." +ynh_script_progression --message="Upgrading dependencies..." ynh_exec_warn_less ynh_install_apps --apps="$app_dependencies" -#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" #================================================= # NGINX CONFIGURATION @@ -193,19 +95,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# SPECIFIC UPGRADE -#================================================= -# CREATE DATA DIRECTORY -#================================================= -ynh_script_progression --message="Creating a data directory..." - -mkdir -p $data_dir - -chmod 750 "$data_dir" -chmod -R o-rwx "$data_dir" -chown -R $app:www-data "$data_dir" - #================================================= # Generate secrets if they don't exist #================================================= @@ -219,7 +108,7 @@ fi #================================================= # BUILD YARN DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Building Yarn dependencies..." +ynh_script_progression --message="Building Yarn dependencies..." pushd "$install_dir" ynh_use_nodejs @@ -296,7 +185,6 @@ if ynh_compare_current_package_version --comparison lt --version 4.2.0~ynh1; the popd fi - #================================================= # STOP SYSTEMD SERVICE #================================================= @@ -320,7 +208,7 @@ ynh_use_logrotate --non-append #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description="$app daemon for Peertube" --log="/var/log/$app/$app.log" --needs_exposed_ports $rtmp_port +yunohost service add $app --description="$app daemon for Peertube" --log="/var/log/$app/$app.log" --needs_exposed_ports $port_rtmp #================================================= # START SYSTEMD SERVICE @@ -329,13 +217,6 @@ ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="HTTP server listening on localhost" -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/ynh_apps b/scripts/ynh_apps deleted file mode 100644 index 0faad86..0000000 --- a/scripts/ynh_apps +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/bash - -# Install others YunoHost apps -# -# usage: ynh_install_apps --apps="appfoo?domain=domain.foo&path=/foo appbar?domain=domain.bar&path=/bar&admin=USER&language=fr&is_public=1&pass?word=pass&port=666" -# | arg: -a, --apps= - apps to install -# -# Requires YunoHost version *.*.* or higher. -ynh_install_apps() { - # Declare an array to define the options of this helper. - local legacy_args=a - local -A args_array=([a]=apps=) - local apps - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - - # Split the list of apps in an array - local apps_list=($(echo $apps | tr " " "\n")) - local apps_dependencies="" - - # For each app - for one_app_and_its_args in "${apps_list[@]}" - do - # Retrieve the name of the app (part before ?) - local one_app=$(cut -d "?" -f1 <<< "$one_app_and_its_args") - [ -z "$one_app" ] && ynh_die --message="You didn't provided a YunoHost app to install" - - yunohost tools update apps - - # Installing or upgrading the app depending if it's installed or not - if ! yunohost app list --output-as json --quiet | jq -e --arg id $one_app '.apps[] | select(.id == $id)' >/dev/null - then - # Retrieve the arguments of the app (part after ?) - local one_argument=$(cut -d "?" -f2- <<< "$one_app_and_its_args") - [ ! -z "$one_argument" ] && one_argument="--args $one_argument" - - # Install the app with its arguments - yunohost app install $one_app $one_argument - else - # Upgrade the app - yunohost app upgrade $one_app - fi - - if [ ! -z "$apps_dependencies" ] - then - apps_dependencies="$apps_dependencies, $one_app" - else - apps_dependencies="$one_app" - fi - done - - ynh_app_setting_set --app=$app --key=apps_dependencies --value="$apps_dependencies" -} - -# Remove other YunoHost apps -# -# Other YunoHost apps will be removed only if no other apps need them. -# -# usage: ynh_remove_apps -# -# Requires YunoHost version *.*.* or higher. -ynh_remove_apps() { - # Retrieve the apps dependencies of the app - local apps_dependencies=$(ynh_app_setting_get --app=$app --key=apps_dependencies) - ynh_app_setting_delete --app=$app --key=apps_dependencies - - if [ ! -z "$apps_dependencies" ] - then - # Split the list of apps dependencies in an array - local apps_dependencies_list=($(echo $apps_dependencies | tr ", " "\n")) - - # For each apps dependencies - for one_app in "${apps_dependencies_list[@]}" - do - # Retrieve the list of installed apps - local installed_apps_list=$(yunohost app list --output-as json --quiet | jq -r .apps[].id) - local required_by="" - local installed_app_required_by="" - - # For each other installed app - for one_installed_app in $installed_apps_list - do - # Retrieve the other apps dependencies - one_installed_apps_dependencies=$(ynh_app_setting_get --app=$one_installed_app --key=apps_dependencies) - if [ ! -z "$one_installed_apps_dependencies" ] - then - one_installed_apps_dependencies_list=($(echo $one_installed_apps_dependencies | tr ", " "\n")) - - # For each dependency of the other apps - for one_installed_app_dependency in "${one_installed_apps_dependencies_list[@]}" - do - if [[ $one_installed_app_dependency == $one_app ]]; then - required_by="$required_by $one_installed_app" - fi - done - fi - done - - # If $one_app is no more required - if [[ -z "$required_by" ]] - then - # Remove $one_app - ynh_print_info --message="Removing of $one_app" - yunohost app remove $one_app --purge - else - ynh_print_info --message="$one_app was not removed because it's still required by${required_by}" - fi - done - fi -} diff --git a/scripts/ynh_redis b/scripts/ynh_redis deleted file mode 100644 index 9d6257d..0000000 --- a/scripts/ynh_redis +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -# get the first available redis database -# -# usage: ynh_redis_get_free_db -# | returns: the database number to use -ynh_redis_get_free_db() { - local result max db - result=$(redis-cli INFO keyspace) - - # get the num - max=$(cat /etc/redis/redis.conf | grep ^databases | grep -Eow "[0-9]+") - - db=0 - # default Debian setting is 15 databases - for i in $(seq 0 "$max") - do - if ! echo "$result" | grep -q "db$i" - then - db=$i - break 1 - fi - db=-1 - done - - test "$db" -eq -1 && ynh_die --message="No available Redis databases..." - - echo "$db" -} - -# Create a master password and set up global settings -# Please always call this script in install and restore scripts -# -# usage: ynh_redis_remove_db database -# | arg: database - the database to erase -ynh_redis_remove_db() { - local db=$1 - redis-cli -n "$db" flushall -} diff --git a/scripts/ynh_send_readme_to_admin__2 b/scripts/ynh_send_readme_to_admin__2 deleted file mode 100644 index ee571cc..0000000 --- a/scripts/ynh_send_readme_to_admin__2 +++ /dev/null @@ -1,129 +0,0 @@ -#!/bin/bash - -# Send an email to inform the administrator -# -# usage: ynh_send_readme_to_admin --app_message=app_message [--recipients=recipients] [--type=type] -# | arg: -m --app_message= - The file with the content to send to the administrator. -# | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root -# example: "root admin@domain" -# 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= ) - local app_message - local recipients - local type - # Manage arguments with getopts - - ynh_handle_getopts_args "$@" - app_message="${app_message:-}" - recipients="${recipients:-root}" - type="${type:-install}" - - # Get the value of admin_mail_html - admin_mail_html=$(ynh_app_setting_get $app admin_mail_html) - admin_mail_html="${admin_mail_html:-0}" - - # Retrieve the email of users - find_mails () { - local list_mails="$1" - local mail - local recipients=" " - # Read each mail in argument - for mail in $list_mails - do - # Keep root or a real email address as it is - if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@" - then - recipients="$recipients $mail" - else - # But replace an user name without a domain after by its email - if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null) - then - recipients="$recipients $mail" - fi - fi - done - echo "$recipients" - } - recipients=$(find_mails "$recipients") - - # Subject base - local mail_subject="☁️🆈🅽🅷☁️: \`$app\`" - - # Adapt the subject according to the type of mail required. - if [ "$type" = "backup" ]; then - mail_subject="$mail_subject has just been backup." - elif [ "$type" = "change_url" ]; then - mail_subject="$mail_subject has just been moved to a new URL!" - elif [ "$type" = "remove" ]; then - mail_subject="$mail_subject has just been removed!" - elif [ "$type" = "restore" ]; then - mail_subject="$mail_subject has just been restored!" - elif [ "$type" = "upgrade" ]; then - mail_subject="$mail_subject has just been upgraded!" - else # install - 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. - -$(cat "../conf/msg__to_send")" - - # Store the message into a file for further modifications. - echo "$mail_message" > mail_to_send - - # If a html email is required. Apply html tags to the message. - if [ "$admin_mail_html" -eq 1 ] - then - # Insert 'br' tags at each ending of lines. - ynh_replace_string "$" "
" mail_to_send - - # Insert starting HTML tags - sed --in-place '1s@^@\n\n\n\n@' mail_to_send - - # Keep tabulations - ynh_replace_string " " "\ \ " mail_to_send - ynh_replace_string "\t" "\ \ " mail_to_send - - # Insert url links tags - ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "\1" mail_to_send - - # Insert finishing HTML tags - echo -e "\n\n" >> mail_to_send - - # Otherwise, remove tags to keep a plain text. - else - # Remove URL tags - ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send - ynh_replace_string "__URL_TAG2__" ": " mail_to_send - fi - - # Define binary to use for mail command - if [ -e /usr/bin/bsd-mailx ] - then - local mail_bin=/usr/bin/bsd-mailx - else - local mail_bin=/usr/bin/mail.mailutils - fi - - if [ "$admin_mail_html" -eq 1 ] - then - content_type="text/html" - else - content_type="text/plain" - fi - - # Send the email to the recipients - cat mail_to_send | $mail_bin -a "Content-Type: $content_type; charset=UTF-8" -s "$mail_subject" "$recipients" -} diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..dd48a1c --- /dev/null +++ b/tests.toml @@ -0,0 +1,9 @@ +test_format = 1.0 + +[default] + + # ------------------------------- + # Commits to test upgrade from + # ------------------------------- + + test_upgrade_from.9bf92ff6.name = "Upgrade from 4.2.2" \ No newline at end of file From 4782bd9631562420472767dd4847d7eb00e123ae Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 21 Mar 2023 22:33:29 +0000 Subject: [PATCH 03/86] Auto-update README --- README.md | 3 ++- README_fr.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 36c5dff..a629056 100644 --- a/README.md +++ b/README.md @@ -19,13 +19,14 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser, using WebTorrent. -**Shipped version:** 5.0.1~ynh1 +**Shipped version:** 5.1.0~ynh1 **Demo:** http://peertube.cpy.re ## Screenshots ![Screenshot of PeerTube](./doc/screenshots/screenshot1.jpg) +![Screenshot of PeerTube](./doc/screenshots/POST_INSTALL.md) ## Disclaimers / important information diff --git a/README_fr.md b/README_fr.md index 3c15d1a..bf206e7 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,13 +19,14 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorrent) directement dans le navigateur Web, en utilisant WebTorrent -**Version incluse :** 5.0.1~ynh1 +**Version incluse :** 5.1.0~ynh1 **Démo :** http://peertube.cpy.re ## Captures d’écran ![Capture d’écran de PeerTube](./doc/screenshots/screenshot1.jpg) +![Capture d’écran de PeerTube](./doc/screenshots/POST_INSTALL.md) ## Avertissements / informations importantes From c33e948eb921f5ced411c10db03e331329a21bc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 21 Mar 2023 23:34:22 +0100 Subject: [PATCH 04/86] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index ffeda6d..e587fcf 100644 --- a/manifest.toml +++ b/manifest.toml @@ -62,7 +62,7 @@ ram.runtime = "50M" api.protected = true [resources.apt] - packages = "ffmpeg postgresql postgresql-contrib openssl g++ mailutils apt-transport-https prosody" + packages = "ffmpeg postgresql postgresql-contrib openssl g++ mailutils apt-transport-https" [[resources.apt.extras]] repo = "deb https://dl.yarnpkg.com/debian/ stable main" From d6dee9af0a31dbb8eea8fa99ad411df169b35aa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 21 Mar 2023 23:35:45 +0100 Subject: [PATCH 05/86] v2 --- doc/{DISCLAIMER.md => ADMIN.md} | 0 doc/{DISCLAIMER_fr.md => ADMIN_fr.md} | 0 doc/{screenshots => }/POST_INSTALL.md | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename doc/{DISCLAIMER.md => ADMIN.md} (100%) rename doc/{DISCLAIMER_fr.md => ADMIN_fr.md} (100%) rename doc/{screenshots => }/POST_INSTALL.md (100%) diff --git a/doc/DISCLAIMER.md b/doc/ADMIN.md similarity index 100% rename from doc/DISCLAIMER.md rename to doc/ADMIN.md diff --git a/doc/DISCLAIMER_fr.md b/doc/ADMIN_fr.md similarity index 100% rename from doc/DISCLAIMER_fr.md rename to doc/ADMIN_fr.md diff --git a/doc/screenshots/POST_INSTALL.md b/doc/POST_INSTALL.md similarity index 100% rename from doc/screenshots/POST_INSTALL.md rename to doc/POST_INSTALL.md From 50a6085ec09f5932baeb0fc11565cb6935854740 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 21 Mar 2023 22:35:50 +0000 Subject: [PATCH 06/86] Auto-update README --- README.md | 40 ---------------------------------------- README_fr.md | 39 --------------------------------------- 2 files changed, 79 deletions(-) diff --git a/README.md b/README.md index a629056..ce659c2 100644 --- a/README.md +++ b/README.md @@ -26,46 +26,6 @@ Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly ## Screenshots ![Screenshot of PeerTube](./doc/screenshots/screenshot1.jpg) -![Screenshot of PeerTube](./doc/screenshots/POST_INSTALL.md) - -## Disclaimers / important information - -### Why PeerTube? - -We can't build a FOSS video streaming alternatives to YouTube, Dailymotion, Vimeo... with a centralized software. One organization alone cannot have enough money to pay bandwidth and video storage of its server. - -So we need to have a decentralized network of servers seeding videos (as [Hubzilla YunoHost](https://github.com/YunoHost-Apps/hubzilla_ynh), [Friendica YunoHost](https://github.com/YunoHost-Apps/friendica_ynh),[Mastodon YunoHost](https://github.com/YunoHost-Apps/mastodon_ynh)), [Diaspora](https://github.com/diaspora/diaspora) ([Diaspora YunoHost](https://github.com/YunoHost-Apps/diaspora_ynh)),[Funkwhale](https://funkwhale.audio) ([Funkwhale YunoHost](https://github.com/YunoHost-Apps/funkwhale_ynh)). -But it's not enough because one video could become famous and overload the server. -It's the reason why we need to use a P2P protocol to limit the server load. -Thanks to [WebTorrent](https://github.com/feross/webtorrent), we can make P2P (thus BitTorrent) inside the web browser, as of today. - -### Why is that cool? -Servers are run independently by different people and organizations. They can apply wildly different moderation policies, so you can find or make one that fits your taste perfectly. - -By watching a video, you help the hosting provider to broadcast it by becoming a broadcaster of the video yourself. Each instance doesn't need much money to broadcast the videos of its users. - -### IMPORTANT POINT TO READ BEFORE INSTALLING -* Require **dedicated domain** like **peertube.domain.tld**. -* Admin username is: **root**. -* **Admin password and LDAP configuration** will be sent to the email address given at the time of the installation. -* URL can not be changed once selected. Choose the domain wisely. -* You need more then **1 GB** of RAM. If you don't have it, please create a **swap memory**. - - $ dd if=/dev/zero of=/swapfile bs=1024 count=1048576 - $ mkswap /swapfile - $ swapon /swapfile - $ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab - -* This app is **multi-instance** (you can have more then one PeerTube instance running on a YunoHost server) -* **If you are hosted on OVH virtual machine or experiencing `gyp ERR! configure error`, please switch to [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)** -* HTTP auth is not supported -* Do not modify the `/var/www//conf/production.yaml` file, because it will be overridden in the next upgrade. Please instead either change them though the web interface or create a `/var/www//conf/local.yaml` file, assign it the same owner, group and rights than for `conf/production.yaml` and fill there your specific settings. - * Note: when the same option have different values in `production.yaml` and `local.yaml` files, only the value in `local.yaml` is taken into account. - -### PLUGINS -* LDAP auth is supported, LDAP configuration will be sent to the email address given at the time of the installation. -* PeerTube plugin livechat is installed with Prosody. To enable, just select «Prosody server controlled by Peertube» as chat mode in the plugin configutation of the PeerTube admin page -* During install, because of Prosody, Metronome is disabled ## Documentation and resources diff --git a/README_fr.md b/README_fr.md index bf206e7..5fef505 100644 --- a/README_fr.md +++ b/README_fr.md @@ -26,45 +26,6 @@ Plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorren ## Captures d’écran ![Capture d’écran de PeerTube](./doc/screenshots/screenshot1.jpg) -![Capture d’écran de PeerTube](./doc/screenshots/POST_INSTALL.md) - -## Avertissements / informations importantes - -### Pourquoi PeerTube? - -Nous ne pouvons pas créer d'alternatives de streaming vidéo FOSS à YouTube, Dailymotion, Vimeo... avec un logiciel centralisé. Une organisation seule ne peut pas avoir assez d'argent pour payer la bande passante et le stockage vidéo de son serveur. -Nous avons donc besoin d'un réseau décentralisé de serveurs « semant » des vidéos (comme [Hubzilla YunoHost](https://github.com/YunoHost-Apps/hubzilla_ynh), [Friendica YunoHost](https://github.com/YunoHost-Apps/friendica_ynh), [Mastodon YunoHost](https://github.com/YunoHost-Apps/mastodon_ynh)), [Diaspora](https://github.com/diaspora/diaspora) ([Diaspora YunoHost](https://github.com/YunoHost-Apps/diaspora_ynh)),[Funkwhale](https://funkwhale.audio) ([Funkwhale YunoHost](https://github.com/YunoHost-Apps/funkwhale_ynh)). -Mais ce n'est pas suffisant car une vidéo pourrait devenir célèbre et surcharger le serveur. C'est la raison pour laquelle nous devons utiliser un protocole P2P pour limiter la charge du serveur. Grâce à [WebTorrent](https://github.com/feross/webtorrent), nous pouvons faire du P2P (donc BitTorrent) dans le navigateur Web, dès aujourd'hui. - -### Pourquoi est-ce cool ? - -Les serveurs sont gérés indépendamment par différentes personnes et organisations. Ils peuvent appliquer des politiques de modération extrêmement différentes, afin que vous puissiez en trouver ou en créer une qui correspond parfaitement à vos goûts. - -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. - -### Points importants à lire avant l'installation -* Nécessite un **domaine dédié** comme **peertube.domain.tld**. -* Le nom d'utilisateur de l'administrateur est: **root**. -* **Le mot de passe administrateur et la configuration LDAP** seront envoyés à l'adresse email indiquée au moment de l'installation. -* L'URL ne peut pas être modifiée une fois sélectionnée. Choisissez judicieusement le domaine. -* Vous avez besoin de plus de **1 Go** de RAM. Si vous ne l'avez pas, veuillez créer une **mémoire swap**. - - $ dd if=/dev/zero of=/swapfile bs=1024 count=1048576 - $ mkswap /swapfile - $ swapon /swapfile - $ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab - -* Cette application est **multi-instance** (vous pouvez avoir plus d'une instance PeerTube en cours d'exécution sur un serveur YunoHost) -* **Si vous êtes hébergé sur une machine virtuelle OVH ou rencontrez `gyp ERR! configure error`, veuillez passer à [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)** -* L'authentification HTTP n'est pas supportée -* Ne modifiez pas le fichier `/var/www//conf/production.yaml`, car il sera remplacé à la prochaine mise à jour. À la place, veuillez modifier la configuration via l'interface web ou créer et remplir le fichier `/var/www//conf/local.yaml`, assignez-lui les mêmes propriétaire, groupe et droits que pour `conf/production.yaml` et y remplir vos options spécifiques. - * Note: si la même option contient différentes valeurs dans les fichiers `conf/production.yaml` et `conf/local.yaml`, seule la valeur dans `conf/local.yaml` sera prise en compte. - -#### PLUGINS - -* L'authentification LDAP est prise en charge, les instructions de configuration sont envoyées à l'adresse email indiquée au moment de l'installation -* Le plugin PeerTube livechat est installé ainsi que Prosody. pour l'activer, sélectionner «Prosody server controlled by Peertube» dans le paramétre chat mode du plugin dans la page d'administration de PeerTube. -* Pendant l'installation, à cause de Prosody, Metronome est désactivé. ## Documentations et ressources From 02fe511a21a00be6caa5dc031fba01b6fbd7782d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 22 Mar 2023 07:37:12 +0100 Subject: [PATCH 07/86] Update manifest.toml --- manifest.toml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/manifest.toml b/manifest.toml index e587fcf..17c5a1d 100644 --- a/manifest.toml +++ b/manifest.toml @@ -61,13 +61,13 @@ ram.runtime = "50M" api.show_tile = false api.protected = true - [resources.apt] - packages = "ffmpeg postgresql postgresql-contrib openssl g++ mailutils apt-transport-https" + [resources.apt] + packages = "ffmpeg postgresql postgresql-contrib openssl g++ mailutils apt-transport-https" - [[resources.apt.extras]] - repo = "deb https://dl.yarnpkg.com/debian/ stable main" - key = "https://dl.yarnpkg.com/debian/pubkey.gpg" - packages = "yarn" + # (this part is optional and corresponds to the legacy ynh_install_extra_app_dependencies helper) + extras.yarn.repo = "deb https://dl.yarnpkg.com/debian/ stable main" + extras.yarn.key = "https://dl.yarnpkg.com/debian/pubkey.gpg" + extras.yarn.packages = "yarn" [resources.database] type = "postgresql" From c10aa8bb077538e1b5c1a47232e2e9f74450f8b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 22 Mar 2023 07:37:26 +0100 Subject: [PATCH 08/86] Update manifest.toml --- manifest.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 17c5a1d..67c7ada 100644 --- a/manifest.toml +++ b/manifest.toml @@ -64,7 +64,6 @@ ram.runtime = "50M" [resources.apt] packages = "ffmpeg postgresql postgresql-contrib openssl g++ mailutils apt-transport-https" - # (this part is optional and corresponds to the legacy ynh_install_extra_app_dependencies helper) extras.yarn.repo = "deb https://dl.yarnpkg.com/debian/ stable main" extras.yarn.key = "https://dl.yarnpkg.com/debian/pubkey.gpg" extras.yarn.packages = "yarn" From a5140f22c8c83756c10089258e9a1335a9cd1459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 27 Mar 2023 23:08:37 +0200 Subject: [PATCH 09/86] fix --- conf/production.yaml | 2 +- scripts/install | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/production.yaml b/conf/production.yaml index 8bc588e..1ef6d43 100644 --- a/conf/production.yaml +++ b/conf/production.yaml @@ -47,7 +47,7 @@ database: hostname: 'localhost' port: 5432 ssl: false - suffix: '___APP__' + suffix: '' username: '__DB_USER__' password: '__DB_PWD__' pool: diff --git a/scripts/install b/scripts/install index c075705..c1fd499 100644 --- a/scripts/install +++ b/scripts/install @@ -30,7 +30,7 @@ ynh_app_setting_set --app=$app --key=secrets_peertube --value=$secrets_peertube #================================================= # INSTALL DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." +ynh_script_progression --message="Installing dependencies..." ynh_exec_warn_less ynh_install_apps --apps="$app_dependencies" From eaba13c121da450bf2022c7e83440d5265fd6f89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 27 Mar 2023 23:11:08 +0200 Subject: [PATCH 10/86] Fix --- conf/production.yaml | 2 +- scripts/install | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/conf/production.yaml b/conf/production.yaml index 1ef6d43..8306eae 100644 --- a/conf/production.yaml +++ b/conf/production.yaml @@ -47,7 +47,7 @@ database: hostname: 'localhost' port: 5432 ssl: false - suffix: '' + suffix: '__DB_NAME__' username: '__DB_USER__' password: '__DB_PWD__' pool: diff --git a/scripts/install b/scripts/install index c1fd499..7bd1c7c 100644 --- a/scripts/install +++ b/scripts/install @@ -16,6 +16,7 @@ source /usr/share/yunohost/helpers admin_mail=$(ynh_user_get_info --username=$admin --key="mail") admin_pass=$(ynh_string_random --length=24) secrets_peertube=$(ynh_string_random --length=24) +db_name=$(peertube_$app) # Define app's data directory #REMOVEME? data_dir="/home/yunohost.app/${app}/storage" From 4b10e39967cb5598842dbf46ac44fd4b609a58aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 27 Mar 2023 23:30:57 +0200 Subject: [PATCH 11/86] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 7bd1c7c..e486820 100644 --- a/scripts/install +++ b/scripts/install @@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers admin_mail=$(ynh_user_get_info --username=$admin --key="mail") admin_pass=$(ynh_string_random --length=24) secrets_peertube=$(ynh_string_random --length=24) -db_name=$(peertube_$app) +db_name="peertube_$app" # Define app's data directory #REMOVEME? data_dir="/home/yunohost.app/${app}/storage" From bfb7b8fb71d5276f5f2a9d66c91c60f789ce2e19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 19 Apr 2023 11:03:34 +0200 Subject: [PATCH 12/86] cleaning --- .github/workflows/updater.sh | 133 ---------------------------------- .github/workflows/updater.yml | 50 ------------- manifest.toml | 5 +- scripts/_common.sh | 2 - scripts/install | 2 - scripts/remove | 28 ------- scripts/restore | 32 -------- 7 files changed, 3 insertions(+), 249 deletions(-) delete mode 100644 .github/workflows/updater.sh delete mode 100644 .github/workflows/updater.yml diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh deleted file mode 100644 index 3df60ca..0000000 --- a/.github/workflows/updater.sh +++ /dev/null @@ -1,133 +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. - -# Remove this exit command when you are ready to run this Action -#exit 1 - -#================================================= -# 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 ) | .tag_name' | sort -V | tail -1) -assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'")) - -# 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 -# 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 - *".tar.xz") - src="app" - ;; - *) - 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.xz ]]; then - extension=tar.xz -else - extension=${filename##*.} -fi - -# Rewrite source file -cat < conf/$src.src -SOURCE_URL=$asset_url -SOURCE_SUM=$checksum -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=$extension -SOURCE_IN_SUBDIR=true -SOURCE_EXTRACT=true -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 08ec1b3..0000000 --- a/.github/workflows/updater.yml +++ /dev/null @@ -1,50 +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/manifest.toml b/manifest.toml index 67c7ada..bfdadc6 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ admindoc = "https://docs.joinpeertube.org" code = "https://github.com/Chocobozzz/PeerTube" [integration] -yunohost = ">= 11.1.15" +yunohost = ">= 11.1.17" architectures = "all" multi_instance = false ldap = false @@ -52,6 +52,7 @@ ram.runtime = "50M" [resources.install_dir] [resources.data_dir] + subdirs = "storage" [resources.permissions] main.url = "/" @@ -62,7 +63,7 @@ ram.runtime = "50M" api.protected = true [resources.apt] - packages = "ffmpeg postgresql postgresql-contrib openssl g++ mailutils apt-transport-https" + packages = "prosody ffmpeg postgresql postgresql-contrib openssl g++ mailutils apt-transport-https" extras.yarn.repo = "deb https://dl.yarnpkg.com/debian/ stable main" extras.yarn.key = "https://dl.yarnpkg.com/debian/pubkey.gpg" diff --git a/scripts/_common.sh b/scripts/_common.sh index c4376f3..b0060dd 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,8 +4,6 @@ # COMMON VARIABLES #================================================= -app_dependencies="prosody" - nodejs_version=16 #================================================= diff --git a/scripts/install b/scripts/install index e486820..a9476c7 100644 --- a/scripts/install +++ b/scripts/install @@ -33,8 +33,6 @@ ynh_app_setting_set --app=$app --key=secrets_peertube --value=$secrets_peertube #================================================= ynh_script_progression --message="Installing dependencies..." -ynh_exec_warn_less ynh_install_apps --apps="$app_dependencies" - ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= diff --git a/scripts/remove b/scripts/remove index 40bbb00..5c06b4d 100644 --- a/scripts/remove +++ b/scripts/remove @@ -36,44 +36,16 @@ ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." - # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# REMOVE THE REDIS DATABASE -#================================================= -ynh_script_progression --message="Removing the redis database..." - ynh_redis_remove_db "$redis_db" -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." - # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." - # Remove metapackage and its dependencies ynh_remove_nodejs -ynh_remove_apps - -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE VARIOUS FILES -#================================================= -ynh_script_progression --message="Removing various files..." # Remove the log files ynh_secure_remove --file="/var/log/$app" diff --git a/scripts/restore b/scripts/restore index 5505e83..b5bb8d7 100644 --- a/scripts/restore +++ b/scripts/restore @@ -36,15 +36,8 @@ chown -R $app:www-data "$data_dir" #================================================= ynh_script_progression --message="Reinstalling dependencies..." -ynh_exec_warn_less ynh_install_apps --apps="$app_dependencies" - ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -#================================================= -# RESTORE 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" #================================================= @@ -54,14 +47,6 @@ ynh_script_progression --message="Restoring the PostgreSQL database..." 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 #================================================= @@ -70,20 +55,10 @@ ynh_script_progression --message="Restoring the systemd configuration..." ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." - mkdir -p "/var/log/$app" chown -R $app:$app "/var/log/$app" ynh_restore_file --origin_path="/etc/logrotate.d/$app" -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - yunohost service add $app --description="$app daemon for Peertube" --log="/var/log/$app/$app.log" --needs_exposed_ports $port_rtmp #================================================= @@ -93,13 +68,6 @@ ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="HTTP server listening on localhost" -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." - ynh_systemd_action --service_name=nginx --action=reload #================================================= From 0796390fb44e0951447b37517a3620148bdf5b66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 2 Jun 2023 19:59:28 +0200 Subject: [PATCH 13/86] Update manifest.toml --- manifest.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index bfdadc6..71eb687 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ admindoc = "https://docs.joinpeertube.org" code = "https://github.com/Chocobozzz/PeerTube" [integration] -yunohost = ">= 11.1.17" +yunohost = ">= 11.1.19" architectures = "all" multi_instance = false ldap = false @@ -52,7 +52,7 @@ ram.runtime = "50M" [resources.install_dir] [resources.data_dir] - subdirs = "storage" + subdirs = ["storage"] [resources.permissions] main.url = "/" From 29a80dd808f6b2ce59358f53c0a36539e7febf89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 2 Jun 2023 20:01:27 +0200 Subject: [PATCH 14/86] fix --- manifest.toml | 1 + scripts/install | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index 71eb687..3a5d96e 100644 --- a/manifest.toml +++ b/manifest.toml @@ -42,6 +42,7 @@ ram.runtime = "50M" [resources.sources.main] url = "https://github.com/Chocobozzz/PeerTube/releases/download/v5.1.0/peertube-v5.1.0.tar.xz" sha256 = "5254562020e27a4d11364e4b6b348e0ce073d36b9a7a1c8d9e1e2d5248d77552" + autoupdate.strategy = "latest_github_tag" [resources.ports] rtmp.default = 1935 diff --git a/scripts/install b/scripts/install index a9476c7..a631e5e 100644 --- a/scripts/install +++ b/scripts/install @@ -18,9 +18,6 @@ admin_pass=$(ynh_string_random --length=24) secrets_peertube=$(ynh_string_random --length=24) db_name="peertube_$app" -# Define app's data directory -#REMOVEME? data_dir="/home/yunohost.app/${app}/storage" - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= From a1530aed78d9c84b4a65b22b696c2345ca8884b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 2 Jun 2023 20:02:49 +0200 Subject: [PATCH 15/86] Update manifest.toml --- manifest.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/manifest.toml b/manifest.toml index 3a5d96e..6f26c0b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -45,6 +45,7 @@ ram.runtime = "50M" autoupdate.strategy = "latest_github_tag" [resources.ports] + main.default = 8095 rtmp.default = 1935 rtmp.exposed = "TCP" From b8aaa6bdadec005a3eac231b72f6218c4e1662db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 12 Jun 2023 12:37:56 +0200 Subject: [PATCH 16/86] cleaning --- manifest.toml | 2 +- scripts/_common.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index 6f26c0b..aaa9f7f 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ admindoc = "https://docs.joinpeertube.org" code = "https://github.com/Chocobozzz/PeerTube" [integration] -yunohost = ">= 11.1.19" +yunohost = ">= 11.1.20" architectures = "all" multi_instance = false ldap = false diff --git a/scripts/_common.sh b/scripts/_common.sh index b0060dd..78f0843 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,7 @@ # COMMON VARIABLES #================================================= -nodejs_version=16 +nodejs_version=18 #================================================= # PERSONAL HELPERS From 05f1b9a09bad45b9bc7dfa2aa8831b3454aa42d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 21 Jun 2023 19:19:03 +0200 Subject: [PATCH 17/86] cleaning --- doc/ADMIN.md | 14 -------------- doc/ADMIN_fr.md | 12 ------------ manifest.toml | 8 ++++---- scripts/_common.sh | 2 -- 4 files changed, 4 insertions(+), 32 deletions(-) diff --git a/doc/ADMIN.md b/doc/ADMIN.md index 176fc49..3afed93 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -1,17 +1,3 @@ -### Why PeerTube? - -We can't build a FOSS video streaming alternatives to YouTube, Dailymotion, Vimeo... with a centralized software. One organization alone cannot have enough money to pay bandwidth and video storage of its server. - -So we need to have a decentralized network of servers seeding videos (as [Hubzilla YunoHost](https://github.com/YunoHost-Apps/hubzilla_ynh), [Friendica YunoHost](https://github.com/YunoHost-Apps/friendica_ynh),[Mastodon YunoHost](https://github.com/YunoHost-Apps/mastodon_ynh)), [Diaspora](https://github.com/diaspora/diaspora) ([Diaspora YunoHost](https://github.com/YunoHost-Apps/diaspora_ynh)),[Funkwhale](https://funkwhale.audio) ([Funkwhale YunoHost](https://github.com/YunoHost-Apps/funkwhale_ynh)). -But it's not enough because one video could become famous and overload the server. -It's the reason why we need to use a P2P protocol to limit the server load. -Thanks to [WebTorrent](https://github.com/feross/webtorrent), we can make P2P (thus BitTorrent) inside the web browser, as of today. - -### Why is that cool? -Servers are run independently by different people and organizations. They can apply wildly different moderation policies, so you can find or make one that fits your taste perfectly. - -By watching a video, you help the hosting provider to broadcast it by becoming a broadcaster of the video yourself. Each instance doesn't need much money to broadcast the videos of its users. - ### IMPORTANT POINT TO READ BEFORE INSTALLING * Require **dedicated domain** like **peertube.domain.tld**. * Admin username is: **root**. diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index c2ab40f..3bf129e 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -1,15 +1,3 @@ -### Pourquoi PeerTube? - -Nous ne pouvons pas créer d'alternatives de streaming vidéo FOSS à YouTube, Dailymotion, Vimeo... avec un logiciel centralisé. Une organisation seule ne peut pas avoir assez d'argent pour payer la bande passante et le stockage vidéo de son serveur. -Nous avons donc besoin d'un réseau décentralisé de serveurs « semant » des vidéos (comme [Hubzilla YunoHost](https://github.com/YunoHost-Apps/hubzilla_ynh), [Friendica YunoHost](https://github.com/YunoHost-Apps/friendica_ynh), [Mastodon YunoHost](https://github.com/YunoHost-Apps/mastodon_ynh)), [Diaspora](https://github.com/diaspora/diaspora) ([Diaspora YunoHost](https://github.com/YunoHost-Apps/diaspora_ynh)),[Funkwhale](https://funkwhale.audio) ([Funkwhale YunoHost](https://github.com/YunoHost-Apps/funkwhale_ynh)). -Mais ce n'est pas suffisant car une vidéo pourrait devenir célèbre et surcharger le serveur. C'est la raison pour laquelle nous devons utiliser un protocole P2P pour limiter la charge du serveur. Grâce à [WebTorrent](https://github.com/feross/webtorrent), nous pouvons faire du P2P (donc BitTorrent) dans le navigateur Web, dès aujourd'hui. - -### Pourquoi est-ce cool ? - -Les serveurs sont gérés indépendamment par différentes personnes et organisations. Ils peuvent appliquer des politiques de modération extrêmement différentes, afin que vous puissiez en trouver ou en créer une qui correspond parfaitement à vos goûts. - -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. - ### Points importants à lire avant l'installation * Nécessite un **domaine dédié** comme **peertube.domain.tld**. * Le nom d'utilisateur de l'administrateur est: **root**. diff --git a/manifest.toml b/manifest.toml index aaa9f7f..b4b2a83 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "PeerTube" description.en = "Federated video streaming platform using P2P directly in the web browser" description.fr = "Plateforme fédéralisé de diffusion vidéo par P2P directement dans le navigateur" -version = "5.1.0~ynh1" +version = "5.2.0~ynh1" maintainers = ["yalh76"] @@ -17,7 +17,7 @@ admindoc = "https://docs.joinpeertube.org" code = "https://github.com/Chocobozzz/PeerTube" [integration] -yunohost = ">= 11.1.20" +yunohost = ">= 11.1.21" architectures = "all" multi_instance = false ldap = false @@ -40,8 +40,8 @@ ram.runtime = "50M" [resources] [resources.sources.main] - url = "https://github.com/Chocobozzz/PeerTube/releases/download/v5.1.0/peertube-v5.1.0.tar.xz" - sha256 = "5254562020e27a4d11364e4b6b348e0ce073d36b9a7a1c8d9e1e2d5248d77552" + url = "https://github.com/Chocobozzz/PeerTube/releases/download/v5.2.0/peertube-v5.2.0.tar.xz" + sha256 = "42ed1f54cc2da810ceacc5c463c33c99d38d353ba6c055a2322be62d98131b88" autoupdate.strategy = "latest_github_tag" [resources.ports] diff --git a/scripts/_common.sh b/scripts/_common.sh index 78f0843..98880bb 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -14,8 +14,6 @@ nodejs_version=18 # EXPERIMENTAL HELPERS #================================================= -#!/bin/bash - # Install others YunoHost apps # # usage: ynh_install_apps --apps="appfoo?domain=domain.foo&path=/foo appbar?domain=domain.bar&path=/bar&admin=USER&language=fr&is_public=1&pass?word=pass&port=666" From 57eb7cb88f5de89ea5ab4ba43a36e125f5f51e8c Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 21 Jun 2023 17:19:10 +0000 Subject: [PATCH 18/86] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ce659c2..de80427 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser, using WebTorrent. -**Shipped version:** 5.1.0~ynh1 +**Shipped version:** 5.2.0~ynh1 **Demo:** http://peertube.cpy.re diff --git a/README_fr.md b/README_fr.md index 5fef505..14d600c 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorrent) directement dans le navigateur Web, en utilisant WebTorrent -**Version incluse :** 5.1.0~ynh1 +**Version incluse :** 5.2.0~ynh1 **Démo :** http://peertube.cpy.re From 412f3a1d4402b62da791e64bad9659a63cbe53d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 21 Jun 2023 19:21:58 +0200 Subject: [PATCH 19/86] cleaning --- conf/msg_remove | 2 +- scripts/install | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/conf/msg_remove b/conf/msg_remove index 5869587..25d23f0 100644 --- a/conf/msg_remove +++ b/conf/msg_remove @@ -2,7 +2,7 @@ __APP__ was successfully removed :) The domain https://__DOMAIN____PATH__ is free for other apps to be installed on it. -You should close the PeerTube Live TCP port __RTMP_PORT__ available from internet (For example, closing the port on your ISP box if it's not automatically done). +You should close the PeerTube Live TCP port __PORT_RTMP__ available from internet (For example, closing the port on your ISP box if it's not automatically done). But a futher action is required from your side to completely remove the __APP__ data folder. If you have backup and plan to restore this app in the future DON'T RUN THIS COMMAND. And if you are going to migrate to othe server you will have to move __DATA_DIR__ to your new server. diff --git a/scripts/install b/scripts/install index a631e5e..c91460d 100644 --- a/scripts/install +++ b/scripts/install @@ -16,7 +16,8 @@ source /usr/share/yunohost/helpers admin_mail=$(ynh_user_get_info --username=$admin --key="mail") admin_pass=$(ynh_string_random --length=24) secrets_peertube=$(ynh_string_random --length=24) -db_name="peertube_$app" +db_name="peertube_${app}" +db_user=$(ynh_sanitize_dbid --db_name=$app) #================================================= # STORE SETTINGS FROM MANIFEST From c4b08919d06c84d14b422ca8f49982104dfcb804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 21 Jun 2023 19:25:20 +0200 Subject: [PATCH 20/86] cleaning --- conf/msg_remove | 4 ++-- conf/nginx.conf | 4 ++-- conf/production.yaml | 28 ++++++++++++++-------------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/conf/msg_remove b/conf/msg_remove index 25d23f0..aa4db93 100644 --- a/conf/msg_remove +++ b/conf/msg_remove @@ -5,11 +5,11 @@ The domain https://__DOMAIN____PATH__ is free for other apps to be installed on You should close the PeerTube Live TCP port __PORT_RTMP__ available from internet (For example, closing the port on your ISP box if it's not automatically done). But a futher action is required from your side to completely remove the __APP__ data folder. If you have backup and plan to restore this app in the future DON'T RUN THIS COMMAND. -And if you are going to migrate to othe server you will have to move __DATA_DIR__ to your new server. +And if you are going to migrate to othe server you will have to move __DATA_DIR__storage/ to your new server. You need to run this command to remove the data (warning all your videos will be removed): -rm -R __DATA_DIR__ -f +rm -R __DATA_DIR__storage/ -f If you facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/peertube_ynh diff --git a/conf/nginx.conf b/conf/nginx.conf index d74a70d..4043fab 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -154,7 +154,7 @@ location ~ ^/static/(thumbnails|avatars)/ { rewrite ^/static/(.*)$ /$1 break; - root __DATA_DIR__; + root __DATA_DIR__storage/; try_files $uri @api; } @@ -216,7 +216,7 @@ location ~ ^/static/(webseed|redundancy|streaming-playlists)/ { rewrite ^/static/webseed/(.*)$ /videos/$1 break; rewrite ^/static/(.*)$ /$1 break; - root __DATA_DIR__; + root __DATA_DIR__storage/; try_files $uri @api; } diff --git a/conf/production.yaml b/conf/production.yaml index 8306eae..af883d6 100644 --- a/conf/production.yaml +++ b/conf/production.yaml @@ -113,20 +113,20 @@ defaults: # From the project root directory storage: - tmp: '__DATA_DIR__/tmp/' # Use to download data (imports etc), store uploaded files before processing... - bin: '__DATA_DIR__/bin/' - avatars: '__DATA_DIR__/avatars/' - videos: '__DATA_DIR__/videos/' - streaming_playlists: '__DATA_DIR__/streaming-playlists/' - redundancy: '__DATA_DIR__/redundancy/' + tmp: '__DATA_DIR__/storage/tmp/' # Use to download data (imports etc), store uploaded files before processing... + bin: '__DATA_DIR__/storage/bin/' + avatars: '__DATA_DIR__/storage/avatars/' + videos: '__DATA_DIR__/storage/videos/' + streaming_playlists: '__DATA_DIR__/storage/streaming-playlists/' + redundancy: '__DATA_DIR__/storage/redundancy/' logs: '/var/log/__APP__/' - previews: '__DATA_DIR__/previews/' - thumbnails: '__DATA_DIR__/thumbnails/' - torrents: '__DATA_DIR__/torrents/' - captions: '__DATA_DIR__/captions/' - cache: '__DATA_DIR__/cache/' - plugins: '__DATA_DIR__/plugins/' - well_known: '__DATA_DIR__/well-known/' + previews: '__DATA_DIR__/storage/previews/' + thumbnails: '__DATA_DIR__/storage/thumbnails/' + torrents: '__DATA_DIR__/storage/torrents/' + captions: '__DATA_DIR__/storage/captions/' + cache: '__DATA_DIR__/storage/cache/' + plugins: '__DATA_DIR__/storage/plugins/' + well_known: '__DATA_DIR__/storage/well-known/' # Overridable client files in client/dist/assets/images: # - logo.svg # - favicon.png @@ -137,7 +137,7 @@ storage: # Could contain for example assets/images/favicon.png # If the file exists, peertube will serve it # If not, peertube will fallback to the default file - client_overrides: '__DATA_DIR__/client-overrides/' + client_overrides: '__DATA_DIR__/storage/client-overrides/' static_files: # Require and check user authentication when accessing private files (internal/private video files) From 46a5b47a9945b99f7f0b3a2945fcb47ffccdd4b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 21 Jun 2023 19:26:59 +0200 Subject: [PATCH 21/86] fix --- manifest.toml | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index b4b2a83..cee3f43 100644 --- a/manifest.toml +++ b/manifest.toml @@ -20,7 +20,7 @@ code = "https://github.com/Chocobozzz/PeerTube" yunohost = ">= 11.1.21" architectures = "all" multi_instance = false -ldap = false +ldap = true sso = false disk = "50M" ram.build = "50M" diff --git a/scripts/upgrade b/scripts/upgrade index 45542fb..ebb61a4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -84,7 +84,7 @@ chown -R $app:www-data "$install_dir" #================================================= ynh_script_progression --message="Upgrading dependencies..." -ynh_exec_warn_less ynh_install_apps --apps="$app_dependencies" +#ynh_exec_warn_less ynh_install_apps --apps="$app_dependencies" ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= From 28a3f13c0d8bfc96ca227c4f10b543c3bb4c7cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 21 Jun 2023 19:27:37 +0200 Subject: [PATCH 22/86] cleaning --- scripts/install | 2 ++ scripts/upgrade | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index c91460d..84dd015 100644 --- a/scripts/install +++ b/scripts/install @@ -18,6 +18,8 @@ admin_pass=$(ynh_string_random --length=24) secrets_peertube=$(ynh_string_random --length=24) db_name="peertube_${app}" db_user=$(ynh_sanitize_dbid --db_name=$app) +ynh_app_setting_set --app=$app --key=db_name --value=$db_name +ynh_app_setting_set --app=$app --key=db_user --value=$db_user #================================================= # STORE SETTINGS FROM MANIFEST diff --git a/scripts/upgrade b/scripts/upgrade index ebb61a4..f6641aa 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -84,7 +84,6 @@ chown -R $app:www-data "$install_dir" #================================================= ynh_script_progression --message="Upgrading dependencies..." -#ynh_exec_warn_less ynh_install_apps --apps="$app_dependencies" ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= From 691672e8556e20abc4c3fa668955234464d880bb Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 21 Jun 2023 17:29:22 +0000 Subject: [PATCH 23/86] Auto-update README --- README.md | 25 ------------------------- README_fr.md | 24 ------------------------ 2 files changed, 49 deletions(-) diff --git a/README.md b/README.md index 5995153..de80427 100644 --- a/README.md +++ b/README.md @@ -27,31 +27,6 @@ Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly ![Screenshot of PeerTube](./doc/screenshots/screenshot1.jpg) -## Disclaimers / important information - -### IMPORTANT POINT TO READ BEFORE INSTALLING -* Require **dedicated domain** like **peertube.domain.tld**. -* Admin username is: **root**. -* **Admin password and LDAP configuration** will be sent to the email address given at the time of the installation. -* URL can not be changed once selected. Choose the domain wisely. -* You need more then **1 GB** of RAM. If you don't have it, please create a **swap memory**. - - $ dd if=/dev/zero of=/swapfile bs=1024 count=1048576 - $ mkswap /swapfile - $ swapon /swapfile - $ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab - -* This app is **multi-instance** (you can have more then one PeerTube instance running on a YunoHost server) -* **If you are hosted on OVH virtual machine or experiencing `gyp ERR! configure error`, please switch to [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)** -* HTTP auth is not supported -* Do not modify the `/var/www//conf/production.yaml` file, because it will be overridden in the next upgrade. Please instead either change them though the web interface or create a `/var/www//conf/local.yaml` file, assign it the same owner, group and rights than for `conf/production.yaml` and fill there your specific settings. - * Note: when the same option have different values in `production.yaml` and `local.yaml` files, only the value in `local.yaml` is taken into account. - -### PLUGINS -* LDAP auth is supported, LDAP configuration will be sent to the email address given at the time of the installation. -* PeerTube plugin livechat is installed with Prosody. To enable, just select «Prosody server controlled by Peertube» as chat mode in the plugin configutation of the PeerTube admin page -* During install, because of Prosody, Metronome is disabled - ## Documentation and resources * Official app website: diff --git a/README_fr.md b/README_fr.md index b76b4e2..14d600c 100644 --- a/README_fr.md +++ b/README_fr.md @@ -27,30 +27,6 @@ Plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorren ![Capture d’écran de PeerTube](./doc/screenshots/screenshot1.jpg) -## Avertissements / informations importantes - -### Points importants à lire avant l'installation -* Le nom d'utilisateur de l'administrateur est: **root**. -* **Le mot de passe administrateur et la configuration LDAP** seront envoyés à l'adresse email indiquée au moment de l'installation. -* L'URL ne peut pas être modifiée une fois sélectionnée. Choisissez judicieusement le domaine. -* Vous avez besoin de plus de **1 Go** de RAM. Si vous ne l'avez pas, veuillez créer une **mémoire swap**. - - $ dd if=/dev/zero of=/swapfile bs=1024 count=1048576 - $ mkswap /swapfile - $ swapon /swapfile - $ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab - -* **Si vous êtes hébergé sur une machine virtuelle OVH ou rencontrez `gyp ERR! configure error`, veuillez passer à [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)** -* L'authentification HTTP n'est pas supportée -* Ne modifiez pas le fichier `/var/www//conf/production.yaml`, car il sera remplacé à la prochaine mise à jour. À la place, veuillez modifier la configuration via l'interface web ou créer et remplir le fichier `/var/www//conf/local.yaml`, assignez-lui les mêmes propriétaire, groupe et droits que pour `conf/production.yaml` et y remplir vos options spécifiques. - * Note: si la même option contient différentes valeurs dans les fichiers `conf/production.yaml` et `conf/local.yaml`, seule la valeur dans `conf/local.yaml` sera prise en compte. - -#### PLUGINS - -* L'authentification LDAP est prise en charge, les instructions de configuration sont envoyées à l'adresse email indiquée au moment de l'installation -* Le plugin PeerTube livechat est installé ainsi que Prosody. pour l'activer, sélectionner «Prosody server controlled by Peertube» dans le paramétre chat mode du plugin dans la page d'administration de PeerTube. -* Pendant l'installation, à cause de Prosody, Metronome est désactivé. - ## Documentations et ressources * Site officiel de l’app : From 51d2569b1181ecc4220488a2c867353e9abc1b81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 13 Sep 2023 15:19:28 +0200 Subject: [PATCH 24/86] fix --- conf/systemd.service | 4 ++-- manifest.toml | 5 ++--- scripts/_common.sh | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index ae0bb93..7e87245 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -4,11 +4,11 @@ After=network.target postgresql.service redis-server.service [Service] Type=simple +User=__APP__ +Group=__APP__ Environment=NODE_ENV=production Environment=NODE_CONFIG_DIR=__INSTALL_DIR__/config Environment="__YNH_NODE_LOAD_PATH__" -User=__APP__ -Group=__APP__ ExecStart=__YNH_NODE__ __INSTALL_DIR__/dist/server WorkingDirectory=__INSTALL_DIR__/ StandardOutput=syslog diff --git a/manifest.toml b/manifest.toml index cee3f43..a0cb003 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ admindoc = "https://docs.joinpeertube.org" code = "https://github.com/Chocobozzz/PeerTube" [integration] -yunohost = ">= 11.1.21" +yunohost = ">= 11.2" architectures = "all" multi_instance = false ldap = true @@ -29,7 +29,6 @@ ram.runtime = "50M" [install] [install.domain] type = "domain" - full_domain = true [install.init_main_permission] type = "group" @@ -65,7 +64,7 @@ ram.runtime = "50M" api.protected = true [resources.apt] - packages = "prosody ffmpeg postgresql postgresql-contrib openssl g++ mailutils apt-transport-https" + packages = "prosody, ffmpeg, postgresql, postgresql-contrib, openssl, g++, mailutils, apt-transport-https" extras.yarn.repo = "deb https://dl.yarnpkg.com/debian/ stable main" extras.yarn.key = "https://dl.yarnpkg.com/debian/pubkey.gpg" diff --git a/scripts/_common.sh b/scripts/_common.sh index 98880bb..f284ef7 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,7 @@ # COMMON VARIABLES #================================================= -nodejs_version=18 +nodejs_version=20 #================================================= # PERSONAL HELPERS From 9e8906096ccaa0abb58014a4c5e843f291b3a7c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 13 Sep 2023 15:41:16 +0200 Subject: [PATCH 25/86] fix --- manifest.toml | 6 +++--- scripts/install | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manifest.toml b/manifest.toml index a0cb003..f778b27 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "PeerTube" description.en = "Federated video streaming platform using P2P directly in the web browser" description.fr = "Plateforme fédéralisé de diffusion vidéo par P2P directement dans le navigateur" -version = "5.2.0~ynh1" +version = "5.2.1~ynh1" maintainers = ["yalh76"] @@ -39,8 +39,8 @@ ram.runtime = "50M" [resources] [resources.sources.main] - url = "https://github.com/Chocobozzz/PeerTube/releases/download/v5.2.0/peertube-v5.2.0.tar.xz" - sha256 = "42ed1f54cc2da810ceacc5c463c33c99d38d353ba6c055a2322be62d98131b88" + url = "https://github.com/Chocobozzz/PeerTube/releases/download/v5.2.1/peertube-v5.2.1.tar.xz" + sha256 = "27d577ab63d29be865934088d1831373a71433c78443a4441fb3ac416995817c" autoupdate.strategy = "latest_github_tag" [resources.ports] diff --git a/scripts/install b/scripts/install index 84dd015..53d670b 100644 --- a/scripts/install +++ b/scripts/install @@ -17,7 +17,7 @@ admin_mail=$(ynh_user_get_info --username=$admin --key="mail") admin_pass=$(ynh_string_random --length=24) secrets_peertube=$(ynh_string_random --length=24) db_name="peertube_${app}" -db_user=$(ynh_sanitize_dbid --db_name=$app) +db_user=$(ynh_sanitize_dbid --db_name=peertube_${app}) ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_app_setting_set --app=$app --key=db_user --value=$db_user From faef559b72f66428afcacf6660d60d1d75fb50f7 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 13 Sep 2023 13:41:21 +0000 Subject: [PATCH 26/86] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index de80427..445b3fc 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser, using WebTorrent. -**Shipped version:** 5.2.0~ynh1 +**Shipped version:** 5.2.1~ynh1 **Demo:** http://peertube.cpy.re diff --git a/README_fr.md b/README_fr.md index 14d600c..cb60b74 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorrent) directement dans le navigateur Web, en utilisant WebTorrent -**Version incluse :** 5.2.0~ynh1 +**Version incluse :** 5.2.1~ynh1 **Démo :** http://peertube.cpy.re From c2bd7de4f7744865578851a8d6f9ebdd874d9c66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 13 Sep 2023 18:43:40 +0200 Subject: [PATCH 27/86] cleaning --- scripts/install | 72 +++++++++---------------------------------------- scripts/remove | 5 ---- scripts/restore | 19 +++++-------- scripts/upgrade | 70 +++++++++-------------------------------------- 4 files changed, 32 insertions(+), 134 deletions(-) diff --git a/scripts/install b/scripts/install index 8822a73..953f7eb 100644 --- a/scripts/install +++ b/scripts/install @@ -69,6 +69,17 @@ ynh_script_progression --message="Configuring NGINX web server..." # Create a dedicated NGINX config ynh_add_nginx_config +# Create a dedicated systemd config +ynh_add_systemd_config + +mkdir -p "/var/log/$app" +chown -R $app:$app "/var/log/$app" + +# Use logrotate to manage application logfile(s) +ynh_use_logrotate + +yunohost service add $app --description="$app daemon for Peertube" --log="/var/log/$app/$app.log" --needs_exposed_ports $port_rtmp + #================================================= # BUILD YARN DEPENDENCIES #================================================= @@ -95,76 +106,17 @@ ynh_add_config --template="../conf/local-production.json" --destination="$instal chmod 600 "$install_dir/config/local-production.json" chown $app:$app "$install_dir/config/local-production.json" -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." - -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." - -mkdir -p "/var/log/$app" -chown -R $app:$app "/var/log/$app" -# Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started" - #================================================= # INSTALL LDAP PLUGIN #================================================= -ynh_script_progression --message="Installing LDAP plugin..." +ynh_script_progression --message="Installing $app plugin and password..." pushd "$install_dir" ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap -popd - -#================================================= -# INSTALL PEERTUBE LIVECHAT PLUGIN -#================================================= -ynh_script_progression --message="Installing PeerTube livechat plugin..." - -pushd "$install_dir" ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-livechat -popd - -#================================================= -# CHANGE PEERTUBE ADMIN PASSWORD -#================================================= -ynh_script_progression --message="Changing PeerTube admin password..." - -pushd "$install_dir" echo $admin_pass | ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run reset-password -- -u root popd -#================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." - -# Stop a systemd service -ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped" - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." - -# Use logrotate to manage application logfile(s) -ynh_use_logrotate - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - -yunohost service add $app --description="$app daemon for Peertube" --log="/var/log/$app/$app.log" --needs_exposed_ports $port_rtmp - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/remove b/scripts/remove index 5c06b4d..5ddde0f 100644 --- a/scripts/remove +++ b/scripts/remove @@ -28,11 +28,6 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." - # Remove the dedicated systemd config ynh_remove_systemd_config diff --git a/scripts/restore b/scripts/restore index cecdfc9..ee86baa 100644 --- a/scripts/restore +++ b/scripts/restore @@ -29,6 +29,13 @@ ynh_restore_file --origin_path="$data_dir" --not_mandatory chown -R $app:www-data "$data_dir" +#================================================= +# RESTORE THE POSTGRESQL DATABASE +#================================================= +ynh_script_progression --message="Restoring the PostgreSQL database..." + +ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql + #================================================= # SPECIFIC RESTORATION #================================================= @@ -40,18 +47,6 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE THE POSTGRESQL DATABASE -#================================================= -ynh_script_progression --message="Restoring the PostgreSQL database..." - -ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name - -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." - ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet diff --git a/scripts/upgrade b/scripts/upgrade index 7cae765..ca1757c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -89,14 +89,20 @@ ynh_script_progression --message="Upgrading dependencies..." ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config +# Create a dedicated systemd config +ynh_add_systemd_config + +mkdir -p "/var/log/$app" +chown -R $app:$app "/var/log/$app" + +# Use logrotate to manage app-specific logfile(s) +ynh_use_logrotate --non-append + +yunohost service add $app --description="$app daemon for Peertube" --log="/var/log/$app/$app.log" --needs_exposed_ports $port_rtmp + #================================================= # Generate secrets if they don't exist #================================================= @@ -133,40 +139,15 @@ ynh_backup_if_checksum_is_different --file="$install_dir/config/local-production chmod 600 "$install_dir/config/local-production.json" chown $app:$app "$install_dir/config/local-production.json" -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." - -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." - -mkdir -p "/var/log/$app" -chown -R $app:$app "/var/log/$app" -# Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started" - #================================================= # INSTALL LDAP PLUGIN #================================================= -ynh_script_progression --message="Installing LDAP plugin..." +ynh_script_progression --message="Installing $app plugin..." pushd "$install_dir" ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap -popd - -#================================================= -# INSTALL PEERTUBE LIVECHAT PLUGIN -#================================================= -ynh_script_progression --message="Installing PeerTube livechat plugin..." - -pushd "$install_dir" ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-livechat + popd #================================================= @@ -187,31 +168,6 @@ if ynh_compare_current_package_version --comparison lt --version 4.2.0~ynh1; the popd fi -#================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." - -# Stop a systemd service -ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped" - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." - -# 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..." - -yunohost service add $app --description="$app daemon for Peertube" --log="/var/log/$app/$app.log" --needs_exposed_ports $port_rtmp - #================================================= # START SYSTEMD SERVICE #================================================= From 4791ab7caae7c4b37c16eaa72ff71bbe6f18cc3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 30 Sep 2023 19:43:12 +0200 Subject: [PATCH 28/86] Update install --- scripts/install | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/install b/scripts/install index 953f7eb..24d88e0 100644 --- a/scripts/install +++ b/scripts/install @@ -16,10 +16,6 @@ source /usr/share/yunohost/helpers admin_mail=$(ynh_user_get_info --username=$admin --key="mail") admin_pass=$(ynh_string_random --length=24) secrets_peertube=$(ynh_string_random --length=24) -db_name="peertube_${app}" -db_user=$(ynh_sanitize_dbid --db_name=peertube_${app}) -ynh_app_setting_set --app=$app --key=db_name --value=$db_name -ynh_app_setting_set --app=$app --key=db_user --value=$db_user #================================================= # STORE SETTINGS FROM MANIFEST From 2fe667f3643fc6ac041f8f4039881b01485c59b3 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 30 Sep 2023 17:43:18 +0000 Subject: [PATCH 29/86] Auto-update README --- README.md | 1 - README_fr.md | 1 - 2 files changed, 2 deletions(-) diff --git a/README.md b/README.md index 445b3fc..2b36657 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,6 @@ Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly * Official app website: * Official admin documentation: * Upstream app code repository: -* YunoHost documentation for this app: * Report a bug: ## Developer info diff --git a/README_fr.md b/README_fr.md index cb60b74..9fe0742 100644 --- a/README_fr.md +++ b/README_fr.md @@ -32,7 +32,6 @@ Plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorren * Site officiel de l’app : * Documentation officielle de l’admin : * Dépôt de code officiel de l’app : -* Documentation YunoHost pour cette app : * Signaler un bug : ## Informations pour les développeurs From 390a4566edc8446160d360c91f7d0185bfdcf2a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 17 Oct 2023 19:47:05 +0200 Subject: [PATCH 30/86] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 06001dc..185b151 100644 --- a/manifest.json +++ b/manifest.json @@ -20,7 +20,7 @@ "name": "yalh76" }, "requirements": { - "yunohost": ">= 11.0.0" + "yunohost": ">= 11.2" }, "multi_instance": false, "services": [ From d42c24265daa85614874342f22c481b4a172760b Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 17 Oct 2023 17:47:10 +0000 Subject: [PATCH 31/86] Auto-update README --- README.md | 1 - README_fr.md | 1 - 2 files changed, 2 deletions(-) diff --git a/README.md b/README.md index 7336e79..d529df1 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,6 @@ Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly * Official app website: * Official admin documentation: * Upstream app code repository: -* YunoHost documentation for this app: * Report a bug: ## Developer info diff --git a/README_fr.md b/README_fr.md index 1b8cd27..ab651d4 100644 --- a/README_fr.md +++ b/README_fr.md @@ -58,7 +58,6 @@ Plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorren * Site officiel de l’app : * Documentation officielle de l’admin : * Dépôt de code officiel de l’app : -* Documentation YunoHost pour cette app : * Signaler un bug : ## Informations pour les développeurs From 77fbff18e7e711a11bb7e3f79896d90a54e2e37f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 17 Oct 2023 19:49:10 +0200 Subject: [PATCH 32/86] Update install --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 3896502..84b118e 100644 --- a/scripts/install +++ b/scripts/install @@ -163,6 +163,7 @@ ynh_script_progression --message="Building Yarn dependencies..." pushd "$final_path" ynh_use_nodejs + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install -g npm ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean popd From 004eb0bd81f5c3ab1fa2c7ae2f945bbc7cbec9c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 17 Oct 2023 19:55:08 +0200 Subject: [PATCH 33/86] Update _common.sh --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 6ee012b..8201090 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++ mailutils apt-transport-https" -nodejs_version=16 +nodejs_version=18 #================================================= # PERSONAL HELPERS From 697ca9f21da63629e6f6e13ce868643cf0ca3535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 17 Oct 2023 20:01:05 +0200 Subject: [PATCH 34/86] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 84b118e..e53392d 100644 --- a/scripts/install +++ b/scripts/install @@ -163,7 +163,7 @@ ynh_script_progression --message="Building Yarn dependencies..." pushd "$final_path" ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install -g npm + npm install -g npm ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean popd From 5da4b32fa11dfed9eb92c350374090338ee9d252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 17 Oct 2023 20:06:51 +0200 Subject: [PATCH 35/86] fix --- scripts/_common.sh | 2 +- scripts/install | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 004748c..7ebd491 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,7 @@ # COMMON VARIABLES #================================================= -nodejs_version=20 +nodejs_version=18 #================================================= # PERSONAL HELPERS diff --git a/scripts/install b/scripts/install index 24d88e0..6776c9b 100644 --- a/scripts/install +++ b/scripts/install @@ -83,6 +83,7 @@ ynh_script_progression --message="Building Yarn dependencies..." pushd "$install_dir" ynh_use_nodejs + npm install -g npm ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean popd From 3c695a25daa7d6c0f650b8b1bcc9b5135d3ef805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 17 Oct 2023 20:08:13 +0200 Subject: [PATCH 36/86] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 185b151..de366a8 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Federated video streaming platform using P2P directly in the web browser", "fr": "Plateforme fédéralisé de diffusion vidéo par P2P directement dans le navigateur" }, - "version": "5.2.1~ynh1", + "version": "5.2.1~ynh2", "url": "https://github.com/Chocobozzz/PeerTube", "upstream": { "license": "AGPL-3.0-only", From 06b2d51040f4ca38424f05f26b52a317a2c7c359 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 17 Oct 2023 18:08:18 +0000 Subject: [PATCH 37/86] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d529df1..e2a7af7 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser, using WebTorrent. -**Shipped version:** 5.2.1~ynh1 +**Shipped version:** 5.2.1~ynh2 **Demo:** http://peertube.cpy.re diff --git a/README_fr.md b/README_fr.md index ab651d4..39d28d0 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorrent) directement dans le navigateur Web, en utilisant WebTorrent -**Version incluse :** 5.2.1~ynh1 +**Version incluse :** 5.2.1~ynh2 **Démo :** http://peertube.cpy.re From 6c5ccc2f36c536e5b6f35a7624672257c3db9cfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 18 Oct 2023 10:10:38 +0200 Subject: [PATCH 38/86] Update nginx.conf --- conf/nginx.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 56f8fc1..3196f93 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -96,7 +96,7 @@ location ~ ^/plugins/[^/]+(/[^/]+)?/ws/ { # For extra performance please refer to https://github.com/denji/nginx-tuning ## -root __DATA_DIR__; +root __DATA_DIR__storage/; # Enable compression for JS/CSS/HTML, for improved client load times. # It might be nice to compress JSON/XML as returned by the API, but # leaving that out to protect against potential BREACH attack. @@ -134,7 +134,7 @@ tcp_nodelay on; # don't buffer data sent, good for small data burs location ~ ^/client/(assets/images/(icons/icon-36x36\.png|icons/icon-48x48\.png|icons/icon-72x72\.png|icons/icon-96x96\.png|icons/icon-144x144\.png|icons/icon-192x192\.png|icons/icon-512x512\.png|logo\.svg|favicon\.png|default-playlist\.jpg|default-avatar-account\.png|default-avatar-account-48x48\.png|default-avatar-video-channel\.png|default-avatar-video-channel-48x48\.png))$ { more_set_headers "Cache-Control : public, max-age=31536000, immutable"; # Cache 1 year - try_files __DATA_DIR__/client-overrides/$1 __INSTALL_DIR__/client/dist/$1 @api; + try_files __DATA_DIR__storage/client-overrides/$1 __INSTALL_DIR__/client/dist/$1 @api; } # Bypass PeerTube for performance reasons. Optional. From 76d336124f5b5addf36347b7364b16f884aabf7b Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 10 Nov 2023 16:50:36 +0000 Subject: [PATCH 39/86] Auto-update README --- README.md | 1 + README_fr.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index e2a7af7..7bbf65d 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly * Official app website: * Official admin documentation: * Upstream app code repository: +* YunoHost Store: * Report a bug: ## Developer info diff --git a/README_fr.md b/README_fr.md index 39d28d0..fd71a89 100644 --- a/README_fr.md +++ b/README_fr.md @@ -58,6 +58,7 @@ Plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorren * Site officiel de l’app : * Documentation officielle de l’admin : * Dépôt de code officiel de l’app : +* YunoHost Store: * Signaler un bug : ## Informations pour les développeurs From 93d3e7fc15644aa87bf60d86a74fe872e4e659b5 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 25 Nov 2023 07:32:24 +0000 Subject: [PATCH 40/86] Auto-update README --- README.md | 3 ++- README_fr.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7df0765..6c5b671 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser, using WebTorrent. -**Shipped version:** 5.2.1~ynh2 +**Shipped version:** 5.2.1~ynh1 **Demo:** http://peertube.cpy.re @@ -32,6 +32,7 @@ Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly * Official app website: * Official admin documentation: * Upstream app code repository: +* YunoHost Store: * Report a bug: ## Developer info diff --git a/README_fr.md b/README_fr.md index 0d56157..b489739 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorrent) directement dans le navigateur Web, en utilisant WebTorrent -**Version incluse :** 5.2.1~ynh2 +**Version incluse :** 5.2.1~ynh1 **Démo :** http://peertube.cpy.re @@ -32,6 +32,7 @@ Plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorren * Site officiel de l’app : * Documentation officielle de l’admin : * Dépôt de code officiel de l’app : +* YunoHost Store: * Signaler un bug : ## Informations pour les développeurs From 6db299c1ce4c24fcb83c5bebda6b409e369a15b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 30 Nov 2023 09:28:08 +0100 Subject: [PATCH 41/86] Update _common.sh --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 8201090..6ee012b 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++ mailutils apt-transport-https" -nodejs_version=18 +nodejs_version=16 #================================================= # PERSONAL HELPERS From 6d26ff70a524863e2771228c2550c32276954743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 30 Nov 2023 09:29:29 +0100 Subject: [PATCH 42/86] cleaning --- manifest.toml | 9 ++++++--- scripts/_common.sh | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/manifest.toml b/manifest.toml index f778b27..ba27719 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "PeerTube" description.en = "Federated video streaming platform using P2P directly in the web browser" description.fr = "Plateforme fédéralisé de diffusion vidéo par P2P directement dans le navigateur" -version = "5.2.1~ynh1" +version = "6.0.1~ynh1" maintainers = ["yalh76"] @@ -20,8 +20,11 @@ code = "https://github.com/Chocobozzz/PeerTube" yunohost = ">= 11.2" architectures = "all" multi_instance = false + ldap = true + sso = false + disk = "50M" ram.build = "50M" ram.runtime = "50M" @@ -39,8 +42,8 @@ ram.runtime = "50M" [resources] [resources.sources.main] - url = "https://github.com/Chocobozzz/PeerTube/releases/download/v5.2.1/peertube-v5.2.1.tar.xz" - sha256 = "27d577ab63d29be865934088d1831373a71433c78443a4441fb3ac416995817c" + url = "https://github.com/Chocobozzz/PeerTube/releases/download/v6.0.1/peertube-v6.0.1.tar.xz" + sha256 = "d643b4c8ae8008a22bffb3d2b2981b0da11ad37e613140ccad7844bfad42a957" autoupdate.strategy = "latest_github_tag" [resources.ports] diff --git a/scripts/_common.sh b/scripts/_common.sh index 7ebd491..fe7db8f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,7 @@ # COMMON VARIABLES #================================================= -nodejs_version=18 +nodejs_version=16 #================================================= # PERSONAL HELPERS From ebe17e5488c092431954bb94e2e8f9f2d4b80fdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 30 Nov 2023 09:36:02 +0100 Subject: [PATCH 43/86] Update _common.sh --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index fe7db8f..004748c 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,7 @@ # COMMON VARIABLES #================================================= -nodejs_version=16 +nodejs_version=20 #================================================= # PERSONAL HELPERS From 66e6355adf222e1ecd5a7dee09eb23260d0eeb99 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 30 Nov 2023 08:36:07 +0000 Subject: [PATCH 44/86] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6c5b671..5129175 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser, using WebTorrent. -**Shipped version:** 5.2.1~ynh1 +**Shipped version:** 6.0.1~ynh1 **Demo:** http://peertube.cpy.re diff --git a/README_fr.md b/README_fr.md index b489739..775a637 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorrent) directement dans le navigateur Web, en utilisant WebTorrent -**Version incluse :** 5.2.1~ynh1 +**Version incluse :** 6.0.1~ynh1 **Démo :** http://peertube.cpy.re From 5a383984c45e30b57cb955851bba266fafbb64b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 30 Nov 2023 09:42:51 +0100 Subject: [PATCH 45/86] Update _common.sh --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 6ee012b..1df2bf8 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++ mailutils apt-transport-https" -nodejs_version=16 +nodejs_version=20 #================================================= # PERSONAL HELPERS From b441d0f6bcbe032f5d3467f5d2ac89b5167c25be Mon Sep 17 00:00:00 2001 From: lapineige Date: Tue, 26 Dec 2023 11:13:54 +0100 Subject: [PATCH 46/86] Raise timeout duration for Yarn https://forum.yunohost.org/t/can-not-install-peertube/27740/7 --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 3896502..5f90f2f 100644 --- a/scripts/install +++ b/scripts/install @@ -163,6 +163,7 @@ ynh_script_progression --message="Building Yarn dependencies..." pushd "$final_path" ynh_use_nodejs + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn config set network-timeout 300000 ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean popd From 132f4afd7805893c5e0fd4d481b2089a6cb05ff1 Mon Sep 17 00:00:00 2001 From: lapineige Date: Tue, 26 Dec 2023 15:15:10 +0100 Subject: [PATCH 47/86] fix spacing --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index c81ccb3..6cf9a01 100644 --- a/scripts/install +++ b/scripts/install @@ -164,7 +164,7 @@ ynh_script_progression --message="Building Yarn dependencies..." pushd "$final_path" ynh_use_nodejs npm install -g npm - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn config set network-timeout 300000 + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn config set network-timeout 300000 ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean popd From 6aeed38df541d8f638ecc9089f8195ff1d71162b Mon Sep 17 00:00:00 2001 From: lapineige Date: Wed, 27 Dec 2023 15:02:28 +0100 Subject: [PATCH 48/86] =?UTF-8?q?trying=20something=20with=20NODE=5FENV/CO?= =?UTF-8?q?NFIG=C2=A0DIR=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 6cf9a01..e303d66 100644 --- a/scripts/install +++ b/scripts/install @@ -164,9 +164,9 @@ ynh_script_progression --message="Building Yarn dependencies..." pushd "$final_path" ynh_use_nodejs npm install -g npm - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn config set network-timeout 300000 - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production yarn config set network-timeout 300000 + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production yarn install --production --pure-lockfile + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production yarn cache clean popd #================================================= From c4fa371bfcb875d4e7615ad98468bf955dbfe23a Mon Sep 17 00:00:00 2001 From: lapineige Date: Wed, 27 Dec 2023 15:04:41 +0100 Subject: [PATCH 49/86] revert commit on wrong branch --- scripts/install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index e303d66..6cf9a01 100644 --- a/scripts/install +++ b/scripts/install @@ -164,9 +164,9 @@ ynh_script_progression --message="Building Yarn dependencies..." pushd "$final_path" ynh_use_nodejs npm install -g npm - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production yarn config set network-timeout 300000 - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production yarn install --production --pure-lockfile - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production yarn cache clean + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn config set network-timeout 300000 + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean popd #================================================= From 5311d616b55fd6c24ffb31c1f22a8f733bdf9b7c Mon Sep 17 00:00:00 2001 From: lapineige Date: Wed, 27 Dec 2023 15:40:05 +0100 Subject: [PATCH 50/86] Wait for the service to be fully started (db init) --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 6cf9a01..b19147b 100644 --- a/scripts/install +++ b/scripts/install @@ -200,7 +200,7 @@ ynh_script_progression --message="Starting a systemd service..." mkdir -p "/var/log/$app" chown -R $app:$app "/var/log/$app" # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on localhost" #================================================= # INSTALL LDAP PLUGIN From d3a4f2bd62ef894a46cb92c0f4daac079823d51e Mon Sep 17 00:00:00 2001 From: lapineige Date: Wed, 27 Dec 2023 15:40:25 +0100 Subject: [PATCH 51/86] Wait for the service to be fully started (db init) --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index 775df02..f92c1c2 100644 --- a/scripts/restore +++ b/scripts/restore @@ -144,7 +144,7 @@ yunohost service add $app --description="$app daemon for Peertube" --log="/var/l #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on localhost" #================================================= # GENERIC FINALIZATION From 4fb28b6a6f1bc90bf16993fee606117c74210f7d Mon Sep 17 00:00:00 2001 From: lapineige Date: Wed, 27 Dec 2023 15:41:12 +0100 Subject: [PATCH 52/86] Wait for the service to be fully started (db init) Only on first service start (should be done during the second one) --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 86deeeb..97665ff 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -260,7 +260,7 @@ ynh_script_progression --message="Starting a systemd service..." mkdir -p "/var/log/$app" chown -R $app:$app "/var/log/$app" # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on localhost" #================================================= # INSTALL LDAP PLUGIN From 6d2f1f89195fa099db622a3388666645c8f25782 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 27 Dec 2023 15:50:10 +0100 Subject: [PATCH 53/86] Remove the ynh_install_apps / remove_apps helpers which are only for legacy removal of legacy prosody integration ... --- scripts/_common.sh | 112 --------------------------------------------- scripts/upgrade | 3 -- 2 files changed, 115 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 004748c..b5f6b3a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -14,118 +14,6 @@ nodejs_version=20 # EXPERIMENTAL HELPERS #================================================= -# Install others YunoHost apps -# -# usage: ynh_install_apps --apps="appfoo?domain=domain.foo&path=/foo appbar?domain=domain.bar&path=/bar&admin=USER&language=fr&is_public=1&pass?word=pass&port=666" -# | arg: -a, --apps= - apps to install -# -# Requires YunoHost version *.*.* or higher. -ynh_install_apps() { - # Declare an array to define the options of this helper. - local legacy_args=a - local -A args_array=([a]=apps=) - local apps - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - - # Split the list of apps in an array - local apps_list=($(echo $apps | tr " " "\n")) - local apps_dependencies="" - - # For each app - for one_app_and_its_args in "${apps_list[@]}" - do - # Retrieve the name of the app (part before ?) - local one_app=$(cut -d "?" -f1 <<< "$one_app_and_its_args") - [ -z "$one_app" ] && ynh_die --message="You didn't provided a YunoHost app to install" - - yunohost tools update apps - - # Installing or upgrading the app depending if it's installed or not - if ! yunohost app list --output-as json --quiet | jq -e --arg id $one_app '.apps[] | select(.id == $id)' >/dev/null - then - # Retrieve the arguments of the app (part after ?) - local one_argument=$(cut -d "?" -f2- <<< "$one_app_and_its_args") - [ ! -z "$one_argument" ] && one_argument="--args $one_argument" - - # Install the app with its arguments - yunohost app install $one_app $one_argument - else - # Upgrade the app - yunohost app upgrade $one_app - fi - - if [ ! -z "$apps_dependencies" ] - then - apps_dependencies="$apps_dependencies, $one_app" - else - apps_dependencies="$one_app" - fi - done - - ynh_app_setting_set --app=$app --key=apps_dependencies --value="$apps_dependencies" -} - -# Remove other YunoHost apps -# -# Other YunoHost apps will be removed only if no other apps need them. -# -# usage: ynh_remove_apps -# -# Requires YunoHost version *.*.* or higher. -ynh_remove_apps() { - # Retrieve the apps dependencies of the app - local apps_dependencies=$(ynh_app_setting_get --app=$app --key=apps_dependencies) - ynh_app_setting_delete --app=$app --key=apps_dependencies - - if [ ! -z "$apps_dependencies" ] - then - # Split the list of apps dependencies in an array - local apps_dependencies_list=($(echo $apps_dependencies | tr ", " "\n")) - - # For each apps dependencies - for one_app in "${apps_dependencies_list[@]}" - do - # Retrieve the list of installed apps - local installed_apps_list=$(yunohost app list --output-as json --quiet | jq -r .apps[].id) - local required_by="" - local installed_app_required_by="" - - # For each other installed app - for one_installed_app in $installed_apps_list - do - # Retrieve the other apps dependencies - one_installed_apps_dependencies=$(ynh_app_setting_get --app=$one_installed_app --key=apps_dependencies) - if [ ! -z "$one_installed_apps_dependencies" ] - then - one_installed_apps_dependencies_list=($(echo $one_installed_apps_dependencies | tr ", " "\n")) - - # For each dependency of the other apps - for one_installed_app_dependency in "${one_installed_apps_dependencies_list[@]}" - do - if [[ $one_installed_app_dependency == $one_app ]]; then - required_by="$required_by $one_installed_app" - fi - done - fi - done - - # If $one_app is no more required - if [[ -z "$required_by" ]] - then - # Remove $one_app - ynh_print_info --message="Removing of $one_app" - yunohost app remove $one_app --purge - else - ynh_print_info --message="$one_app was not removed because it's still required by${required_by}" - fi - done - fi -} - - - - # get the first available redis database # # usage: ynh_redis_get_free_db diff --git a/scripts/upgrade b/scripts/upgrade index ca1757c..e009d08 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -63,9 +63,6 @@ ynh_secure_remove --file="$data_dir/logs" mkdir -p "/var/log/$app" chown -R $app:$app "/var/log/$app" -# Remove Prosody -ynh_remove_apps - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= From b445312f4e21e6dcf787fe0d61a757e623fd6108 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 27 Dec 2023 15:50:31 +0100 Subject: [PATCH 54/86] App doesnt depend on prosody anymore --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index ba27719..27b2ca6 100644 --- a/manifest.toml +++ b/manifest.toml @@ -67,7 +67,7 @@ ram.runtime = "50M" api.protected = true [resources.apt] - packages = "prosody, ffmpeg, postgresql, postgresql-contrib, openssl, g++, mailutils, apt-transport-https" + packages = "ffmpeg, postgresql, postgresql-contrib, openssl, g++, mailutils, apt-transport-https" extras.yarn.repo = "deb https://dl.yarnpkg.com/debian/ stable main" extras.yarn.key = "https://dl.yarnpkg.com/debian/pubkey.gpg" From 63433a064671fbd657faba9b890aa72af31f3e79 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 27 Dec 2023 16:13:33 +0100 Subject: [PATCH 55/86] Attempt to fix the db suffix thingy... --- conf/production.yaml | 2 +- scripts/_common.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/conf/production.yaml b/conf/production.yaml index af883d6..1d53d27 100644 --- a/conf/production.yaml +++ b/conf/production.yaml @@ -47,7 +47,7 @@ database: hostname: 'localhost' port: 5432 ssl: false - suffix: '__DB_NAME__' + suffix: '__DB_SUFFIX__' username: '__DB_USER__' password: '__DB_PWD__' pool: diff --git a/scripts/_common.sh b/scripts/_common.sh index b5f6b3a..f3cd2a7 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,6 +5,8 @@ #================================================= nodejs_version=20 +# Obtain the (empty string), __2, __3, cf the DB suffix in production.yaml... +db_suffix="$(echo $app | sed 's/peertube//g')" #================================================= # PERSONAL HELPERS From 848ac65fc35402fc3cc69af4f8472059b60a785b Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 27 Dec 2023 16:34:42 +0100 Subject: [PATCH 56/86] Fine line_match for system start ... --- 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 6776c9b..b758980 100644 --- a/scripts/install +++ b/scripts/install @@ -120,7 +120,7 @@ popd ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on localhost" #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index ee86baa..21bc8fe 100644 --- a/scripts/restore +++ b/scripts/restore @@ -61,7 +61,7 @@ yunohost service add $app --description="$app daemon for Peertube" --log="/var/l #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on localhost" ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index e009d08..1aa1422 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -170,7 +170,7 @@ fi #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on localhost" #================================================= # END OF SCRIPT From f6eff70b3ffae7e1a2d10cf8acf60588a15b789d Mon Sep 17 00:00:00 2001 From: lapineige Date: Wed, 27 Dec 2023 17:02:36 +0100 Subject: [PATCH 57/86] localhost doesn't work And is less reliable (could be IPV6) --- conf/production.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/production.yaml b/conf/production.yaml index 28731b5..b6bf194 100644 --- a/conf/production.yaml +++ b/conf/production.yaml @@ -1,5 +1,5 @@ listen: - hostname: 'localhost' + hostname: '127.0.0.1' port: __PORT__ # Correspond to your reverse proxy server_name/listen configuration (i.e., your public PeerTube instance URL) From 2b637ec674e56ed7fc1ecee4af27309f3ae73d43 Mon Sep 17 00:00:00 2001 From: lapineige Date: Wed, 27 Dec 2023 17:04:21 +0100 Subject: [PATCH 58/86] reverts https://github.com/YunoHost-Apps/peertube_ynh/pull/397 as it's a different PR --- scripts/install | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/install b/scripts/install index 6cf9a01..e53392d 100644 --- a/scripts/install +++ b/scripts/install @@ -164,7 +164,6 @@ ynh_script_progression --message="Building Yarn dependencies..." pushd "$final_path" ynh_use_nodejs npm install -g npm - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn config set network-timeout 300000 ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean popd From 6b5baa0e3506f9ef94c302795b9bcec4031454e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 27 Dec 2023 17:16:19 +0100 Subject: [PATCH 59/86] Update production.yaml --- conf/production.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/production.yaml b/conf/production.yaml index 1d53d27..6759177 100644 --- a/conf/production.yaml +++ b/conf/production.yaml @@ -1,5 +1,5 @@ listen: - hostname: 'localhost' + hostname: '127.0.0.1' port: __PORT__ # Correspond to your reverse proxy server_name/listen configuration (i.e., your public PeerTube instance URL) From ee32c1d2d2114f3fda1b0c57ead24e2c0df706f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 27 Dec 2023 17:17:14 +0100 Subject: [PATCH 60/86] Update production.yaml --- conf/production.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/production.yaml b/conf/production.yaml index 6759177..63c34ba 100644 --- a/conf/production.yaml +++ b/conf/production.yaml @@ -70,8 +70,8 @@ smtp: sendmail: null hostname: 'localhost' port: 25 # If you use StartTLS: 587 - username: null - password: null + username: __APP__ + password: __MAIL_PWD__ tls: false # If you use StartTLS: false disable_starttls: true ca_file: null # Used for self signed certificates From 8e47569d6cb7c8e359544e942346a0e059567d6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 27 Dec 2023 17:17:44 +0100 Subject: [PATCH 61/86] Update manifest.toml --- manifest.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/manifest.toml b/manifest.toml index 27b2ca6..643b2d6 100644 --- a/manifest.toml +++ b/manifest.toml @@ -52,6 +52,7 @@ ram.runtime = "50M" rtmp.exposed = "TCP" [resources.system_user] + allow_email = true [resources.install_dir] From 7364432d2a52e706fe4d011891c7eed7bcc33437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 27 Dec 2023 17:18:47 +0100 Subject: [PATCH 62/86] Update manifest.toml --- manifest.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index 643b2d6..bdc5977 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "PeerTube" description.en = "Federated video streaming platform using P2P directly in the web browser" description.fr = "Plateforme fédéralisé de diffusion vidéo par P2P directement dans le navigateur" -version = "6.0.1~ynh1" +version = "6.0.2~ynh1" maintainers = ["yalh76"] @@ -42,8 +42,8 @@ ram.runtime = "50M" [resources] [resources.sources.main] - url = "https://github.com/Chocobozzz/PeerTube/releases/download/v6.0.1/peertube-v6.0.1.tar.xz" - sha256 = "d643b4c8ae8008a22bffb3d2b2981b0da11ad37e613140ccad7844bfad42a957" + url = "https://github.com/Chocobozzz/PeerTube/releases/download/v6.0.2/peertube-v6.0.2.tar.xz" + sha256 = "9313591f911f3951ec15a9d1102b8aa4158d4cf5af74e9f0e71c0ee4e4dca2a2" autoupdate.strategy = "latest_github_tag" [resources.ports] From bd9626c27ef9db4875f6b881a033c56631e33d2a Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 27 Dec 2023 16:18:52 +0000 Subject: [PATCH 63/86] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5129175..73fa11c 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser, using WebTorrent. -**Shipped version:** 6.0.1~ynh1 +**Shipped version:** 6.0.2~ynh1 **Demo:** http://peertube.cpy.re diff --git a/README_fr.md b/README_fr.md index 775a637..6db693c 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorrent) directement dans le navigateur Web, en utilisant WebTorrent -**Version incluse :** 6.0.1~ynh1 +**Version incluse :** 6.0.2~ynh1 **Démo :** http://peertube.cpy.re From 0ff34e2811877b834f50e79d5f10342426eaa5a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 27 Dec 2023 17:20:37 +0100 Subject: [PATCH 64/86] Update nginx.conf --- conf/nginx.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 3196f93..e894736 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -46,14 +46,14 @@ location ~ ^/api/v1/videos/(upload|([^/]+/studio/edit))$ { } location ~ ^/api/v1/runners/jobs/[^/]+/(update|success)$ { - client_max_body_size 12G; # default is 1M + client_max_body_size 12G; # default is 1M more_set_headers "X-File-Maximum-Size : 8G always"; # inform backend of the set value in bytes before mime-encoding (x * 1.4 >= client_max_body_size) try_files /dev/null @api; } location ~ ^/api/v1/(videos|video-playlists|video-channels|users/me) { - client_max_body_size 6M; # default is 1M + client_max_body_size 6M; # default is 1M more_set_headers "X-File-Maximum-Size : 4M always"; # inform backend of the set value in bytes before mime-encoding (x * 1.4 >= client_max_body_size) try_files /dev/null @api; From c0e1dc2f8153b0edcb1820a0bf295480c6f3c477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 27 Dec 2023 17:23:14 +0100 Subject: [PATCH 65/86] cleaning --- scripts/install | 8 +++----- scripts/restore | 2 +- scripts/upgrade | 4 +--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/scripts/install b/scripts/install index b758980..ff9bc24 100644 --- a/scripts/install +++ b/scripts/install @@ -74,7 +74,7 @@ chown -R $app:$app "/var/log/$app" # Use logrotate to manage application logfile(s) ynh_use_logrotate -yunohost service add $app --description="$app daemon for Peertube" --log="/var/log/$app/$app.log" --needs_exposed_ports $port_rtmp +yunohost service add $app --description="Federated video streaming platform" --log="/var/log/$app/$app.log" --needs_exposed_ports $port_rtmp #================================================= # BUILD YARN DEPENDENCIES @@ -93,13 +93,11 @@ popd #================================================= ynh_script_progression --message="Adding a configuration file..." -ynh_add_config --template="../conf/production.yaml" --destination="$install_dir/config/production.yaml" - +ynh_add_config --template="production.yaml" --destination="$install_dir/config/production.yaml" chmod 400 "$install_dir/config/production.yaml" chown $app:$app "$install_dir/config/production.yaml" -ynh_add_config --template="../conf/local-production.json" --destination="$install_dir/config/local-production.json" - +ynh_add_config --template="local-production.json" --destination="$install_dir/config/local-production.json" chmod 600 "$install_dir/config/local-production.json" chown $app:$app "$install_dir/config/local-production.json" diff --git a/scripts/restore b/scripts/restore index 21bc8fe..f84ad16 100644 --- a/scripts/restore +++ b/scripts/restore @@ -54,7 +54,7 @@ mkdir -p "/var/log/$app" chown -R $app:$app "/var/log/$app" ynh_restore_file --origin_path="/etc/logrotate.d/$app" -yunohost service add $app --description="$app daemon for Peertube" --log="/var/log/$app/$app.log" --needs_exposed_ports $port_rtmp +yunohost service add $app --description="Federated video streaming platform" --log="/var/log/$app/$app.log" --needs_exposed_ports $port_rtmp #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 1aa1422..3a8fd3e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -98,7 +98,7 @@ chown -R $app:$app "/var/log/$app" # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append -yunohost service add $app --description="$app daemon for Peertube" --log="/var/log/$app/$app.log" --needs_exposed_ports $port_rtmp +yunohost service add $app --description="Federated video streaming platform" --log="/var/log/$app/$app.log" --needs_exposed_ports $port_rtmp #================================================= # Generate secrets if they don't exist @@ -127,12 +127,10 @@ popd ynh_script_progression --message="Updating a config file..." ynh_add_config --template="../conf/production.yaml" --destination="$install_dir/config/production.yaml" - chmod 400 "$install_dir/config/production.yaml" chown $app:$app "$install_dir/config/production.yaml" ynh_backup_if_checksum_is_different --file="$install_dir/config/local-production.json" - chmod 600 "$install_dir/config/local-production.json" chown $app:$app "$install_dir/config/local-production.json" From 5fbb7d26a4a0235c377599af6d77df137a4f200c Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 27 Dec 2023 17:26:40 +0100 Subject: [PATCH 66/86] Simplify handling of local-production.json --- conf/local-production.json | 2 -- scripts/install | 3 ++- scripts/upgrade | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) delete mode 100644 conf/local-production.json diff --git a/conf/local-production.json b/conf/local-production.json deleted file mode 100644 index 2c63c08..0000000 --- a/conf/local-production.json +++ /dev/null @@ -1,2 +0,0 @@ -{ -} diff --git a/scripts/install b/scripts/install index ff9bc24..dea5d37 100644 --- a/scripts/install +++ b/scripts/install @@ -97,7 +97,8 @@ ynh_add_config --template="production.yaml" --destination="$install_dir/config/p chmod 400 "$install_dir/config/production.yaml" chown $app:$app "$install_dir/config/production.yaml" -ynh_add_config --template="local-production.json" --destination="$install_dir/config/local-production.json" +# Initialize local setting conf file +echo '{}' > "$install_dir/config/local-production.json" chmod 600 "$install_dir/config/local-production.json" chown $app:$app "$install_dir/config/local-production.json" diff --git a/scripts/upgrade b/scripts/upgrade index 3a8fd3e..3ba9adc 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -130,7 +130,6 @@ ynh_add_config --template="../conf/production.yaml" --destination="$install_dir/ chmod 400 "$install_dir/config/production.yaml" chown $app:$app "$install_dir/config/production.yaml" -ynh_backup_if_checksum_is_different --file="$install_dir/config/local-production.json" chmod 600 "$install_dir/config/local-production.json" chown $app:$app "$install_dir/config/local-production.json" From 5a46fef45a6b1fcadeefa62e18900a08aba77834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 27 Dec 2023 17:31:31 +0100 Subject: [PATCH 67/86] Update production.yaml --- conf/production.yaml | 143 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 120 insertions(+), 23 deletions(-) diff --git a/conf/production.yaml b/conf/production.yaml index 63c34ba..dd6bee1 100644 --- a/conf/production.yaml +++ b/conf/production.yaml @@ -13,7 +13,6 @@ secrets: # Generate one using `openssl rand -hex 32` peertube: '__SECRETS_PEERTUBE__' - rates_limit: api: # 50 attempts in 10 seconds @@ -35,6 +34,31 @@ rates_limit: # 10 attempts in 10 min window: 10 minutes max: 10 + plugins: + # 500 attempts in 10 seconds (we also serve plugin static files) + window: 10 seconds + max: 500 + well_known: + # 200 attempts in 10 seconds + window: 10 seconds + max: 200 + feeds: + # 50 attempts in 10 seconds + window: 10 seconds + max: 50 + activity_pub: + # 500 attempts in 10 seconds (we can have many AP requests) + window: 10 seconds + max: 500 + client: # HTML files generated by PeerTube + # 500 attempts in 10 seconds (to not break crawlers) + window: 10 seconds + max: 500 + +oauth2: + token_lifetime: + access_token: '1 day' + refresh_token: '2 weeks' # Proxies to trust to get real client IP # If you run PeerTube just behind a local proxy (nginx), keep 'loopback' @@ -114,14 +138,16 @@ defaults: # From the project root directory storage: tmp: '__DATA_DIR__/storage/tmp/' # Use to download data (imports etc), store uploaded files before processing... + tmp_persistent: '__DATA_DIR__//storage/tmp-persistent/' # As tmp but the directory is not cleaned up between PeerTube restarts bin: '__DATA_DIR__/storage/bin/' avatars: '__DATA_DIR__/storage/avatars/' - videos: '__DATA_DIR__/storage/videos/' + web_videos: '__DATA_DIR__/storage/videos/' streaming_playlists: '__DATA_DIR__/storage/streaming-playlists/' redundancy: '__DATA_DIR__/storage/redundancy/' logs: '/var/log/__APP__/' previews: '__DATA_DIR__/storage/previews/' thumbnails: '__DATA_DIR__/storage/thumbnails/' + storyboards: '__DATA_DIR__/storage/storyboards/' torrents: '__DATA_DIR__/storage/torrents/' captions: '__DATA_DIR__/storage/captions/' cache: '__DATA_DIR__/storage/cache/' @@ -184,9 +210,9 @@ object_storage: # Useful when you want to use a CDN/external proxy base_url: '' # Example: 'https://mirror.example.com' - # Same settings but for webtorrent videos - videos: - bucket_name: 'videos' + # Same settings but for web videos + web_videos: + bucket_name: 'web-videos' prefix: '' base_url: '' @@ -203,23 +229,31 @@ log: log_ping_requests: true log_tracker_unknown_infohash: true + # If you have many concurrent requests, you can disable HTTP requests logging to reduce PeerTube CPU load + log_http_requests: true + prettify_sql: false # Accept warn/error logs coming from the client accept_client_log: true # Support of Open Telemetry metrics and tracing -# For more information: https://docs.joinpeertube.org/maintain-observability +# For more information: https://docs.joinpeertube.org/maintain/observability open_telemetry: metrics: enabled: false + http_request_duration: + # You can disable HTTP request duration metric that can have a high tag cardinality + enabled: true + # Create a prometheus exporter server on this port so prometheus server can scrape PeerTube metrics prometheus_exporter: hostname: '127.0.0.1' port: 9091 tracing: + # If tracing is enabled, you must provide --experimental-loader=@opentelemetry/instrumentation/hook.mjs flag to the node binary enabled: false # Send traces to a Jaeger compatible endpoint @@ -228,12 +262,14 @@ open_telemetry: trending: videos: - interval_days: 7 # Compute trending videos for the last x days + interval_days: 7 # Compute trending videos for the last x days for 'most-viewed' algorithm + algorithms: enabled: - - 'hot' # adaptation of Reddit's 'Hot' algorithm - - 'most-viewed' # default, used initially by PeerTube as the trending page - - 'most-liked' + - 'hot' # Adaptation of Reddit's 'Hot' algorithm + - 'most-viewed' # Number of views in the last x days + - 'most-liked' # Global views since the upload of the video + default: 'most-viewed' # Cache remote videos on your server, to help other instances to broadcast the video @@ -278,6 +314,11 @@ security: frameguard: enabled: true + # Set x-powered-by HTTP header to "PeerTube" + # Can help remote software to know this is a PeerTube instance + powered_by_header: + enabled: true + tracker: # If you disable the tracker, you disable the P2P on your PeerTube instance enabled: true @@ -326,6 +367,9 @@ plugins: url: 'https://packages.joinpeertube.org' federation: + # Some federated software such as Mastodon may require an HTTP signature to access content + sign_federated_fetches: true + videos: federate_unlisted: false @@ -356,6 +400,20 @@ feeds: # Default number of comments displayed in feeds count: 20 +remote_runners: + # Consider jobs that are processed by a remote runner as stalled after this period of time without any update + stalled_jobs: + live: '30 seconds' + vod: '2 minutes' + +thumbnails: + # When automatically generating a thumbnail from the video + generation_from_video: + # How many frames to analyze at the middle of the video to select the most appropriate one + # Increasing this value will increase CPU and memory usage when generating the thumbnail, especially for high video resolution + # Minimum value is 2 + frames_to_analyze: 50 + ############################################################################### # # From this point, almost all following keys can be overridden by the web interface @@ -375,6 +433,8 @@ cache: size: 500 # Max number of video captions/subtitles you want to cache torrents: size: 500 # Max number of video torrents you want to cache + storyboards: + size: 500 # Max number of video storyboards you want to cache admin: # Used to generate the root user at first startup @@ -386,20 +446,31 @@ contact_form: signup: enabled: false + limit: 10 # When the limit is reached, registrations are disabled. -1 == unlimited + minimum_age: 16 # Used to configure the signup form + + # Users fill a form to register so moderators can accept/reject the registration + requires_approval: true requires_email_verification: false + filters: cidr: # You can specify CIDR ranges to whitelist (empty = no filtering) or blacklist whitelist: [] blacklist: [] user: + history: + videos: + # Enable or disable video history by default for new users. + enabled: true # Default value of maximum video bytes the user can upload (does not take into account transcoded files) # Byte format is supported ("1GB" etc) # -1 == unlimited video_quota: -1 video_quota_daily: -1 + default_channel_name: 'Main $1 channel' # The placeholder $1 is used to represent the user's username video_channels: max_per_user: 20 # Allows each user to create up to 20 video channels. @@ -416,12 +487,18 @@ transcoding: # If a user uploads an audio file, PeerTube will create a video by merging the preview file and the audio file allow_audio_files: true - # Amount of threads used by ffmpeg for 1 transcoding job + # Enable remote runners to transcode your videos + # If enabled, your instance won't transcode the videos itself + # At least 1 remote runner must be configured to transcode your videos + remote_runners: + enabled: false + + # Amount of threads used by ffmpeg for 1 local transcoding job threads: 1 - # Amount of transcoding jobs to execute in parallel + # Amount of local transcoding jobs to execute in parallel concurrency: 1 - # Choose the transcoding profile + # Choose the local transcoding profile # New profiles can be added by plugins # Available in core PeerTube: 'default' profile: 'default' @@ -440,18 +517,18 @@ transcoding: # Transcode and keep original resolution, even if it's above your maximum enabled resolution always_transcode_original_resolution: true - # Generate videos in a WebTorrent format (what we do since the first PeerTube release) + # Generate videos in a web compatible format # If you also enabled the hls format, it will multiply videos storage by 2 # If disabled, breaks federation with PeerTube instances < 2.1 - webtorrent: + web_videos: enabled: false # /!\ Requires ffmpeg >= 4.1 - # Generate HLS playlists and fragmented MP4 files. Better playback than with WebTorrent: + # Generate HLS playlists and fragmented MP4 files. Better playback than with Web Videos: # * Resolution change is smoother # * Faster playback in particular with long videos # * More stable playback (less bugs/infinite loading) - # If you also enabled the webtorrent format, it will multiply videos storage by 2 + # If you also enabled the web videos format, it will multiply videos storage by 2 hls: enabled: true @@ -516,9 +593,17 @@ live: # Allow to transcode the live streaming in multiple live resolutions transcoding: enabled: true + + # Enable remote runners to transcode your videos + # If enabled, your instance won't transcode the videos itself + # At least 1 remote runner must be configured to transcode your videos + remote_runners: + enabled: false + + # Amount of threads used by ffmpeg per live when using local transcoding threads: 2 - # Choose the transcoding profile + # Choose the local transcoding profile # New profiles can be added by plugins # Available in core PeerTube: 'default' profile: 'default' @@ -541,6 +626,17 @@ video_studio: # If enabled, users can create transcoding tasks as they wish enabled: false + # Enable remote runners to transcode studio tasks + # If enabled, your instance won't transcode the videos itself + # At least 1 remote runner must be configured to transcode your videos + remote_runners: + enabled: false + +video_file: + update: + # Add ability for users to replace the video file of an existing video + enabled: false + import: # Add ability for your users to import remote videos (from YouTube, torrent...) videos: @@ -553,7 +649,7 @@ import: # Classic HTTP or all sites supported by youtube-dl https://rg3.github.io/youtube-dl/supportedsites.html http: # We recommend to use a HTTP proxy if you enable HTTP import to prevent private URL access from this server - # See https://docs.joinpeertube.org/maintain-configuration?id=security for more information + # See https://docs.joinpeertube.org/maintain/configuration#security for more information enabled: false youtube_dl_release: @@ -577,10 +673,10 @@ import: # Magnet URI or torrent file (use classic TCP/UDP/WebSeed to download the file) torrent: # We recommend to only enable magnet URI/torrent import if you trust your users - # See https://docs.joinpeertube.org/maintain-configuration?id=security for more information + # See https://docs.joinpeertube.org/maintain/configuration#security for more information enabled: false - # Add ability for your users to synchronize their channels with external channels, playlists, etc. + # Add ability for your users to synchronize their channels with external channels, playlists, etc video_channel_synchronization: enabled: false @@ -677,8 +773,9 @@ instance: Disallow: # /.well-known/security.txt rules. This endpoint is cached, so you may have to wait a few hours before viewing your changes # To discourage researchers from testing your instance and disable security.txt integration, set this to an empty string - securitytxt: - '# If you would like to report a security issue\n# you may report it to:\nContact: https://github.com/Chocobozzz/PeerTube/blob/develop/SECURITY.md\nContact: mailto:' + securitytxt: | + Contact: https://github.com/Chocobozzz/PeerTube/blob/develop/SECURITY.md + Expires: 2025-12-31T11:00:00.000Z' services: # Cards configuration to format video in Twitter From a34757f55e2389213e4d03633aca8edb47d1791f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 27 Dec 2023 17:34:15 +0100 Subject: [PATCH 68/86] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 3ba9adc..7da16ed 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -126,7 +126,7 @@ popd #================================================= ynh_script_progression --message="Updating a config file..." -ynh_add_config --template="../conf/production.yaml" --destination="$install_dir/config/production.yaml" +ynh_add_config --template="production.yaml" --destination="$install_dir/config/production.yaml" chmod 400 "$install_dir/config/production.yaml" chown $app:$app "$install_dir/config/production.yaml" From bc12195738674202741dfca0a4eab929b399d844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 27 Dec 2023 17:43:09 +0100 Subject: [PATCH 69/86] Delete msg_remove --- conf/msg_remove | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 conf/msg_remove diff --git a/conf/msg_remove b/conf/msg_remove deleted file mode 100644 index aa4db93..0000000 --- a/conf/msg_remove +++ /dev/null @@ -1,15 +0,0 @@ -__APP__ was successfully removed :) - -The domain https://__DOMAIN____PATH__ is free for other apps to be installed on it. - -You should close the PeerTube Live TCP port __PORT_RTMP__ available from internet (For example, closing the port on your ISP box if it's not automatically done). - -But a futher action is required from your side to completely remove the __APP__ data folder. If you have backup and plan to restore this app in the future DON'T RUN THIS COMMAND. -And if you are going to migrate to othe server you will have to move __DATA_DIR__storage/ to your new server. - - -You need to run this command to remove the data (warning all your videos will be removed): - -rm -R __DATA_DIR__storage/ -f - -If you facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/peertube_ynh From 88e6eff2b1c5baebbbae66ea5a855f63a0a4cb59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 27 Dec 2023 17:45:51 +0100 Subject: [PATCH 70/86] Update tests.toml --- tests.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.toml b/tests.toml index dd48a1c..48876d8 100644 --- a/tests.toml +++ b/tests.toml @@ -6,4 +6,4 @@ test_format = 1.0 # Commits to test upgrade from # ------------------------------- - test_upgrade_from.9bf92ff6.name = "Upgrade from 4.2.2" \ No newline at end of file + test_upgrade_from.f085f884c4b6cad5dee153dd5a5ac25ea1ef78fb.name = "Upgrade from 5.2.1" \ No newline at end of file From 5f7d4fbeded1133b91e4acf3f3e6641d6bf643aa Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 27 Dec 2023 17:53:16 +0100 Subject: [PATCH 71/86] Clean doc/ stuff.. --- doc/ADMIN.md | 23 +---------------------- doc/ADMIN_fr.md | 23 ----------------------- doc/POST_INSTALL.md | 19 ++++++++----------- manifest.toml | 4 ++-- 4 files changed, 11 insertions(+), 58 deletions(-) delete mode 100644 doc/ADMIN_fr.md diff --git a/doc/ADMIN.md b/doc/ADMIN.md index 3afed93..8ba3b3f 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -1,22 +1 @@ -### IMPORTANT POINT TO READ BEFORE INSTALLING -* Require **dedicated domain** like **peertube.domain.tld**. -* Admin username is: **root**. -* **Admin password and LDAP configuration** will be sent to the email address given at the time of the installation. -* URL can not be changed once selected. Choose the domain wisely. -* You need more then **1 GB** of RAM. If you don't have it, please create a **swap memory**. - - $ dd if=/dev/zero of=/swapfile bs=1024 count=1048576 - $ mkswap /swapfile - $ swapon /swapfile - $ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab - -* This app is **multi-instance** (you can have more then one PeerTube instance running on a YunoHost server) -* **If you are hosted on OVH virtual machine or experiencing `gyp ERR! configure error`, please switch to [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)** -* HTTP auth is not supported -* Do not modify the `/var/www//conf/production.yaml` file, because it will be overridden in the next upgrade. Please instead either change them though the web interface or create a `/var/www//conf/local.yaml` file, assign it the same owner, group and rights than for `conf/production.yaml` and fill there your specific settings. - * Note: when the same option have different values in `production.yaml` and `local.yaml` files, only the value in `local.yaml` is taken into account. - -### PLUGINS -* LDAP auth is supported, LDAP configuration will be sent to the email address given at the time of the installation. -* PeerTube plugin livechat is installed with Prosody. To enable, just select «Prosody server controlled by Peertube» as chat mode in the plugin configutation of the PeerTube admin page -* During install, because of Prosody, Metronome is disabled +* Do not modify the `/var/www//conf/production.yaml` file, because it will be overridden in the next upgrade. Please instead either change them though the web interface, which stores specific local settings in a separate configuration file. diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md deleted file mode 100644 index 3bf129e..0000000 --- a/doc/ADMIN_fr.md +++ /dev/null @@ -1,23 +0,0 @@ -### Points importants à lire avant l'installation -* Nécessite un **domaine dédié** comme **peertube.domain.tld**. -* Le nom d'utilisateur de l'administrateur est: **root**. -* **Le mot de passe administrateur et la configuration LDAP** seront envoyés à l'adresse email indiquée au moment de l'installation. -* L'URL ne peut pas être modifiée une fois sélectionnée. Choisissez judicieusement le domaine. -* Vous avez besoin de plus de **1 Go** de RAM. Si vous ne l'avez pas, veuillez créer une **mémoire swap**. - - $ dd if=/dev/zero of=/swapfile bs=1024 count=1048576 - $ mkswap /swapfile - $ swapon /swapfile - $ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab - -* Cette application est **multi-instance** (vous pouvez avoir plus d'une instance PeerTube en cours d'exécution sur un serveur YunoHost) -* **Si vous êtes hébergé sur une machine virtuelle OVH ou rencontrez `gyp ERR! configure error`, veuillez passer à [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)** -* L'authentification HTTP n'est pas supportée -* Ne modifiez pas le fichier `/var/www//conf/production.yaml`, car il sera remplacé à la prochaine mise à jour. À la place, veuillez modifier la configuration via l'interface web ou créer et remplir le fichier `/var/www//conf/local.yaml`, assignez-lui les mêmes propriétaire, groupe et droits que pour `conf/production.yaml` et y remplir vos options spécifiques. - * Note: si la même option contient différentes valeurs dans les fichiers `conf/production.yaml` et `conf/local.yaml`, seule la valeur dans `conf/local.yaml` sera prise en compte. - -#### PLUGINS - -* L'authentification LDAP est prise en charge, les instructions de configuration sont envoyées à l'adresse email indiquée au moment de l'installation -* Le plugin PeerTube livechat est installé ainsi que Prosody. pour l'activer, sélectionner «Prosody server controlled by Peertube» dans le paramétre chat mode du plugin dans la page d'administration de PeerTube. -* Pendant l'installation, à cause de Prosody, Metronome est désactivé. diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md index 34d364b..9197b62 100644 --- a/doc/POST_INSTALL.md +++ b/doc/POST_INSTALL.md @@ -1,15 +1,12 @@ -__APP__ was successfully installed :) - -Please open your __APP__ domain: https://__DOMAIN____PATH__ - -The admin username is: root -The admin password is: __ADMIN_PASS__ +- __APP__ can now be accessed at [https://__DOMAIN____PATH__](https://__DOMAIN____PATH__) +- The admin username is: root +- The admin password is: __ADMIN_PASS__ To make PeerTube Live available, you also need to make the TCP port __PORT_RTMP__ available from internet (For example, opening the port on your ISP box if it's not automatically done). -To enable LDAP authentication open https://__DOMAIN____PATH__admin/plugins/show/peertube-plugin-auth-ldap -Complete with the following informations : -- URL: ldap://127.0.0.1 -- Insecure TLS : checked -- Search base : ou=users,dc=yunohost,dc=org +To enable LDAP authentication, you should open [https://__DOMAIN____PATH__admin/plugins/show/peertube-plugin-auth-ldap](https://__DOMAIN____PATH__admin/plugins/show/peertube-plugin-auth-ldap) and complete with the following informations : +- URL: `ldap://127.0.0.1` +- Insecure TLS: `checked` +- Search base: `ou=users,dc=yunohost,dc=org` + All YunoHost users will be allowed to login as peertube user. diff --git a/manifest.toml b/manifest.toml index bdc5977..ef1b8a9 100644 --- a/manifest.toml +++ b/manifest.toml @@ -26,8 +26,8 @@ ldap = true sso = false disk = "50M" -ram.build = "50M" -ram.runtime = "50M" +ram.build = "1G" +ram.runtime = "1G" [install] [install.domain] From b62061a719f09e721f025628e0e4406f92648251 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 27 Dec 2023 18:10:54 +0100 Subject: [PATCH 72/86] Cleanup scripts x_x --- scripts/install | 24 ++++++-------------- scripts/restore | 2 ++ scripts/upgrade | 60 ++++++++++++++++++++----------------------------- 3 files changed, 33 insertions(+), 53 deletions(-) diff --git a/scripts/install b/scripts/install index dea5d37..32df2a2 100644 --- a/scripts/install +++ b/scripts/install @@ -16,36 +16,26 @@ source /usr/share/yunohost/helpers admin_mail=$(ynh_user_get_info --username=$admin --key="mail") admin_pass=$(ynh_string_random --length=24) secrets_peertube=$(ynh_string_random --length=24) - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= -ynh_script_progression --message="Storing installation settings..." - ynh_app_setting_set --app=$app --key=secrets_peertube --value=$secrets_peertube +redis_db=$(ynh_redis_get_free_db) +ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" + #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." +ynh_script_progression --message="Installing nodejs..." ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= # CREATE A POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Creating a PostgreSQL database..." +ynh_script_progression --message="Initializing postgresql modules..." ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database=$db_name ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name -#================================================= -# CONFIGURE REDIS -#================================================= - -redis_db=$(ynh_redis_get_free_db) -ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -109,8 +99,8 @@ ynh_script_progression --message="Installing $app plugin and password..." pushd "$install_dir" ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-livechat - echo $admin_pass | ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run reset-password -- -u root + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-livechat + echo "$admin_pass" | ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run reset-password -- -u root popd #================================================= diff --git a/scripts/restore b/scripts/restore index f84ad16..d2a7c42 100644 --- a/scripts/restore +++ b/scripts/restore @@ -45,6 +45,8 @@ ynh_script_progression --message="Reinstalling dependencies..." ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +ynh_script_progression --message="Reinstalling system configurations..." + ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/systemd/system/$app.service" diff --git a/scripts/upgrade b/scripts/upgrade index 7da16ed..f6c7f3a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -14,22 +14,8 @@ source /usr/share/yunohost/helpers #================================================= admin_mail=$(ynh_user_get_info --username=$admin --key="mail") - -#================================================= -# CHECK VERSION -#================================================= - upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# STANDARD UPGRADE STEPS -#================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." - -ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped" - #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -39,11 +25,17 @@ ynh_app_setting_delete --app=$app --key=admin_pass ynh_app_setting_delete --app=$app --key=admin_mail # If redis_db doesn't exist, create it -if [ -z "$redis_db" ]; then +if [ -z "${redis_db:-}" ]; then redis_db=$(ynh_redis_get_free_db) ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" fi +if [ -z "${secrets_peertube:-}" ]; then + ynh_print_info --message="Generating and storing PeerTube secrets..." + secrets_peertube=$(ynh_string_random --length=24) + ynh_app_setting_set --app=$app --key=secrets_peertube --value=$secrets_peertube +fi + # Add PostgreSQL extension for v1.0.0-beta.10.pre.1 ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database=$db_name ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name @@ -51,17 +43,22 @@ ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --datab # Remove repository ynh_secure_remove --file="/etc/apt/sources.list.d/yarn.list" -# Remove not needed checksum -ynh_delete_file_checksum --file="../conf/msg_install" - # Remove hook -ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app" -yunohost tools regen-conf nginx +if [[ -e "/usr/share/yunohost/hooks/conf_regen/15-nginx_$app" ]] +then + ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app" + yunohost tools regen-conf nginx +fi # Remove old log file ynh_secure_remove --file="$data_dir/logs" -mkdir -p "/var/log/$app" -chown -R $app:$app "/var/log/$app" + +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Stopping a systemd service..." + +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -86,6 +83,8 @@ ynh_script_progression --message="Upgrading dependencies..." ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +ynh_script_progression --message="Upgrading system configurations..." + # Create a dedicated NGINX config ynh_add_nginx_config @@ -100,16 +99,6 @@ ynh_use_logrotate --non-append yunohost service add $app --description="Federated video streaming platform" --log="/var/log/$app/$app.log" --needs_exposed_ports $port_rtmp -#================================================= -# Generate secrets if they don't exist -#================================================= - -if [ -z "$secrets_peertube" ]; then - ynh_print_info --message="Generating and storing PeerTube secrets..." - secrets_peertube=$(ynh_string_random --length=24) - ynh_app_setting_set --app=$app --key=secrets_peertube --value=$secrets_peertube -fi - #================================================= # BUILD YARN DEPENDENCIES #================================================= @@ -124,7 +113,7 @@ popd #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Updating a config file..." +ynh_script_progression --message="Updating configuration file..." ynh_add_config --template="production.yaml" --destination="$install_dir/config/production.yaml" chmod 400 "$install_dir/config/production.yaml" @@ -140,8 +129,7 @@ ynh_script_progression --message="Installing $app plugin..." pushd "$install_dir" ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-livechat - + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-livechat popd #================================================= @@ -165,7 +153,7 @@ fi #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." +ynh_script_progression --message="Starting systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on localhost" From 00bb84350a2203543b12b3e84e3437efccf2481b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 27 Dec 2023 18:23:04 +0100 Subject: [PATCH 73/86] Update description --- doc/ADMIN.md | 2 +- doc/ADMIN_fr.md | 1 + doc/DESCRIPTION.md | 2 +- doc/DESCRIPTION_fr.md | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 doc/ADMIN_fr.md diff --git a/doc/ADMIN.md b/doc/ADMIN.md index 8ba3b3f..6fda198 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -1 +1 @@ -* Do not modify the `/var/www//conf/production.yaml` file, because it will be overridden in the next upgrade. Please instead either change them though the web interface, which stores specific local settings in a separate configuration file. +* Do not modify the `__INSTALL_DIR__/conf/production.yaml` file, because it will be overridden in the next upgrade. Please instead either change them though the web interface, which stores specific local settings in a separate configuration file. diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md new file mode 100644 index 0000000..953aefb --- /dev/null +++ b/doc/ADMIN_fr.md @@ -0,0 +1 @@ +* Ne modifiez pas les paramètres dans le fichier `__INSTALL_DIR__/conf/production.yaml`, car il sera remplacé lors de la prochaine mise à niveau. Veuillez plutôt modifier la configuration via l'interface Web, qui stocke les paramètres locaux spécifiques dans un fichier de configuration distinct. \ No newline at end of file diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index 70f7a24..66dde64 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -1 +1 @@ -Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser, using WebTorrent. +PeerTube is a decentralized and federated video hosting software. To publish videos, the user must register with a host (called an instance). Each host has its own conditions of use (storage space per user, moderation rules, themes, etc.). Thanks to WebTorrent, if several people view the same video, fragments of it are exchanged between people so as not to overload the instance. Decentralized: Each instance can follow one or more other PeerTube instances in order to allow its users to view their videos. Federated: Via the ActivityPub protocol, Peertube can interact with other software that is part of the Fediverse, such as Mastodon for example. diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md index 6ec737f..14aa61d 100644 --- a/doc/DESCRIPTION_fr.md +++ b/doc/DESCRIPTION_fr.md @@ -1 +1 @@ -Plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorrent) directement dans le navigateur Web, en utilisant WebTorrent +PeerTube est un logiciel décentralisé et fédéré d’hébergement de vidéos. Pour publier des vidéos, l’utilisateur doit s’inscrire chez un hébergeur (nommé instance). Chaque hébergeur possède ses conditions d’utilisation (espace de stockage par utilisateur, règles de modération, thématiques, etc.). Grâce à WebTorrent, si plusieurs personnes consultent une même vidéo, des fragments de celle-ci sont échangés entre les personnes afin de ne pas surcharger l’instance. Décentralisé : Chaque instance peut suivre une ou plusieurs autres instances PeerTube afin de permettre à ses utilisateurs de visionner les vidéos de celles-ci. Fédéré : Via le protocole ActivityPub, Peertube peut interagir avec d’autres logiciels qui font partie du Fediverse, comme Mastodon par exemple. From 677adeb3524db07dbbfe209d67b30c8c92514e91 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 27 Dec 2023 17:23:09 +0000 Subject: [PATCH 74/86] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 73fa11c..c76b7dc 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview -Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser, using WebTorrent. +PeerTube is a decentralized and federated video hosting software. To publish videos, the user must register with a host (called an instance). Each host has its own conditions of use (storage space per user, moderation rules, themes, etc.). Thanks to WebTorrent, if several people view the same video, fragments of it are exchanged between people so as not to overload the instance. Decentralized: Each instance can follow one or more other PeerTube instances in order to allow its users to view their videos. Federated: Via the ActivityPub protocol, Peertube can interact with other software that is part of the Fediverse, such as Mastodon for example. **Shipped version:** 6.0.2~ynh1 diff --git a/README_fr.md b/README_fr.md index 6db693c..294dcb1 100644 --- a/README_fr.md +++ b/README_fr.md @@ -16,7 +16,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po ## Vue d’ensemble -Plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorrent) directement dans le navigateur Web, en utilisant WebTorrent +PeerTube est un logiciel décentralisé et fédéré d’hébergement de vidéos. Pour publier des vidéos, l’utilisateur doit s’inscrire chez un hébergeur (nommé instance). Chaque hébergeur possède ses conditions d’utilisation (espace de stockage par utilisateur, règles de modération, thématiques, etc.). Grâce à WebTorrent, si plusieurs personnes consultent une même vidéo, des fragments de celle-ci sont échangés entre les personnes afin de ne pas surcharger l’instance. Décentralisé : Chaque instance peut suivre une ou plusieurs autres instances PeerTube afin de permettre à ses utilisateurs de visionner les vidéos de celles-ci. Fédéré : Via le protocole ActivityPub, Peertube peut interagir avec d’autres logiciels qui font partie du Fediverse, comme Mastodon par exemple. **Version incluse :** 6.0.2~ynh1 From 9b4881b0e8aa172be44b0fd8e21dbea5aa1ec70f Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 27 Dec 2023 18:23:51 +0100 Subject: [PATCH 75/86] More section reordering.. --- scripts/install | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/scripts/install b/scripts/install index 32df2a2..43349d9 100644 --- a/scripts/install +++ b/scripts/install @@ -47,10 +47,22 @@ ynh_setup_source --dest_dir="$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" +#================================================= +# BUILD YARN DEPENDENCIES +#================================================= +ynh_script_progression --message="Building Yarn dependencies..." + +pushd "$install_dir" + ynh_use_nodejs + npm install -g npm + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean +popd + #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." +ynh_script_progression --message="Adding system configurations..." # Create a dedicated NGINX config ynh_add_nginx_config @@ -66,22 +78,10 @@ ynh_use_logrotate yunohost service add $app --description="Federated video streaming platform" --log="/var/log/$app/$app.log" --needs_exposed_ports $port_rtmp -#================================================= -# BUILD YARN DEPENDENCIES -#================================================= -ynh_script_progression --message="Building Yarn dependencies..." - -pushd "$install_dir" - ynh_use_nodejs - npm install -g npm - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean -popd - #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." +ynh_script_progression --message="Adding peertube configuration file..." ynh_add_config --template="production.yaml" --destination="$install_dir/config/production.yaml" chmod 400 "$install_dir/config/production.yaml" @@ -92,6 +92,14 @@ echo '{}' > "$install_dir/config/local-production.json" chmod 600 "$install_dir/config/local-production.json" chown $app:$app "$install_dir/config/local-production.json" +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." + +# Start a systemd service +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on localhost" + #================================================= # INSTALL LDAP PLUGIN #================================================= @@ -103,14 +111,6 @@ pushd "$install_dir" echo "$admin_pass" | ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run reset-password -- -u root popd -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." - -# Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on localhost" - #================================================= # END OF SCRIPT #================================================= From cfc82d5cf35aa8bb5c4b8cd896925dbeab02d7b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 27 Dec 2023 18:24:41 +0100 Subject: [PATCH 76/86] add post fr --- doc/POST_INSTALL.md | 2 +- doc/POST_INSTALL_fr.md | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 doc/POST_INSTALL_fr.md diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md index 9197b62..312a2bf 100644 --- a/doc/POST_INSTALL.md +++ b/doc/POST_INSTALL.md @@ -9,4 +9,4 @@ To enable LDAP authentication, you should open [https://__DOMAIN____PATH__admin/ - Insecure TLS: `checked` - Search base: `ou=users,dc=yunohost,dc=org` -All YunoHost users will be allowed to login as peertube user. +All YunoHost users will be allowed to login as PeerTube user. diff --git a/doc/POST_INSTALL_fr.md b/doc/POST_INSTALL_fr.md new file mode 100644 index 0000000..3d3ecec --- /dev/null +++ b/doc/POST_INSTALL_fr.md @@ -0,0 +1,12 @@ +- __APP__ est désormais accessible sur [https://__DOMAIN____PATH__](https://__DOMAIN____PATH__) +- Le nom d'utilisateur administrateur est : root +- Le mot de passe administrateur est : __ADMIN_PASS__ + +Pour rendre PeerTube Live disponible, vous devez également rendre le port TCP __PORT_RTMP__ disponible depuis internet (par exemple, ouvrir le port sur votre box FAI si ce n'est pas fait automatiquement). + +Pour activer l'authentification LDAP, vous devez ouvrir [https://__DOMAIN____PATH__admin/plugins/show/peertube-plugin-auth-ldap](https://__DOMAIN____PATH__admin/plugins/show/peertube-plugin-auth-ldap) et compléter avec le informations suivantes : +-URL : `ldap://127.0.0.1` +- TLS non sécurisé : "vérifié" +- Base de recherche : `ou=users,dc=yunohost,dc=org` + +Tous les utilisateurs de YunoHost seront autorisés à se connecter en tant qu'utilisateur PeerTube. \ No newline at end of file From 46c3d362002bedd76a56183e63f96eab2be3a778 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 27 Dec 2023 18:53:30 +0100 Subject: [PATCH 77/86] Now the service listens to 127.0.0.1 and not localhost --- 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 43349d9..be57c80 100644 --- a/scripts/install +++ b/scripts/install @@ -98,7 +98,7 @@ chown $app:$app "$install_dir/config/local-production.json" ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on localhost" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on 127.0.0.1" #================================================= # INSTALL LDAP PLUGIN diff --git a/scripts/restore b/scripts/restore index d2a7c42..0e06b86 100644 --- a/scripts/restore +++ b/scripts/restore @@ -63,7 +63,7 @@ yunohost service add $app --description="Federated video streaming platform" --l #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on localhost" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on 127.0.0.1" ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index f6c7f3a..a1f40ce 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -155,7 +155,7 @@ fi #================================================= ynh_script_progression --message="Starting systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on localhost" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on 127.0.0.1" #================================================= # END OF SCRIPT From caa9e9f432db1d019d845b44c29b0b0e8e34cf0b Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 27 Dec 2023 18:53:51 +0100 Subject: [PATCH 78/86] Gotta save the admin password such that it's available when rendering the POST_INSTALL.md --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index be57c80..a4bb263 100644 --- a/scripts/install +++ b/scripts/install @@ -15,6 +15,7 @@ source /usr/share/yunohost/helpers admin_mail=$(ynh_user_get_info --username=$admin --key="mail") admin_pass=$(ynh_string_random --length=24) +ynh_app_setting_set --app=$app --key=secrets_peertube --value=$admin_pass secrets_peertube=$(ynh_string_random --length=24) ynh_app_setting_set --app=$app --key=secrets_peertube --value=$secrets_peertube From c87daa7198a8d9c4f92f4b9e2711007ba46018c8 Mon Sep 17 00:00:00 2001 From: lapineige Date: Wed, 27 Dec 2023 18:56:49 +0100 Subject: [PATCH 79/86] Raise timeout duration for Yarn (during upgrade) --- scripts/upgrade | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/upgrade b/scripts/upgrade index 86deeeb..b178b49 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -225,6 +225,7 @@ ynh_script_progression --message="Building Yarn dependencies..." pushd "$final_path" ynh_use_nodejs + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn config set network-timeout 300000 ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean popd From bacecf5e2153c0edff909299a4aa1814aaa13873 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 27 Dec 2023 19:07:03 +0100 Subject: [PATCH 80/86] Aaaand typo >_> --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index a4bb263..18417a2 100644 --- a/scripts/install +++ b/scripts/install @@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers admin_mail=$(ynh_user_get_info --username=$admin --key="mail") admin_pass=$(ynh_string_random --length=24) -ynh_app_setting_set --app=$app --key=secrets_peertube --value=$admin_pass +ynh_app_setting_set --app=$app --key=admin_pass --value=$admin_pass secrets_peertube=$(ynh_string_random --length=24) ynh_app_setting_set --app=$app --key=secrets_peertube --value=$secrets_peertube From e142f23125b7a9013af3fe3838fcb1402d36ddf5 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 27 Dec 2023 19:21:43 +0100 Subject: [PATCH 81/86] Simplify remove script / more explicit message about system configuration removal --- scripts/remove | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/scripts/remove b/scripts/remove index 5ddde0f..d6a8c41 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,26 +1,8 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= - -admin_mail=$(ynh_user_get_info --username=$admin --key="mail") - -#================================================= -# STANDARD REMOVE -#================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST -#================================================= - # 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 @@ -28,6 +10,8 @@ then yunohost service remove $app fi +ynh_script_progression --message="Removing system configurations related to $app..." + # Remove the dedicated systemd config ynh_remove_systemd_config From a27a5347bf9527f0ed09123f674d56ec1159795d Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 27 Dec 2023 21:35:18 +0100 Subject: [PATCH 82/86] Properly rename the database during v1->v2 transition --- scripts/upgrade | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index a1f40ce..ad842f4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -60,6 +60,15 @@ ynh_script_progression --message="Stopping a systemd service..." ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped" +# In the past, the db was called peertube_peertube >_> +if [[ "${db_name:-}" == "peertube_peertube" ]] +then + ynh_print_info --message="Renaming database..." + ynh_psql_execute_as_root --sql="ALTER DATABASE $db_name RENAME TO $app;" + db_name="$app" + ynh_app_setting_set --app="$app" --key=db_name --value="$db_name" +fi + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= From 807b10702b1a432bfc733260f872b0b63c61d509 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 27 Dec 2023 21:35:53 +0100 Subject: [PATCH 83/86] No need to display warning during upgrade if psql extensions are already there --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index ad842f4..d73391d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,8 +37,8 @@ if [ -z "${secrets_peertube:-}" ]; then fi # Add PostgreSQL extension for v1.0.0-beta.10.pre.1 -ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database=$db_name -ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name +ynh_exec_warn_less ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database=$db_name +ynh_exec_warn_less ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name # Remove repository ynh_secure_remove --file="/etc/apt/sources.list.d/yarn.list" From f6a7e6bec215869b9a166bffd16c28a73e3bb6ec Mon Sep 17 00:00:00 2001 From: lapineige Date: Wed, 27 Dec 2023 17:30:05 +0100 Subject: [PATCH 84/86] do not install npm globally --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 18417a2..bdb6a11 100644 --- a/scripts/install +++ b/scripts/install @@ -55,7 +55,7 @@ ynh_script_progression --message="Building Yarn dependencies..." pushd "$install_dir" ynh_use_nodejs - npm install -g npm + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn config set network-timeout 300000 ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean popd From 4215c4b99b1cc5e097daa44b6d4cf98f40658d6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 27 Dec 2023 23:17:13 +0100 Subject: [PATCH 85/86] Update tests.toml --- tests.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests.toml b/tests.toml index 48876d8..0034b17 100644 --- a/tests.toml +++ b/tests.toml @@ -2,6 +2,12 @@ test_format = 1.0 [default] + # ------------ + # Tests to run + # ------------ + + exclude = ["change_url"] + # ------------------------------- # Commits to test upgrade from # ------------------------------- From ff537bddec459dbafe17d666dad596da5482db06 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 28 Dec 2023 04:44:10 +0100 Subject: [PATCH 86/86] Fix commit to test upgrade from ... --- tests.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.toml b/tests.toml index 0034b17..4fbe1fb 100644 --- a/tests.toml +++ b/tests.toml @@ -12,4 +12,4 @@ test_format = 1.0 # Commits to test upgrade from # ------------------------------- - test_upgrade_from.f085f884c4b6cad5dee153dd5a5ac25ea1ef78fb.name = "Upgrade from 5.2.1" \ No newline at end of file + test_upgrade_from.8a8d9be.name = "5.2.1"