1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/zeronet_ynh.git synced 2024-09-03 17:46:12 +02:00

Upgrade to v.0.7.1

This commit is contained in:
ericgaspar 2020-10-22 21:15:55 +02:00
parent 39c6bdd601
commit 33e6d5c4a6
No known key found for this signature in database
GPG key ID: 574F281483054D44
9 changed files with 106 additions and 62 deletions

View file

@ -2,6 +2,24 @@
[![Integration level](https://dash.yunohost.org/integration/zeronet.svg)](https://dash.yunohost.org/appci/app/zeronet) ![](https://ci-apps.yunohost.org/ci/badges/zeronet.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/zeronet.maintain.svg)
[![Install ZeroNet with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=zeronet)
*[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install REPLACEBYYOURAPP quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview
eroNet allows you to publish static and dynamic websites on a distributed web platform.
**Shipped version:** 0.7.1
## Screenshots
![](https://camo.githubusercontent.com/4629a7d44a828f5bb20cedd90522ae62f0947b35/68747470733a2f2f692e696d6775722e636f6d2f4836304f4148592e706e67)
## Demo
* [Official demo](Link to a demo site for this app.)
## Install
- 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`.
- The app is installed in private mode only so unauthenticated users can not temper with your content.
@ -12,8 +30,34 @@
- Installing multiple instances of the app is *experimental*. Internally each instance it will use a 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.
- A solution that hasn't been confirmed yet is to use Tor instead. Each instance should then have a unique external address.
## Hint
- Use at your own risk :-)
## Documentation
* Official documentation: https://zeronet.io/docs/site_development/getting_started/
* YunoHost documentation: If specific documentation is needed, feel free to contribute.
## YunoHost specific features
#### Multi-user support
Are LDAP and HTTP auth supported?
Can the app be used by multiple users?
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/REPLACEBYYOURAPP%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/REPLACEBYYOURAPP/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/REPLACEBYYOURAPP%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/REPLACEBYYOURAPP/)
## Limitations
* Any known limitations.
## Additional information
* Other info you would like to add about this app.
**More info on the documentation page:**
https://yunohost.org/packaging_apps
## Links

View file

@ -1,3 +1,3 @@
SOURCE_URL=https://github.com/HelloZeroNet/ZeroNet/archive/v0.6.2.tar.gz
SOURCE_SUM=d07aa18ca81ca30be9a118dfb845bbaeca6551b13672e6d87851f3544f9d7f2f
SOURCE_VERSION=0.6.2
SOURCE_URL=https://github.com/HelloZeroNet/ZeroNet/archive/v0.7.1.tar.gz
SOURCE_SUM=78a27e1687d8e3699a854b77b516c95b30a8ba667f7ebbef0aabf7ec6ec7272d
SOURCE_VERSION=0.7.1

View file

@ -4,17 +4,17 @@
"packaging_format": 1,
"description": {
"en": "Decentralized websites using Bitcoin crypto and BitTorrent network",
"fr": "Decentralized websites using Bitcoin crypto and BitTorrent network"
"fr": "Sites Web décentralisés utilisant la crypto Bitcoin et le réseau BitTorrent"
},
"version": "0.7.1~ynh1",
"url": "https://zeronet.io",
"license": "AGPL-3.0",
"version": "0.6.0",
"maintainer": {
"name": "whypsi",
"email": "whypsi@riseup.net"
},
"requirements": {
"yunohost": ">> 2.4.0"
"yunohost": ">> 3.8.1"
},
"multi_instance": true,
"services": [
@ -26,8 +26,8 @@
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a sub domain name for ynhexample",
"fr": "Choisissez un nom de domaine pour ynhexample"
"en": "Choose a sub domain name for ZeroNet",
"fr": "Choisissez un nom de domaine pour ZeroNet"
},
"example": "zeronet.domain.tld"
},

View file

@ -15,7 +15,7 @@ main() {
ynh_backup $deploy_path "sources"
sudo mkdir --parent ./conf
mkdir --parent ./conf
ynh_backup $nginx_config_file "conf/nginx.conf"
ynh_backup $systemd_service_file "conf/${systemd_service_name}"
ynh_backup $user_zeronet_dir "conf/.zeronet"

View file

@ -3,7 +3,7 @@
set -eu
install_dependencies() {
sudo apt-get install --quiet --yes python-msgpack python-gevent
apt-get install --quiet --yes python-msgpack python-gevent
}
app_config_get() {
@ -40,8 +40,8 @@ extract_archive() {
local src_file=$1
local deploy_path=$2
sudo mkdir --parents ${deploy_path}
sudo tar --extract --file=${src_file} --directory=${deploy_path} --overwrite --strip-components 1
mkdir --parents ${deploy_path}
tar --extract --file=${src_file} --directory=${deploy_path} --overwrite --strip-components 1
}
obtain_and_deploy_source() {
@ -57,9 +57,9 @@ obtain_and_deploy_source() {
check_file_integrity $src_file $src_checksum
extract_archive $src_file $deploy_path
sudo rm -f $symlink_to_deploy_path
sudo ln --symbolic --force $deploy_path $symlink_to_deploy_path
rm -f $symlink_to_deploy_path
ln --symbolic --force $deploy_path $symlink_to_deploy_path
sudo chown $user: -LR $symlink_to_deploy_path
sudo chown $user: -h $symlink_to_deploy_path
chown $user: -LR $symlink_to_deploy_path
chown $user: -h $symlink_to_deploy_path
}

View file

@ -7,7 +7,7 @@ nginx_config_file() {
local app=$1
local domain=$2
sudo mkdir --parents "/etc/nginx/conf.d/${domain}.d"
mkdir --parents "/etc/nginx/conf.d/${domain}.d"
echo "/etc/nginx/conf.d/${domain}.d/${app}.conf"
}
@ -19,12 +19,12 @@ update_nginx_configuration() {
local path=$4
local ui_port=$5
sudo cp $config_template $config_file
cp $config_template $config_file
sudo sed --in-place "s@YNH_WWW_PATH@${path}@g" ${config_file}
sudo sed --in-place "s@YNH_LOCAL_PORT@${ui_port}/@g" ${config_file}
sed --in-place "s@YNH_WWW_PATH@${path}@g" ${config_file}
sed --in-place "s@YNH_LOCAL_PORT@${ui_port}/@g" ${config_file}
sudo service nginx reload
service nginx reload
}
systemd_service_name() {
@ -55,25 +55,25 @@ update_systemd_configuration() {
local data_dir=$zeronet_dir/data
local log_dir=$zeronet_dir/log
sudo mkdir -p $data_dir
sudo mkdir -p $log_dir
sudo chown -R $user: $zeronet_dir
mkdir -p $data_dir
mkdir -p $log_dir
chown -R $user: $zeronet_dir
# configure systemd service
sudo cp $service_template $service_file
cp $service_template $service_file
sudo sed --in-place "s@__USER__@$user@g" $service_file
sudo sed --in-place "s@__UI_PORT__@$ui_port@g" $service_file
sudo sed --in-place "s@__FS_PORT__@$fs_port@g" $service_file
sudo sed --in-place "s@__UI_HOST__@$ui_host@g" $service_file
sudo sed --in-place "s@__APP_NAME__@$app@g" $service_file
sudo sed --in-place "s@__WORKING_DIRECTORY__@$symlink_to_deploy_path@g" $service_file
sudo sed --in-place "s@__DATA_DIR__@$data_dir@g" $service_file
sudo sed --in-place "s@__LOG_DIR__@$log_dir@g" $service_file
sed --in-place "s@__USER__@$user@g" $service_file
sed --in-place "s@__UI_PORT__@$ui_port@g" $service_file
sed --in-place "s@__FS_PORT__@$fs_port@g" $service_file
sed --in-place "s@__UI_HOST__@$ui_host@g" $service_file
sed --in-place "s@__APP_NAME__@$app@g" $service_file
sed --in-place "s@__WORKING_DIRECTORY__@$symlink_to_deploy_path@g" $service_file
sed --in-place "s@__DATA_DIR__@$data_dir@g" $service_file
sed --in-place "s@__LOG_DIR__@$log_dir@g" $service_file
sudo systemctl daemon-reload
sudo systemctl enable $service_name
sudo systemctl start $service_name
systemctl daemon-reload
systemctl enable $service_name
systemctl start $service_name
}
# Source: https://github.com/YunoHost/yunohost/blob/901e3df9b604f542f2c460aad05bcc8efc9fd054/data/helpers.d/network

View file

@ -7,32 +7,32 @@ remove_systemd_service_() {
local service_name=$1
local service_file=$2
sudo systemctl stop $service_name
sudo systemctl disable $service_name
sudo rm $service_file
sudo systemctl daemon-reload
sudo systemctl reset-failed
systemctl stop $service_name
systemctl disable $service_name
rm $service_file
systemctl daemon-reload
systemctl reset-failed
}
remove_nginx_config() {
local nginx_config_file=$1
sudo rm -rf $nginx_config_file
sudo service nginx reload
ynh_secure_remove $nginx_config_file
service nginx reload
}
remove_user_data() {
local user_zeronet_dir=$1
sudo rm -rf $user_zeronet_dir
ynh_secure_remove $user_zeronet_dir
}
remove_zeronet() {
local deploy_path=$1
local symlink_to_deploy_path=$2
sudo rm -rf $deploy_path
sudo rm -rf $symlink_to_deploy_path
ynh_secure_remove $deploy_path
ynh_secure_remove $symlink_to_deploy_path
}
main() {

View file

@ -7,7 +7,7 @@ source /usr/share/yunohost/helpers
# TODO: remove with fix of https://github.com/YunoHost/yunohost/pull/246
install_dependencies() {
sudo apt-get install --quiet --yes python-msgpack python-gevent
apt-get install --quiet --yes python-msgpack python-gevent
}
is_app_restorable() {
@ -42,20 +42,20 @@ main() {
install_dependencies
sudo cp -a "./sources" $deploy_path
sudo ln --symbolic --force $deploy_path $symlink_to_deploy_path
sudo chown $user: -LR $symlink_to_deploy_path
sudo chown $user: -h $symlink_to_deploy_path
cp -a "./sources" $deploy_path
ln --symbolic --force $deploy_path $symlink_to_deploy_path
chown $user: -LR $symlink_to_deploy_path
chown $user: -h $symlink_to_deploy_path
sudo rm -rf $user_zeronet_dir
sudo cp -aR "./conf/.zeronet" $user_zeronet_dir
sudo chown -R $user: $user_zeronet_dir
ynh_secure_remove $user_zeronet_dir
cp -aR "./conf/.zeronet" $user_zeronet_dir
chown -R $user: $user_zeronet_dir
sudo cp -a "./conf/nginx.conf" $nginx_config_file
sudo service nginx reload
cp -a "./conf/nginx.conf" $nginx_config_file
service nginx reload
sudo cp -a "./conf/${systemd_service_name}" $systemd_service_file
sudo systemctl restart $systemd_service_name
cp -a "./conf/${systemd_service_name}" $systemd_service_file
systemctl restart $systemd_service_name
}
main

View file

@ -20,13 +20,13 @@ main() {
obtain_and_deploy_source $app_config $new_deploy_path $symlink_to_deploy_path $user
sudo systemctl restart $systemd_service_name
systemctl restart $systemd_service_name
ynh_app_setting_set $app installed_version $source_version
ynh_app_setting_set $app deploy_path $new_deploy_path
if [ $new_deploy_path != $old_deploy_path ]; then
sudo rm -rf $old_deploy_path
ynh_secure_remove $old_deploy_path
fi
}