mirror of
https://github.com/YunoHost-Apps/duniter_ynh.git
synced 2024-09-03 18:26:35 +02:00
[enh] #21: set Duniter as a systemd service
- use 'systemctl' instead of 'service'
This commit is contained in:
parent
dd621637d4
commit
4803879f5c
5 changed files with 30 additions and 4 deletions
16
conf/duniter.service
Normal file
16
conf/duniter.service
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Duniter node
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Environment="DUNITER_WEB=web"
|
||||||
|
Group=root
|
||||||
|
User=root
|
||||||
|
Type=forking
|
||||||
|
ExecStart=/usr/bin/duniter ${DUNITER_WEB}start
|
||||||
|
ExecReload=/usr/bin/duniter ${DUNITER_WEB}restart
|
||||||
|
ExecStop=/usr/bin/duniter stop
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -19,6 +19,11 @@ INSTALL_DUNITER_DEBIAN_PACKAGE () {
|
||||||
rm -f $deb_path
|
rm -f $deb_path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INSTALL_SYSTEMD () {
|
||||||
|
cp ../conf/duniter.service /etc/systemd/system/duniter.service
|
||||||
|
systemctl enable duniter.service
|
||||||
|
}
|
||||||
|
|
||||||
CONFIGURE_DUNITER () {
|
CONFIGURE_DUNITER () {
|
||||||
duniter config --ipv4 127.0.0.1 --port $port --remoteh $domain --remotep 80 --noupnp
|
duniter config --ipv4 127.0.0.1 --port $port --remoteh $domain --remotep 80 --noupnp
|
||||||
duniter config --addep "BMAS $domain 443"
|
duniter config --addep "BMAS $domain 443"
|
||||||
|
@ -51,7 +56,7 @@ REMOVE_DUNITER () {
|
||||||
# Stop duniter daemon if running
|
# Stop duniter daemon if running
|
||||||
duniter status
|
duniter status
|
||||||
if [ `echo "$?"` == 0 ]; then
|
if [ `echo "$?"` == 0 ]; then
|
||||||
duniter stop
|
systemctl stop duniter
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove Duniter package
|
# Remove Duniter package
|
||||||
|
|
|
@ -45,13 +45,14 @@ ynh_app_setting_set "$app" admin "$admin"
|
||||||
yunohost firewall allow TCP $port > /dev/null 2>&1
|
yunohost firewall allow TCP $port > /dev/null 2>&1
|
||||||
|
|
||||||
INSTALL_DUNITER_DEBIAN_PACKAGE
|
INSTALL_DUNITER_DEBIAN_PACKAGE
|
||||||
|
INSTALL_SYSTEMD
|
||||||
CONFIGURE_DUNITER
|
CONFIGURE_DUNITER
|
||||||
|
|
||||||
# Reset Duniter node's existing data (blockchain, not conf)
|
# Reset Duniter node's existing data (blockchain, not conf)
|
||||||
duniter reset data > /dev/null
|
duniter reset data > /dev/null
|
||||||
|
|
||||||
# Launch Duniter node
|
# Launch Duniter node
|
||||||
duniter webstart
|
systemctl start duniter
|
||||||
|
|
||||||
# Add Duniter service to the YunoHost monitoring
|
# Add Duniter service to the YunoHost monitoring
|
||||||
yunohost service add $app --log /root/.config/$app/"$app"_default/"$app".log
|
yunohost service add $app --log /root/.config/$app/"$app"_default/"$app".log
|
||||||
|
|
|
@ -13,6 +13,9 @@ port=$(ynh_app_setting_get $app port)
|
||||||
|
|
||||||
REMOVE_DUNITER
|
REMOVE_DUNITER
|
||||||
|
|
||||||
|
# Disable systemd service
|
||||||
|
systemctl disable duniter.service
|
||||||
|
|
||||||
# Remove data and conf
|
# Remove data and conf
|
||||||
rm -rf /root/.conf/duniter
|
rm -rf /root/.conf/duniter
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,11 @@ admin=$(ynh_app_setting_get "$app" admin)
|
||||||
|
|
||||||
REMOVE_DUNITER
|
REMOVE_DUNITER
|
||||||
INSTALL_DUNITER_DEBIAN_PACKAGE
|
INSTALL_DUNITER_DEBIAN_PACKAGE
|
||||||
|
INSTALL_SYSTEMD
|
||||||
CONFIGURE_DUNITER
|
CONFIGURE_DUNITER
|
||||||
|
|
||||||
# Start duniter daemon
|
# Start duniter service
|
||||||
duniter webstart
|
systemctl start duniter
|
||||||
|
|
||||||
CONFIG_SSOWAT
|
CONFIG_SSOWAT
|
||||||
CONFIG_NGINX
|
CONFIG_NGINX
|
||||||
|
|
Loading…
Reference in a new issue