diff --git a/check_process b/check_process index 475fd31..78e090d 100644 --- a/check_process +++ b/check_process @@ -27,7 +27,7 @@ Level 2=auto Level 3=auto # Level 4: not supported by upstream - Level 4=N/A + Level 4=1 # Level 5: Level 5=auto Level 6=auto diff --git a/manifest.json b/manifest.json index 9bc0ba2..bee9d93 100644 --- a/manifest.json +++ b/manifest.json @@ -5,15 +5,15 @@ "description": { "en": "Video streaming platform using P2P directly in the web browser, connected to a federated network" }, - "version": "1.1", + "version": "1.0.0-beta.3-1", "url": "https://github.com/Chocobozzz/PeerTube", - "license": "free", + "license": "AGPL-3.0-only", "maintainer": { "name": "Anmol Sharma", "email": "anmol@datamol.org" }, "requirements": { - "yunohost": ">= 2.7.2" + "yunohost": ">= 2.7.9" }, "multi_instance": true, "services": [ @@ -32,14 +32,14 @@ { "name": "email", "ask": { - "en": "Choose an admin email(Can be other then the LDAP emails and can be changed after installation)" + "en": "Choose an admin email (can be changed after installation)" }, "example": "johndoe@example.com" }, { "name": "port", "ask": { - "en": "Enter a port(default:9000).If the port is occupied by other app change it to any other value." + "en": "Enter a port(default:9000). If the port is occupied by any other app, the installation will chose another one." }, "default": "9000" }, diff --git a/scripts/backup b/scripts/backup index e0c4e32..6049480 100644 --- a/scripts/backup +++ b/scripts/backup @@ -9,14 +9,15 @@ if [ ! -e _common.sh ]; then # Get the _common.sh file if it's not in the current directory cp ../settings/scripts/_common.sh ./_common.sh - chmod a+rx _common.sh + cp ../settings/scripts/psql.sh ./psql.sh + cp ../settings/scripts/nodejs.sh ./nodejs.sh + chmod a+rx _common.sh psql.sh nodejs.sh fi + source _common.sh -source psql.sh -source ../settings/scripts/psql.sh -source ../settings/scripts/nodejs.sh -source nodejs.sh source /usr/share/yunohost/helpers +source psql.sh +source nodejs.sh #================================================= # MANAGE SCRIPT FAILURE @@ -35,7 +36,6 @@ final_path=$(ynh_app_setting_get $app final_path) domain=$(ynh_app_setting_get $app domain) db_name=$(ynh_app_setting_get $app psql_db) - #================================================= # STANDARD BACKUP STEPS #================================================= @@ -46,8 +46,8 @@ ynh_backup "$final_path" # Copy the data directory -ynh_backup "/home/yunohost.app/${app}" - +datadir="/home/yunohost.app/${app}/storage" +ynh_backup "$datadir" #================================================= # BACKUP THE NGINX CONFIGURATION @@ -70,7 +70,6 @@ ynh_backup "db.sql" ynh_backup "/etc/logrotate.d/$app" - #================================================= # BACKUP SYSTEMD #================================================= diff --git a/scripts/install b/scripts/install index adc2ec3..c4832e9 100644 --- a/scripts/install +++ b/scripts/install @@ -7,11 +7,9 @@ #================================================= source _common.sh -source ../settings/scripts/psql.sh -source ../settings/scripts/nodejs.sh +source /usr/share/yunohost/helpers source psql.sh source nodejs.sh -source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE @@ -19,9 +17,6 @@ source /usr/share/yunohost/helpers # Exit if an error occurs during the execution of the script ynh_abort_if_errors -#ynh_clean_setup () { -# -#} #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST diff --git a/scripts/remove b/scripts/remove index 7aba88c..b89b9d1 100644 --- a/scripts/remove +++ b/scripts/remove @@ -8,11 +8,9 @@ #================================================= source _common.sh -source ../settings/scripts/psql.sh -source ../settings/scripts/nodejs.sh +source /usr/share/yunohost/helpers source psql.sh source nodejs.sh -source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS diff --git a/scripts/restore b/scripts/restore index 7d3a9af..4503f16 100644 --- a/scripts/restore +++ b/scripts/restore @@ -9,14 +9,15 @@ if [ ! -e _common.sh ]; then # Get the _common.sh file if it's not in the current directory cp ../settings/scripts/_common.sh ./_common.sh - chmod a+rx _common.sh + cp ../settings/scripts/psql.sh ./psql.sh + cp ../settings/scripts/nodejs.sh ./nodejs.sh + chmod a+rx _common.sh psql.sh nodejs.sh fi + source _common.sh -source psql.sh -source ../settings/scripts/psql.sh -source ../settings/scripts/nodejs.sh -source nodejs.sh source /usr/share/yunohost/helpers +source psql.sh +source nodejs.sh #================================================= # MANAGE SCRIPT FAILURE @@ -47,26 +48,23 @@ ynh_webpath_available "$domain" "$path_url" \ || ynh_die "Path not available: ${domain}${path_url}" test ! -d "$final_path" \ || ynh_die "There is already a directory: $final_path " - + +#================================================= +# STANDARD RESTORATION STEPS +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= + ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# FIND AND OPEN A PORT -#================================================= - -# Find a free port -ynh_find_port "$port" -# Open this port -yunohost firewall allow Both "$port" 2>&1 -ynh_app_setting_set "$app" port "$port" - - #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_restore_file "$final_path" -ynh_restore_file "/home/yunohost.app/${app}" + +datadir="/home/yunohost.app/${app}/storage" +ynh_restore_file "$datadir" #================================================= # RECREATE THE DEDICATED USER @@ -75,19 +73,14 @@ ynh_restore_file "/home/yunohost.app/${app}" # Create the dedicated user (if not existing) ynh_system_user_create "$app" +#================================================= +# RESTORE USER RIGHTS +#================================================= # Set right permissions for curl install datadir="/home/yunohost.app/${app}/storage" chown -R "$app" "$datadir" -#================================================= -# RESTORE THE PostgreSQL DATABASE -#================================================= - -ynh_psql_test_if_first_run -ynh_psql_setup_db "$app" "$db_name" "$db_pwd" -ynh_psql_execute_file_as_root ./db.sql "$db_name" - #================================================= # SPECIFIC RESTORATION #================================================= @@ -109,6 +102,14 @@ ynh_install_app_dependencies postgresql-9.4 ffmpeg redis-server redis-tools # install nodejs ynh_install_nodejs 8 +#================================================= +# RESTORE THE PostgreSQL DATABASE +#================================================= + +ynh_psql_test_if_first_run +ynh_psql_setup_db "$app" "$db_name" "$db_pwd" +ynh_psql_execute_file_as_root ./db.sql "$db_name" + #================================================= # RESTORE SYSTEMD #================================================= @@ -122,9 +123,17 @@ systemctl enable "$app.service" ynh_restore_file "/etc/logrotate.d/$app" +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= + +(cd "$final_path" && yarn install --production --pure-lockfile) + #================================================= # GENERIC FINALIZATION #================================================= -(cd "$final_path" && yarn install --production --pure-lockfile) +# RELOAD NGINX AND PeerTube +#================================================= + systemctl reload nginx service "$app" restart diff --git a/scripts/upgrade b/scripts/upgrade index 6072ed1..a6ec8e6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -7,9 +7,9 @@ #================================================= source _common.sh +source /usr/share/yunohost/helpers source psql.sh source nodejs.sh -source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS @@ -75,6 +75,25 @@ yunohost firewall allow Both "$port" 2>&1 # Create a system user ynh_system_user_create "$app" +#================================================= +# INSTALL DEPENDENCIES +#================================================= + +# install yarn +wget https://github.com/yarnpkg/yarn/releases/download/v1.5.1/yarn_1.5.1_all.deb +echo "a4770cd8dcb13dc9a9218940dbd24b510ddf5eec78adb4e0da9ef3760b55a76e yarn_1.5.1_all.deb" | sha256sum -c || ynh_die +dpkg -i yarn_1.5.1_all.deb + +# add backports (required to install ffmpeg) +echo "deb http://httpredir.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/jessie-backports.list +ynh_package_update + +# install postgresql, ffmpeg, redis +ynh_install_app_dependencies postgresql-9.4 ffmpeg redis-server redis-tools + +# install nodejs +ynh_install_nodejs 8 + #================================================= # CHECK THE PATH #=================================================