diff --git a/check_process b/check_process index 7db09ec..5962d45 100644 --- a/check_process +++ b/check_process @@ -14,9 +14,8 @@ upgrade=1 from_commit=628e89b0536a3c1ff7e5f9d903527b670690b336 backup_restore=1 multi_instance=1 + port_already_use=0 + change_url=0 ;;; Options Email= Notification=none -;;; Upgrade options - ; commit=628e89b0536a3c1ff7e5f9d903527b670690b336 - name=0.7.1~ynh1 diff --git a/conf/app.src b/conf/app.src index 4070886..ffa1aa4 100644 --- a/conf/app.src +++ b/conf/app.src @@ -3,4 +3,5 @@ SOURCE_SUM=9286971422470cedb8ca5f6675863816bf3f05f0769842a1bdc12f85fc594938 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= SOURCE_EXTRACT=true diff --git a/conf/systemd.service b/conf/systemd.service index 296dbd0..79d9d51 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -3,9 +3,10 @@ Description=__APP__ service After=network.target [Service] +Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__ +WorkingDirectory=__FINALPATH__/ ExecStart=__FINALPATH__/venv/bin/python3 __FINALPATH__/zeronet.py --ui_port __PORT__ --ui_host __DOMAIN__ --fileserver_port __FS_PORT__ --data_dir __DATADIR__/data --log_dir __DATADIR__/log --ui_password __PASSWORD__ ExecReload=/bin/kill -HUP $MAINPID KillMode=process diff --git a/doc/.gitkeep b/doc/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..fc99981 --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1 @@ +ZeroNet allows you to publish static and dynamic websites on a distributed web platform using Bitcoin crypto and the BitTorrent network. diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..4a3a0a0 --- /dev/null +++ b/doc/DISCLAIMER.md @@ -0,0 +1,11 @@ +## Install instructions +- This app can only be installed on root path, i.e you will need to use a dedicated domain name, e.g.`zeronet.domain.tld`. +- You can setup Tor which has to be done manually till its implimented in the app.[how to use zeronet with Tor](https://zeronet.readthedocs.io/en/latest/faq/#how-to-use-zeronet-with-tor) + +## Multiple Instances +- Installing multiple instances of the app is *experimental*. Internally each instance will use an unique port for both for ZeroNet UserInterface and FileServer. However, the tracker will see all instances as one peer, as they all use one and the same external IP address. But you try it and explain your user case. +- A solution that hasn't been confirmed yet is to use Tor instead. Each instance should then have a unique external address. + +## Limitations + +* App can not be used inside SSO. See [here](https://github.com/HelloZeroNet/ZeroNet/issues/2541) and [here](https://github.com/YunoHost/issues/issues/1580). diff --git a/doc/screenshots/.gitkeep b/doc/screenshots/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/doc/screenshots/screenshot.png b/doc/screenshots/screenshot.png new file mode 100644 index 0000000..52ffa01 Binary files /dev/null and b/doc/screenshots/screenshot.png differ diff --git a/manifest.json b/manifest.json index 621c6ca..d37553a 100644 --- a/manifest.json +++ b/manifest.json @@ -1,36 +1,42 @@ { - "name": "ZeroNet", - "id": "zeronet", - "packaging_format": 1, - "description": { - "en": "Decentralized websites using Bitcoin crypto and BitTorrent network", - "fr": "Sites Web décentralisés utilisant la crypto Bitcoin et le réseau BitTorrent" - }, - "version": "2021.01.25~ynh1", - "url": "https://zeronet.io", - "license": "AGPL-3.0", - "maintainer": { - "name": "whypsi", - "email": "whypsi@riseup.net" - }, - "requirements": { - "yunohost": ">= 4.3.0" - }, - "multi_instance": true, - "services": [ - "nginx" + "name": "ZeroNet", + "id": "zeronet", + "packaging_format": 1, + "description": { + "en": "Decentralized websites using Bitcoin crypto and BitTorrent network", + "fr": "Sites Web décentralisés utilisant la crypto Bitcoin et le réseau BitTorrent" + }, + "version": "2021.01.25~ynh1", + "url": "https://zeronet.io", + "upstream": { + "license": "AGPL-3.0", + "website": "https://zeronet.io", + "admindoc": "https://zeronet.io/docs/", + "code": "https://github.com/HelloZeroNet/ZeroNet" + }, + "license": "AGPL-3.0", + "maintainer": { + "name": "whypsi", + "email": "whypsi@riseup.net" + }, + "requirements": { + "yunohost": ">= 4.3.0" + }, + "multi_instance": true, + "services": [ + "nginx" ], "arguments": { - "install" : [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "password", - "type": "password", - "optional": true - } - ] + "install": [ + { + "name": "domain", + "type": "domain" + }, + { + "name": "password", + "type": "password", + "optional": true + } + ] } } diff --git a/scripts/backup b/scripts/backup index 9520570..86f6ba7 100755 --- a/scripts/backup +++ b/scripts/backup @@ -42,6 +42,12 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" +#================================================= +# BACKUP THE DATA DIR +#================================================= + +ynh_backup --src_path="$datadir" --is_big + #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= @@ -54,12 +60,6 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/systemd/system/$app.service" -#================================================= -# BACKUP VARIOUS FILES -#================================================= - -ynh_backup --src_path="$datadir" --is_big - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index acb9f1c..eac7fc6 100755 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - true + ynh_clean_check_starting } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -28,7 +28,6 @@ path_url="/" password=$YNH_APP_ARG_PASSWORD app=$YNH_APP_INSTANCE_NAME -datadir="/home/yunohost.app/${app}" #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS @@ -48,7 +47,6 @@ ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=datadir --value=$datadir ynh_app_setting_set --app=$app --key=password --value=$password #================================================= @@ -60,11 +58,12 @@ ynh_script_progression --message="Finding an available port..." # Find an available port port=$(ynh_find_port --port=43110) -fs_port=$(ynh_find_port --port=15441) ynh_app_setting_set --app=$app --key=port --value=$port +fs_port=$(ynh_find_port --port=15441) ynh_app_setting_set --app=$app --key=fs_port --value=$fs_port # Open the port +ynh_script_progression --message="Configuring firewall..." ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $fs_port #================================================= @@ -80,7 +79,7 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Configuring system user..." # Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -117,10 +116,12 @@ pushd "$final_path" popd #================================================= -# CREATE DATA DIR +# CREATE DATA DIRECTORY #================================================= -ynh_script_progression --message="Creating data directory..." +ynh_script_progression --message="Creating a data directory..." +datadir=/home/yunohost.app/$app +ynh_app_setting_set --app=$app --key=datadir --value=$datadir mkdir -p $datadir/data mkdir -p $datadir/log diff --git a/scripts/remove b/scripts/remove index 0146fdd..e2676f1 100755 --- a/scripts/remove +++ b/scripts/remove @@ -43,14 +43,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - #================================================= # REMOVE APP MAIN DIR #================================================= @@ -78,6 +70,14 @@ 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_app_dependencies + #================================================= # CLOSE A PORT #================================================= diff --git a/scripts/restore b/scripts/restore index e043798..297c023 100755 --- a/scripts/restore +++ b/scripts/restore @@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - true + ynh_clean_check_starting } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -44,20 +44,13 @@ test ! -d $final_path \ #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RECREATE THE DEDICATED USER #================================================= ynh_script_progression --message="Recreating the dedicated system user..." # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$final_path +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # RESTORE THE APP MAIN DIR @@ -65,10 +58,24 @@ ynh_system_user_create --username=$app --home_dir=$final_path ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" + chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" +#================================================= +# RESTORE THE DATA DIRECTORY +#================================================= +ynh_script_progression --message="Restoring the data directory..." + +ynh_restore_file --origin_path="$datadir" --not_mandatory + +mkdir -p $datadir + +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R $app:$app "$datadir" + #================================================= # SPECIFIC RESTORATION #================================================= @@ -79,6 +86,13 @@ ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies +#================================================= +# 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" + #================================================= # BUILDING ZERONET #================================================= @@ -90,20 +104,6 @@ pushd "$final_path" venv/bin/pip install -r requirements.txt popd -#================================================= -# RESTORE VARIOUS FILES -#================================================= -ynh_script_progression --message="Restoring various files..." - -# Restore permissions on app files -ynh_restore_file --origin_path="$datadir" --not_mandatory - -mkdir -p "$datadir" - -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:$app "$datadir" - #================================================= # RESTORE SYSTEMD #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 93cddb7..270e284 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -27,6 +27,7 @@ password=$(ynh_app_setting_get --app=$app --key=password) #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) @@ -38,7 +39,8 @@ ynh_script_progression --message="Backing up the app before upgrading (may take # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { - # restore it if the upgrade fails + ynh_clean_check_starting + # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script @@ -77,7 +79,7 @@ fi 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 +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -96,6 +98,13 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." + +ynh_install_app_dependencies $pkg_dependencies + #================================================= # NGINX CONFIGURATION #================================================= @@ -104,13 +113,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." - -ynh_install_app_dependencies $pkg_dependencies - #================================================= # SPECIFIC UPGRADE #=================================================