diff --git a/manifest.toml b/manifest.toml index c8dc1d8..e46ef63 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.2.18" +yunohost = ">= 11.2.29" helpers_version = "2.1" architectures = "all" multi_instance = false diff --git a/scripts/install b/scripts/install index 233e463..21de225 100644 --- a/scripts/install +++ b/scripts/install @@ -44,8 +44,6 @@ ynh_script_progression "Setting up source files..." # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # BUILD YARN DEPENDENCIES #================================================= @@ -53,9 +51,9 @@ ynh_script_progression "Building Yarn dependencies..." pushd "$install_dir" - ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn config set network-timeout 300000 - ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn install --production --pure-lockfile - ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn cache clean + ynh_hide_warnings ynh_exec_as_app yarn config set network-timeout 300000 + ynh_hide_warnings ynh_exec_as_app yarn install --production --pure-lockfile + ynh_hide_warnings ynh_exec_as_app yarn cache clean popd #================================================= @@ -71,7 +69,6 @@ ynh_config_add_systemd mkdir -p "/var/log/$app" touch "/var/log/$app/peertube.log" -#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:$app "/var/log/$app" # Use logrotate to manage application logfile(s) ynh_config_add_logrotate @@ -84,13 +81,9 @@ yunohost service add $app --description="Federated video streaming platform" --l ynh_script_progression "Adding peertube configuration file..." ynh_config_add --template="production.yaml" --destination="$install_dir/config/production.yaml" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/config/production.yaml" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/config/production.yaml" # Initialize local setting conf file echo '{}' > "$install_dir/config/local-production.json" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 600 "$install_dir/config/local-production.json" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/config/local-production.json" #================================================= # START SYSTEMD SERVICE @@ -106,9 +99,9 @@ ynh_systemctl --service=$app --action="start" --log_path="systemd" --wait_until= ynh_script_progression "Installing $app plugin and password..." pushd "$install_dir" - ynh_hide_warnings ynh_exec_as_app node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production npm run plugin:install -- --npm-name peertube-plugin-auth-ldap - ynh_hide_warnings ynh_exec_as_app node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production npm run plugin:install -- --npm-name peertube-plugin-livechat - echo "$admin_pass" | ynh_hide_warnings ynh_exec_as_app node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production npm run reset-password -- -u root + ynh_hide_warnings ynh_exec_as_app NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production npm run plugin:install -- --npm-name peertube-plugin-auth-ldap + ynh_hide_warnings ynh_exec_as_app NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production npm run plugin:install -- --npm-name peertube-plugin-livechat + echo "$admin_pass" | ynh_hide_warnings ynh_exec_as_app NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production npm run reset-password -- -u root popd #================================================= diff --git a/scripts/restore b/scripts/restore index 51df435..33a282b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -11,8 +11,6 @@ ynh_script_progression "Restoring the app main directory..." ynh_restore "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # RESTORE THE DATA DIRECTORY #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 836aede..1b31037 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,11 +15,7 @@ admin_mail=$(ynh_user_get_info --username=$admin --key="mail") ynh_script_progression "Ensuring downward compatibility..." # If redis_db doesn't exist, create it -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=redis_db --value=$(ynh_redis_get_free_db) -if [ -z "${redis_db:-}" ]; then - redis_db=$(ynh_redis_get_free_db) - ynh_app_setting_set --key=redis_db --value="$redis_db" -fi +ynh_app_setting_set_default --key=redis_db --value=$(ynh_redis_get_free_db) if [ -z "${secrets_peertube:-}" ]; then ynh_print_info "Generating and storing PeerTube secrets..." @@ -69,19 +65,10 @@ fi #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression "Upgrading source files..." -# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed -if ynh_app_upstream_version_changed -then - ynh_script_progression "Upgrading source files..." +ynh_setup_source --full_replace --dest_dir="$install_dir" --keep="config/production.yaml config/local-production.json config/local.yaml" - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --full_replace --dest_dir="$install_dir" \ - --keep="config/production.yaml config/local-production.json config/local.yaml" -fi - -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" chown -R $app:www-data "$data_dir" #================================================= @@ -104,7 +91,6 @@ ynh_config_add_systemd mkdir -p "/var/log/$app" touch "/var/log/$app/peertube.log" -#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:$app "/var/log/$app" # Use logrotate to manage app-specific logfile(s) ynh_config_add_logrotate @@ -118,9 +104,9 @@ ynh_script_progression "Building Yarn dependencies..." pushd "$install_dir" - ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn config set network-timeout 300000 - ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn install --production --pure-lockfile - ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn cache clean + ynh_hide_warnings ynh_exec_as_app yarn config set network-timeout 300000 + ynh_hide_warnings ynh_exec_as_app yarn install --production --pure-lockfile + ynh_hide_warnings ynh_exec_as_app yarn cache clean popd #================================================= @@ -129,11 +115,6 @@ popd ynh_script_progression "Updating configuration file..." ynh_config_add --template="production.yaml" --destination="$install_dir/config/production.yaml" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/config/production.yaml" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/config/production.yaml" - -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 600 "$install_dir/config/local-production.json" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/config/local-production.json" #================================================= # INSTALL LDAP PLUGIN @@ -141,8 +122,8 @@ ynh_config_add --template="production.yaml" --destination="$install_dir/config/p ynh_script_progression "Installing $app plugin..." pushd "$install_dir" - ynh_hide_warnings ynh_exec_as_app node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production npm run plugin:install -- --npm-name peertube-plugin-auth-ldap - ynh_hide_warnings ynh_exec_as_app node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production npm run plugin:install -- --npm-name peertube-plugin-livechat + ynh_hide_warnings ynh_exec_as_app NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production npm run plugin:install -- --npm-name peertube-plugin-auth-ldap + ynh_hide_warnings ynh_exec_as_app NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production npm run plugin:install -- --npm-name peertube-plugin-livechat popd #=================================================