2016-08-20 02:31:08 +02:00
|
|
|
#/bin/bash
|
|
|
|
|
|
|
|
INSTALL_DUNITER_DEBIAN_PACKAGE () {
|
2020-03-29 12:43:14 +02:00
|
|
|
url_base="https://git.duniter.org/nodes/typescript/duniter/"
|
2018-11-29 17:32:21 +01:00
|
|
|
if [ $arch == "x64" ]; then
|
2021-01-20 20:11:05 +01:00
|
|
|
version="v1.8.1"
|
2021-01-19 21:13:03 +01:00
|
|
|
mid_url="-/jobs/40430/artifacts/raw/work/bin/"
|
2018-11-29 17:32:21 +01:00
|
|
|
else
|
2021-01-20 20:11:05 +01:00
|
|
|
version="v1.8.0"
|
2020-06-21 12:33:25 +02:00
|
|
|
mid_url="uploads/afe00e6e6cb318fbdbb977d8c73f4645/"
|
2018-11-29 17:32:21 +01:00
|
|
|
fi
|
2018-12-18 23:22:06 +01:00
|
|
|
|
|
|
|
deb="duniter-server-$version-linux-$arch.deb"
|
2020-03-29 12:43:14 +02:00
|
|
|
url="${url_base}${mid_url}${deb}"
|
2018-11-29 17:32:21 +01:00
|
|
|
|
|
|
|
# Retrieve debian package and install it
|
|
|
|
wget -nc --quiet $url -P /tmp
|
|
|
|
deb_path="/tmp/$deb"
|
|
|
|
dpkg -i $deb_path > /dev/null
|
|
|
|
rm -f $deb_path
|
2016-08-20 02:31:08 +02:00
|
|
|
}
|
|
|
|
|
2018-11-29 17:46:37 +01:00
|
|
|
INSTALL_SYSTEMD () {
|
|
|
|
cp ../conf/duniter.service /etc/systemd/system/duniter.service
|
|
|
|
systemctl enable duniter.service
|
|
|
|
}
|
|
|
|
|
2018-03-13 19:36:50 +01:00
|
|
|
CONFIGURE_DUNITER () {
|
2020-12-12 13:39:32 +01:00
|
|
|
duniter config --bma --ipv4 127.0.0.1 --port $port --remoteh $domain --remotep 443 --noupnp
|
2018-11-29 17:03:39 +01:00
|
|
|
duniter config --ws2p-host 127.0.0.1 --ws2p-port 20901 --ws2p-remote-host $domain --ws2p-remote-port 443 --ws2p-noupnp
|
2018-03-13 19:36:50 +01:00
|
|
|
}
|
|
|
|
|
2021-04-01 22:05:49 +02:00
|
|
|
CONFIG_PERMISSIONS () {
|
|
|
|
# Remove deprecated permission system settings to remove their effects
|
2021-04-18 18:51:27 +02:00
|
|
|
if ynh_legacy_permissions_exists; then
|
|
|
|
ynh_legacy_permissions_delete_all
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Protect senstive sub-routes to Duniter web admin interface, give access to choosen admin
|
|
|
|
if ! ynh_permission_exists --permission="admin"; then
|
|
|
|
ynh_permission_create --permission "admin" --url "/webui" --additional_urls "/webmin" --allowed "$admin" --label "Administration" --show_tile=true
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Set BMA and WS2P APIs accessible to visitors
|
|
|
|
if ! ynh_permission_exists --permission="apis"; then
|
|
|
|
ynh_permission_create --permission="apis" --url="/" --allowed="visitors" --show_tile=false --protected=true
|
2021-04-01 22:05:49 +02:00
|
|
|
fi
|
2016-08-20 02:31:08 +02:00
|
|
|
}
|
|
|
|
|
2017-03-14 09:41:28 +01:00
|
|
|
CONFIG_NGINX () {
|
2018-11-29 17:32:21 +01:00
|
|
|
nginx_conf="../conf/nginx.conf"
|
|
|
|
sed -i "s@YNH_EXAMPLE_PORT@$port@" $nginx_conf
|
|
|
|
sed -i "s@YNH_EXAMPLE_DOMAIN@$domain@" $nginx_conf
|
|
|
|
cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
|
2020-06-29 18:06:53 +02:00
|
|
|
systemctl reload nginx
|
2016-08-20 02:31:08 +02:00
|
|
|
}
|
2017-03-31 11:33:59 +02:00
|
|
|
|
|
|
|
REMOVE_DUNITER () {
|
2020-06-29 18:13:30 +02:00
|
|
|
# Stop duniter daemon
|
|
|
|
systemctl stop duniter
|
2018-11-29 17:32:21 +01:00
|
|
|
|
|
|
|
# Remove Duniter package
|
|
|
|
dpkg -r duniter
|
2017-03-31 11:33:59 +02:00
|
|
|
}
|