mirror of
https://github.com/YunoHost-Apps/zeronet_ynh.git
synced 2024-09-03 17:46:12 +02:00
Apply example_ynh
This commit is contained in:
parent
08cd40f76b
commit
cae2b504c1
14 changed files with 110 additions and 88 deletions
|
@ -14,9 +14,8 @@
|
||||||
upgrade=1 from_commit=628e89b0536a3c1ff7e5f9d903527b670690b336
|
upgrade=1 from_commit=628e89b0536a3c1ff7e5f9d903527b670690b336
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
|
port_already_use=0
|
||||||
|
change_url=0
|
||||||
;;; Options
|
;;; Options
|
||||||
Email=
|
Email=
|
||||||
Notification=none
|
Notification=none
|
||||||
;;; Upgrade options
|
|
||||||
; commit=628e89b0536a3c1ff7e5f9d903527b670690b336
|
|
||||||
name=0.7.1~ynh1
|
|
||||||
|
|
|
@ -3,4 +3,5 @@ SOURCE_SUM=9286971422470cedb8ca5f6675863816bf3f05f0769842a1bdc12f85fc594938
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=tar.gz
|
SOURCE_FORMAT=tar.gz
|
||||||
SOURCE_IN_SUBDIR=true
|
SOURCE_IN_SUBDIR=true
|
||||||
|
SOURCE_FILENAME=
|
||||||
SOURCE_EXTRACT=true
|
SOURCE_EXTRACT=true
|
||||||
|
|
|
@ -3,9 +3,10 @@ Description=__APP__ service
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__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__
|
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
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
KillMode=process
|
KillMode=process
|
||||||
|
|
0
doc/.gitkeep
Normal file
0
doc/.gitkeep
Normal file
1
doc/DESCRIPTION.md
Normal file
1
doc/DESCRIPTION.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
ZeroNet allows you to publish static and dynamic websites on a distributed web platform using Bitcoin crypto and the BitTorrent network.
|
11
doc/DISCLAIMER.md
Normal file
11
doc/DISCLAIMER.md
Normal file
|
@ -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).
|
0
doc/screenshots/.gitkeep
Normal file
0
doc/screenshots/.gitkeep
Normal file
BIN
doc/screenshots/screenshot.png
Normal file
BIN
doc/screenshots/screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 145 KiB |
|
@ -1,36 +1,42 @@
|
||||||
{
|
{
|
||||||
"name": "ZeroNet",
|
"name": "ZeroNet",
|
||||||
"id": "zeronet",
|
"id": "zeronet",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
"description": {
|
"description": {
|
||||||
"en": "Decentralized websites using Bitcoin crypto and BitTorrent network",
|
"en": "Decentralized websites using Bitcoin crypto and BitTorrent network",
|
||||||
"fr": "Sites Web décentralisés utilisant la crypto Bitcoin et le réseau BitTorrent"
|
"fr": "Sites Web décentralisés utilisant la crypto Bitcoin et le réseau BitTorrent"
|
||||||
},
|
},
|
||||||
"version": "2021.01.25~ynh1",
|
"version": "2021.01.25~ynh1",
|
||||||
"url": "https://zeronet.io",
|
"url": "https://zeronet.io",
|
||||||
"license": "AGPL-3.0",
|
"upstream": {
|
||||||
"maintainer": {
|
"license": "AGPL-3.0",
|
||||||
"name": "whypsi",
|
"website": "https://zeronet.io",
|
||||||
"email": "whypsi@riseup.net"
|
"admindoc": "https://zeronet.io/docs/",
|
||||||
},
|
"code": "https://github.com/HelloZeroNet/ZeroNet"
|
||||||
"requirements": {
|
},
|
||||||
"yunohost": ">= 4.3.0"
|
"license": "AGPL-3.0",
|
||||||
},
|
"maintainer": {
|
||||||
"multi_instance": true,
|
"name": "whypsi",
|
||||||
"services": [
|
"email": "whypsi@riseup.net"
|
||||||
"nginx"
|
},
|
||||||
|
"requirements": {
|
||||||
|
"yunohost": ">= 4.3.0"
|
||||||
|
},
|
||||||
|
"multi_instance": true,
|
||||||
|
"services": [
|
||||||
|
"nginx"
|
||||||
],
|
],
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"install" : [
|
"install": [
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain"
|
"type": "domain"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "password",
|
"name": "password",
|
||||||
"type": "password",
|
"type": "password",
|
||||||
"optional": true
|
"optional": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,12 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
|
|
||||||
ynh_backup --src_path="$final_path"
|
ynh_backup --src_path="$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP THE DATA DIR
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup --src_path="$datadir" --is_big
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# 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"
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP VARIOUS FILES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="$datadir" --is_big
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
true
|
ynh_clean_check_starting
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
@ -28,7 +28,6 @@ path_url="/"
|
||||||
password=$YNH_APP_ARG_PASSWORD
|
password=$YNH_APP_ARG_PASSWORD
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
datadir="/home/yunohost.app/${app}"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# 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=domain --value=$domain
|
||||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
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
|
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
|
# Find an available port
|
||||||
port=$(ynh_find_port --port=43110)
|
port=$(ynh_find_port --port=43110)
|
||||||
fs_port=$(ynh_find_port --port=15441)
|
|
||||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
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
|
ynh_app_setting_set --app=$app --key=fs_port --value=$fs_port
|
||||||
|
|
||||||
# Open the port
|
# Open the port
|
||||||
|
ynh_script_progression --message="Configuring firewall..."
|
||||||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $fs_port
|
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..."
|
ynh_script_progression --message="Configuring system user..."
|
||||||
|
|
||||||
# Create a 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
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
@ -117,10 +116,12 @@ pushd "$final_path"
|
||||||
popd
|
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/data
|
||||||
mkdir -p $datadir/log
|
mkdir -p $datadir/log
|
||||||
|
|
||||||
|
|
|
@ -43,14 +43,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
|
||||||
# Remove the dedicated systemd config
|
# Remove the dedicated systemd config
|
||||||
ynh_remove_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
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -78,6 +70,14 @@ ynh_script_progression --message="Removing NGINX web server configuration..."
|
||||||
# Remove the dedicated NGINX config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_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
|
# CLOSE A PORT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
true
|
ynh_clean_check_starting
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
@ -44,20 +44,13 @@ test ! -d $final_path \
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# 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
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Recreating the dedicated system user..."
|
ynh_script_progression --message="Recreating the dedicated system user..."
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
# 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
|
# 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_script_progression --message="Restoring the app main directory..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
ynh_restore_file --origin_path="$final_path"
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:$app "$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
|
# SPECIFIC RESTORATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -79,6 +86,13 @@ ynh_script_progression --message="Reinstalling dependencies..."
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies $pkg_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
|
# BUILDING ZERONET
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -90,20 +104,6 @@ pushd "$final_path"
|
||||||
venv/bin/pip install -r requirements.txt
|
venv/bin/pip install -r requirements.txt
|
||||||
popd
|
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
|
# RESTORE SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -27,6 +27,7 @@ password=$(ynh_app_setting_get --app=$app --key=password)
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Checking version..."
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
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
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
# restore it if the upgrade fails
|
ynh_clean_check_starting
|
||||||
|
# Restore it if the upgrade fails
|
||||||
ynh_restore_upgradebackup
|
ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# 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..."
|
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
# 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
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
@ -96,6 +98,13 @@ chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:$app "$final_path"
|
chown -R $app:$app "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPGRADE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading dependencies..."
|
||||||
|
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -104,13 +113,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPGRADE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading dependencies..."
|
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue