mirror of
https://github.com/YunoHost-Apps/duniter_ynh.git
synced 2024-09-03 18:26:35 +02:00
Merge pull request #57 from c-geek/cesium_and_sync
[fix] #53 and #55 Cesium and sync
This commit is contained in:
commit
de988df2c7
4 changed files with 3 additions and 58 deletions
|
@ -31,24 +31,6 @@
|
||||||
},
|
},
|
||||||
"example": "duniter.domain.tld"
|
"example": "duniter.domain.tld"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "sync_node",
|
|
||||||
"ask": {
|
|
||||||
"en": "Node's address (domain name or IP address) to synchronise with",
|
|
||||||
"fr": "Adresse du nœud (nom de domaine ou adresse IP) avec lequel se synchroniser"
|
|
||||||
},
|
|
||||||
"example": "duniter.org",
|
|
||||||
"default": "duniter.org"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "sync_port",
|
|
||||||
"ask": {
|
|
||||||
"en": "Port of synchronization",
|
|
||||||
"fr": "Port de synchronisation"
|
|
||||||
},
|
|
||||||
"example": "10901",
|
|
||||||
"default": "10901"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
"type": "user",
|
"type": "user",
|
||||||
|
@ -57,15 +39,6 @@
|
||||||
"fr": "Administrateur. Ce doit être un utilisateur YunoHost"
|
"fr": "Administrateur. Ce doit être un utilisateur YunoHost"
|
||||||
},
|
},
|
||||||
"example": "jon doe"
|
"example": "jon doe"
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "is_cesium_public",
|
|
||||||
"ask": {
|
|
||||||
"en": "Make Cesium available publicly?",
|
|
||||||
"fr": "Permettre à Cesium d'être consulté publiquement ?"
|
|
||||||
},
|
|
||||||
"choices": ["Yes", "No"],
|
|
||||||
"default": "Yes"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,26 +10,14 @@ wget -nc --quiet $url -P /tmp
|
||||||
deb="/tmp/duniter-server-$version-linux-$arch.deb"
|
deb="/tmp/duniter-server-$version-linux-$arch.deb"
|
||||||
sudo dpkg -i $deb > /dev/null
|
sudo dpkg -i $deb > /dev/null
|
||||||
sudo rm -f $deb
|
sudo rm -f $deb
|
||||||
|
|
||||||
# Patch Cesium to access local instance
|
|
||||||
# Note by cgeek: Cesium has been removed from Duniter since v1.3
|
|
||||||
# cesium_conf="/opt/duniter/sources/node_modules/duniter-ui/public/cesium/config.js"
|
|
||||||
# sudo sed -i "s@\"host\".*@\"host\": \"$domain\",@" $cesium_conf
|
|
||||||
# sudo sed -i "s@\"port\".*@\"port\": \"443\"@" $cesium_conf
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CONFIG_SSOWAT () {
|
CONFIG_SSOWAT () {
|
||||||
# Add admin to the allowed users
|
# Add admin to the allowed users
|
||||||
sudo yunohost app addaccess $app -u $admin
|
sudo yunohost app addaccess $app -u $admin
|
||||||
|
|
||||||
# Allow only allowed users to access admin panel
|
# Protect senstive sub-routes
|
||||||
if [ "$is_cesium_public" = "Yes" ]; then
|
|
||||||
# Cesium is public, do not protect it
|
|
||||||
ynh_app_setting_set "$app" protected_uris "/webui","/webmin","/modules"
|
ynh_app_setting_set "$app" protected_uris "/webui","/webmin","/modules"
|
||||||
else
|
|
||||||
# Cesium is not public, protect it
|
|
||||||
ynh_app_setting_set "$app" protected_uris "/webui","/webmin","/modules","/cesium"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Duniter is public app, with only some parts restricted in nginx.conf
|
# Duniter is public app, with only some parts restricted in nginx.conf
|
||||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
ynh_app_setting_set "$app" unprotected_uris "/"
|
||||||
|
|
|
@ -8,10 +8,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path="/"
|
path="/"
|
||||||
port=10901
|
port=10901
|
||||||
sync_node=$YNH_APP_ARG_SYNC_NODE
|
|
||||||
sync_port=$YNH_APP_ARG_SYNC_PORT
|
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
is_cesium_public=$YNH_APP_ARG_IS_CESIUM_PUBLIC
|
|
||||||
|
|
||||||
# Source app helpers and functions
|
# Source app helpers and functions
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
@ -27,13 +24,6 @@ if [[ ! $? -eq 0 ]]; then
|
||||||
ynh_die "Port not available: ${port}"
|
ynh_die "Port not available: ${port}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check node availability
|
|
||||||
if curl --output /dev/null --silent --head --fail "$sync_node:$sync_port/node/summary"; then
|
|
||||||
echo "Node $sync_node:$sync_port is available"
|
|
||||||
else
|
|
||||||
ynh_die "Node $sync_node:$sync_port is not available" 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check the admin exists in YunoHost users
|
# Check the admin exists in YunoHost users
|
||||||
ynh_user_exists $admin
|
ynh_user_exists $admin
|
||||||
|
|
||||||
|
@ -50,7 +40,6 @@ fi
|
||||||
ynh_app_setting_set $app port $port
|
ynh_app_setting_set $app port $port
|
||||||
ynh_app_setting_set $app arch $arch
|
ynh_app_setting_set $app arch $arch
|
||||||
ynh_app_setting_set "$app" admin "$admin"
|
ynh_app_setting_set "$app" admin "$admin"
|
||||||
ynh_app_setting_set "$app" is_cesium_public "$is_cesium_public"
|
|
||||||
|
|
||||||
# Open port on firewall
|
# Open port on firewall
|
||||||
sudo yunohost firewall allow TCP $port > /dev/null 2>&1
|
sudo yunohost firewall allow TCP $port > /dev/null 2>&1
|
||||||
|
@ -64,10 +53,6 @@ sudo duniter config --addep "BMAS $domain 443"
|
||||||
# Reset Duniter node's existing data (blockchain, not conf)
|
# Reset Duniter node's existing data (blockchain, not conf)
|
||||||
sudo duniter reset data > /dev/null
|
sudo duniter reset data > /dev/null
|
||||||
|
|
||||||
# Synchronize Duniter node
|
|
||||||
echo "Synchronizing with $sync_node:$sync_port. It may take a while."
|
|
||||||
sudo duniter sync $sync_node $sync_port --nointeractive > /dev/null
|
|
||||||
|
|
||||||
# Launch Duniter node
|
# Launch Duniter node
|
||||||
sudo duniter webstart
|
sudo duniter webstart
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ domain=$(ynh_app_setting_get "$app" domain)
|
||||||
port=$(ynh_app_setting_get "$app" port)
|
port=$(ynh_app_setting_get "$app" port)
|
||||||
arch=$(ynh_app_setting_get "$app" arch)
|
arch=$(ynh_app_setting_get "$app" arch)
|
||||||
admin=$(ynh_app_setting_get "$app" admin)
|
admin=$(ynh_app_setting_get "$app" admin)
|
||||||
is_cesium_public=$(ynh_app_setting_get "$app" is_cesium_public)
|
|
||||||
|
|
||||||
REMOVE_DUNITER
|
REMOVE_DUNITER
|
||||||
INSTALL_DUNITER_DEBIAN_PACKAGE
|
INSTALL_DUNITER_DEBIAN_PACKAGE
|
||||||
|
|
Loading…
Add table
Reference in a new issue