mirror of
https://github.com/YunoHost-Apps/duniter_ynh.git
synced 2024-09-03 18:26:35 +02:00
commit
4dc2427ad7
21 changed files with 232 additions and 614 deletions
31
README.md
31
README.md
|
@ -16,40 +16,15 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
|||
|
||||
## Overview
|
||||
|
||||
Crypto-currency software to operate Ğ1 libre currency
|
||||
Crypto-currency software to operate the Ğ1 libre currency.
|
||||
|
||||
**Shipped version:** 1.8.7~ynh0
|
||||
|
||||
**Shipped version:** 1.8.7~ynh1
|
||||
|
||||
## Screenshots
|
||||
|
||||
![Screenshot of Duniter](./doc/screenshots/duniter_admin_g1.png)
|
||||
|
||||
## Disclaimers / important information
|
||||
|
||||
## First synchronization
|
||||
|
||||
The first synchronization can be very time consuming, it can be considered to do it from the command line via ssh rather than via the graphical WEB interface. In order to let the synchronization be done without keeping the terminal window open connected in ssh, it is recommended to use `tmux` or `screen`. `screen -S duniter` in order to open a new "screen". In this screen called "duniter":
|
||||
|
||||
```
|
||||
sudo systemctl stop duniter
|
||||
sudo su - duniter -c "duniter --home \$HOME sync g1.duniter.org" && sudo systemctl start duniter
|
||||
```
|
||||
|
||||
During the synchronization, you can press CTRL+SHIFT+a+d to exit without closing the "duniter" screen, you can then leave the ssh connection.
|
||||
To come back to your "duniter" screen to see if the sync is finished, you have to run the command `screen -d duniter`
|
||||
|
||||
## Configurations
|
||||
- In order to compute blocks you will have to set your member credentials with `sudo su - duniter -c "duniter --home \$HOME wizard key"` or from the webadmin.
|
||||
- BMA, the client API is accessible from `https://duniter.domain.tld/bma/` if enabled . The last `/` is necessary to the proper functioning. This URL can be use in Cesium and Silkaj.
|
||||
- The web administration interface is accessible via `https://duniter.domain.tld/` and is only accessible to the administrator specified at the installation.
|
||||
- **Warning**: In case the Webui tells you your network configuration is wrong and proposes to correct it, do not apply it, otherwise it breaks the specific configuration made to the proper functioning this package.
|
||||
In case you applied this correction, you can manually reset the configuration with following command:
|
||||
`sudo su - duniter -c "duniter --home \$HOME config --bma --ipv4 127.0.0.1 --port CHOSEN_PORT --remoteh YOUR_DOMAIN --remotep 443 --noupnp"`
|
||||
|
||||
## Cesium
|
||||
Cesium is a wallet webapp. You can install it with:
|
||||
- [YunoHost app](https://github.com/YunoHost-Apps/cesium_ynh)
|
||||
|
||||
## Documentation and resources
|
||||
|
||||
* Official app website: <https://duniter.org>
|
||||
|
|
31
README_fr.md
31
README_fr.md
|
@ -16,40 +16,15 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
|
|||
|
||||
## Vue d’ensemble
|
||||
|
||||
Logiciel de cryptomonnaie pour faire fonctionner la monnaie libre Ğ1
|
||||
Crypto-currency software to operate the Ğ1 libre currency.
|
||||
|
||||
**Version incluse :** 1.8.7~ynh0
|
||||
|
||||
**Version incluse :** 1.8.7~ynh1
|
||||
|
||||
## Captures d’écran
|
||||
|
||||
![Capture d’écran de Duniter](./doc/screenshots/duniter_admin_g1.png)
|
||||
|
||||
## Avertissements / informations importantes
|
||||
|
||||
## Première synchronisation
|
||||
La première synchronisation pouvant demander beaucoup de temps, il peut être envisagé de la faire en ligne de commande par ssh plutôt que par l'interface graphique WEB. Afin de pouvoir laisser la synchronisation se faire sans garder la fenêtre du terminal ouverte connecté en ssh, il est recommandé d'utiliser `tmux` ou `screen`.
|
||||
`screen -S duniter` afin d'ouvrir un nouvel "écran".
|
||||
Dans cet écran appelé "duniter" :
|
||||
```
|
||||
sudo systemctl stop duniter
|
||||
sudo su - duniter -c "duniter --home \$HOME sync g1.duniter.org" && sudo systemctl start duniter
|
||||
```
|
||||
Pendant la synchronisation, vous pouvez faire CTRL+SHIFT+a+d afin de quitter sans fermer l'écran "duniter", vous pouvez alors quitter la connexion ssh.
|
||||
Pour revenir à votre écran "duniter" pour voir si la synchro est terminée, vous devez lancer la commande
|
||||
`screen -d duniter`
|
||||
|
||||
## Configurations
|
||||
- Afin de calculer des blocs, il faut configurer ses identifiants membre avec `sudo su - duniter -c "duniter --home \$HOME wizard key"` ou via l’interface d’administration web.
|
||||
- BMA, l’API client est accessible via `https://duniter.domain.tld/bma/` si activé. Le dernier `/` est nécessaire à son fonctionnement. Cette URL peut être utilisée dans Cesium et Silkaj.
|
||||
- L’interface d’administration web est accessible à l’adresse `https://duniter.domain.tld/` et est uniquement accessible à l’administrateur spécifié lors de l’installation.
|
||||
- **Attention** : dans le cas où l’interface d’administration web vous notifie que votre configuration réseau est incorrecte et propose de la corriger, ne le faites pas, autrement ça cassera la configuration spécifique au bon fonctionnement de ce paquet.
|
||||
Dans le cas où vous auriez appliqué cette correction, vous pouvez manuellement remettre en place la configuration avec la commande suivante :
|
||||
`sudo su - duniter -c "duniter --home \$HOME config --bma --ipv4 127.0.0.1 --port CHOSEN_PORT --remoteh YOUR_DOMAIN --remotep 443 --noupnp"`
|
||||
|
||||
## Cesium
|
||||
Cesium est une application portefeuilles web. Vous pouvez l’installer :
|
||||
- [avec l’application YunoHost](https://github.com/YunoHost-Apps/cesium_ynh)
|
||||
|
||||
## Documentations et ressources
|
||||
|
||||
* Site officiel de l’app : <https://duniter.org>
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld"
|
||||
admin="john"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=0
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=0
|
||||
setup_public=0
|
||||
upgrade=1
|
||||
upgrade=1 from_commit=70eaf1b90afe598445690e30debe3f39e1082c72
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=none
|
|
@ -1,7 +0,0 @@
|
|||
SOURCE_URL=https://git.duniter.org/nodes/typescript/duniter/-/jobs/110607/artifacts/raw/work/bin/duniter-server-v1.8.7-linux-x64.deb
|
||||
SOURCE_SUM=a3b3f44b09a76f40d93f761872f9d798ee68bea8cc2eb73fe63c9cc6ad8b6519
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=deb
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=duniter-server-v1.8.7-linux-x64.deb
|
||||
SOURCE_EXTRACT=false
|
|
@ -1,7 +0,0 @@
|
|||
SOURCE_URL=https://git.duniter.org/nodes/typescript/duniter/uploads/8773273a64956cb02de555ec72e4d2bd/duniter-server-v1.8.5-linux-armv7l.deb
|
||||
SOURCE_SUM=498e3a7766e167887de2d71dd43ffa6c1add11f976bf00e2a44ccc3cec5d5da0
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=deb
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=duniter-server-v1.8.5-linux-armv7l.deb
|
||||
SOURCE_EXTRACT=false
|
|
@ -4,32 +4,32 @@ location / {
|
|||
proxy_set_header Host $host;
|
||||
proxy_set_header X-NginX-Proxy true;
|
||||
|
||||
proxy_pass http://localhost:9220;
|
||||
proxy_pass http://localhost:__PORT_WEB_ADMIN__;
|
||||
proxy_redirect off;
|
||||
|
||||
# Socket.io support
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_read_timeout 86400s;
|
||||
proxy_read_timeout 86400s;
|
||||
proxy_send_timeout 86400s;
|
||||
|
||||
# Include SSOWAT user panel
|
||||
access_by_lua_file /usr/share/ssowat/access.lua;
|
||||
|
||||
location ~ \.(js|css|woff|woff2|ttf|png) {
|
||||
proxy_pass http://localhost:9220;
|
||||
proxy_pass http://localhost:__PORT_WEB_ADMIN__;
|
||||
}
|
||||
|
||||
location ~ /webmin {
|
||||
proxy_pass http://localhost:9220$uri;
|
||||
location ~ ^/webmin {
|
||||
proxy_pass http://localhost:__PORT_WEB_ADMIN__$uri;
|
||||
}
|
||||
|
||||
location ~ ^/bma(.*)$ {
|
||||
proxy_pass http://localhost:__PORT__$1$is_args$args;
|
||||
proxy_pass http://localhost:__PORT_LOCAL_BMA__$1$is_args$args;
|
||||
}
|
||||
|
||||
location /ws2p {
|
||||
proxy_pass http://localhost:20901;
|
||||
proxy_pass http://localhost:__PORT_LOCAL_WS2P__;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,17 +3,52 @@ Description=Duniter node
|
|||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=exec
|
||||
User=duniter
|
||||
Group=duniter
|
||||
|
||||
Environment="DUNITER_WEB=web"
|
||||
Environment="DUNITER_HOME=__DATADIR__"
|
||||
Environment="DUNITER_HOME=__DATA_DIR__"
|
||||
Environment="DUNITER_DATA=duniter_default"
|
||||
Environment="DUNITER_OPTS="
|
||||
Group=duniter
|
||||
User=duniter
|
||||
Type=forking
|
||||
ExecStart=/usr/bin/duniter ${DUNITER_WEB}start --home ${DUNITER_HOME} --mdb ${DUNITER_DATA} $DUNITER_OPTS
|
||||
ExecReload=/usr/bin/duniter ${DUNITER_WEB}restart --home ${DUNITER_HOME} --mdb ${DUNITER_DATA} $DUNITER_OPTS
|
||||
ExecStart=/usr/bin/duniter direct_${DUNITER_WEB}start --home ${DUNITER_HOME} --mdb ${DUNITER_DATA} $DUNITER_OPTS --webmport __PORT_WEB_ADMIN__
|
||||
ExecReload=/usr/bin/duniter direct_${DUNITER_WEB}restart --home ${DUNITER_HOME} --mdb ${DUNITER_DATA} $DUNITER_OPTS --webmport __PORT_WEB_ADMIN__
|
||||
ExecStop=/usr/bin/duniter stop --home ${DUNITER_HOME} --mdb ${DUNITER_DATA}
|
||||
Restart=on-failure
|
||||
|
||||
StandardOutput=journal
|
||||
StandardError=inherit
|
||||
|
||||
# Sandboxing options to harden security
|
||||
# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
|
||||
NoNewPrivileges=yes
|
||||
PrivateTmp=yes
|
||||
PrivateDevices=yes
|
||||
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK
|
||||
RestrictNamespaces=yes
|
||||
RestrictRealtime=yes
|
||||
DevicePolicy=closed
|
||||
ProtectClock=yes
|
||||
ProtectHostname=yes
|
||||
ProtectProc=invisible
|
||||
ProtectSystem=full
|
||||
ProtectControlGroups=yes
|
||||
ProtectKernelModules=yes
|
||||
ProtectKernelTunables=yes
|
||||
LockPersonality=yes
|
||||
SystemCallArchitectures=native
|
||||
SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap @cpu-emulation @privileged
|
||||
|
||||
# Denying access to capabilities that should not be relevant for webapps
|
||||
# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html
|
||||
CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD
|
||||
CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE
|
||||
CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT
|
||||
CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK
|
||||
CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM
|
||||
CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG
|
||||
CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE
|
||||
CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW
|
||||
CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
## First synchronization
|
||||
|
||||
The first synchronization can be very time consuming, it can be considered to do it from the command line via ssh rather than via the graphical WEB interface. In order to let the synchronization be done without keeping the terminal window open connected in ssh, it is recommended to use `tmux` or `screen`. `screen -S duniter` in order to open a new "screen". In this screen called "duniter":
|
||||
The first synchronization can be very time consuming, it can be considered to do it from the command line via ssh rather than via the web interface.
|
||||
In order to let the synchronization be done without keeping the terminal window open connected in ssh, it is recommended to use `tmux` or `screen`:
|
||||
|
||||
```
|
||||
* `screen -S duniter` in order to open a new "screen". In this screen called "duniter":
|
||||
|
||||
```bash
|
||||
sudo systemctl stop duniter
|
||||
sudo su - duniter -c "duniter --home \$HOME sync g1.duniter.org" && sudo systemctl start duniter
|
||||
```
|
||||
|
@ -10,7 +13,8 @@ sudo su - duniter -c "duniter --home \$HOME sync g1.duniter.org" && sudo systemc
|
|||
During the synchronization, you can press CTRL+SHIFT+a+d to exit without closing the "duniter" screen, you can then leave the ssh connection.
|
||||
To come back to your "duniter" screen to see if the sync is finished, you have to run the command `screen -d duniter`
|
||||
|
||||
## Configurations
|
||||
## Configuration
|
||||
|
||||
- In order to compute blocks you will have to set your member credentials with `sudo su - duniter -c "duniter --home \$HOME wizard key"` or from the webadmin.
|
||||
- BMA, the client API is accessible from `https://duniter.domain.tld/bma/` if enabled . The last `/` is necessary to the proper functioning. This URL can be use in Cesium and Silkaj.
|
||||
- The web administration interface is accessible via `https://duniter.domain.tld/` and is only accessible to the administrator specified at the installation.
|
||||
|
@ -19,5 +23,5 @@ In case you applied this correction, you can manually reset the configuration wi
|
|||
`sudo su - duniter -c "duniter --home \$HOME config --bma --ipv4 127.0.0.1 --port CHOSEN_PORT --remoteh YOUR_DOMAIN --remotep 443 --noupnp"`
|
||||
|
||||
## Cesium
|
||||
Cesium is a wallet webapp. You can install it with:
|
||||
- [YunoHost app](https://github.com/YunoHost-Apps/cesium_ynh)
|
||||
|
||||
Cesium is a wallet webapp. You can install it with [its YunoHost app](https://github.com/YunoHost-Apps/cesium_ynh).
|
|
@ -1,16 +1,20 @@
|
|||
## Première synchronisation
|
||||
La première synchronisation pouvant demander beaucoup de temps, il peut être envisagé de la faire en ligne de commande par ssh plutôt que par l'interface graphique WEB. Afin de pouvoir laisser la synchronisation se faire sans garder la fenêtre du terminal ouverte connecté en ssh, il est recommandé d'utiliser `tmux` ou `screen`.
|
||||
`screen -S duniter` afin d'ouvrir un nouvel "écran".
|
||||
Dans cet écran appelé "duniter" :
|
||||
```
|
||||
|
||||
La première synchronisation pouvant demander beaucoup de temps, il peut être envisagé de la faire en ligne de commande par ssh plutôt que par l'interface web.
|
||||
Afin de pouvoir laisser la synchronisation se faire sans garder la fenêtre du terminal ouverte connecté en ssh, il est recommandé d'utiliser `tmux` ou `screen`:
|
||||
|
||||
* `screen -S duniter` afin d'ouvrir un nouvel "écran" ; Dans cet écran appelez "duniter" :
|
||||
|
||||
```bash
|
||||
sudo systemctl stop duniter
|
||||
sudo su - duniter -c "duniter --home \$HOME sync g1.duniter.org" && sudo systemctl start duniter
|
||||
```
|
||||
Pendant la synchronisation, vous pouvez faire CTRL+SHIFT+a+d afin de quitter sans fermer l'écran "duniter", vous pouvez alors quitter la connexion ssh.
|
||||
Pour revenir à votre écran "duniter" pour voir si la synchro est terminée, vous devez lancer la commande
|
||||
`screen -d duniter`
|
||||
|
||||
## Configurations
|
||||
Pendant la synchronisation, vous pouvez faire `CTRL+SHIFT+a,d` afin de quitter sans fermer l'écran "duniter", vous pouvez alors quitter la connexion ssh.
|
||||
Pour revenir à votre écran "duniter" pour voir si la synchro est terminée, vous devez lancer la commande `screen -d duniter`.
|
||||
|
||||
## Configuration
|
||||
|
||||
- Afin de calculer des blocs, il faut configurer ses identifiants membre avec `sudo su - duniter -c "duniter --home \$HOME wizard key"` ou via l’interface d’administration web.
|
||||
- BMA, l’API client est accessible via `https://duniter.domain.tld/bma/` si activé. Le dernier `/` est nécessaire à son fonctionnement. Cette URL peut être utilisée dans Cesium et Silkaj.
|
||||
- L’interface d’administration web est accessible à l’adresse `https://duniter.domain.tld/` et est uniquement accessible à l’administrateur spécifié lors de l’installation.
|
||||
|
@ -19,5 +23,5 @@ Dans le cas où vous auriez appliqué cette correction, vous pouvez manuellement
|
|||
`sudo su - duniter -c "duniter --home \$HOME config --bma --ipv4 127.0.0.1 --port CHOSEN_PORT --remoteh YOUR_DOMAIN --remotep 443 --noupnp"`
|
||||
|
||||
## Cesium
|
||||
Cesium est une application portefeuilles web. Vous pouvez l’installer :
|
||||
- [avec l’application YunoHost](https://github.com/YunoHost-Apps/cesium_ynh)
|
||||
|
||||
Cesium est une application portefeuilles web. Vous pouvez l’installer [avec l’application YunoHost](https://github.com/YunoHost-Apps/cesium_ynh).
|
|
@ -0,0 +1 @@
|
|||
Crypto-currency software to operate the Ğ1 libre currency.
|
7
doc/PRE_UPGRADE.d/1.8.7.md
Normal file
7
doc/PRE_UPGRADE.d/1.8.7.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
**CAREFUL, THIS UPGRADE WILL WIPE DATA.**
|
||||
|
||||
This is a Duniter issue, not related to YunoHost, see <https://forum.duniter.org/t/duniter-v1-8-7-release/11222/61>.
|
||||
|
||||
You will just have to restart the synchronization.
|
||||
|
||||
If you think you lost data in the process, don't forget that YunoHost provides backups!
|
|
@ -1,41 +0,0 @@
|
|||
{
|
||||
"name": "Duniter",
|
||||
"id": "duniter",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "Crypto-currency software to operate Ğ1 libre currency",
|
||||
"fr": "Logiciel de cryptomonnaie pour faire fonctionner la monnaie libre Ğ1"
|
||||
},
|
||||
"version": "1.8.7~ynh0",
|
||||
"url": "https://duniter.org",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"upstream": {
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"website": "https://duniter.org",
|
||||
"code": "https://git.duniter.org/nodes/typescript/duniter"
|
||||
},
|
||||
"maintainer": {
|
||||
"name": "Moul",
|
||||
"email": "moul@moul.re",
|
||||
"url": "https://moul.re"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 11.0.0"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"services": [
|
||||
"nginx"
|
||||
],
|
||||
"arguments": {
|
||||
"install" : [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
63
manifest.toml
Normal file
63
manifest.toml
Normal file
|
@ -0,0 +1,63 @@
|
|||
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
|
||||
|
||||
packaging_format = 2
|
||||
|
||||
id = "duniter"
|
||||
name = "Duniter"
|
||||
description.en = "Crypto-currency software to operate Ğ1 libre currency"
|
||||
description.fr = "Logiciel de cryptomonnaie pour faire fonctionner la monnaie libre Ğ1"
|
||||
|
||||
version = "1.8.7~ynh1"
|
||||
|
||||
maintainers = ["Moul"]
|
||||
|
||||
[upstream]
|
||||
license = "AGPL-3.0-or-later"
|
||||
website = "https://duniter.org"
|
||||
code = "https://git.duniter.org/nodes/typescript/duniter"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.0.0"
|
||||
architectures = ["amd64"]
|
||||
multi_instance = false
|
||||
ldap = "not_relevant"
|
||||
sso = "not_relevant"
|
||||
disk = "50M"
|
||||
ram.build = "150M"
|
||||
ram.runtime = "200M"
|
||||
|
||||
[install]
|
||||
[install.domain]
|
||||
type = "domain"
|
||||
|
||||
[install.admin]
|
||||
type = "user"
|
||||
|
||||
[install.init_main_permission]
|
||||
type = "group"
|
||||
default = "visitors"
|
||||
|
||||
[resources]
|
||||
[resources.sources.main]
|
||||
amd64.url = "https://git.duniter.org/nodes/typescript/duniter/-/jobs/110607/artifacts/raw/work/bin/duniter-server-v1.8.7-linux-x64.deb"
|
||||
amd64.sha256 = "a3b3f44b09a76f40d93f761872f9d798ee68bea8cc2eb73fe63c9cc6ad8b6519"
|
||||
|
||||
format = "whatever"
|
||||
extract = false
|
||||
rename = "duniter-server.deb"
|
||||
|
||||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
|
||||
[resources.data_dir]
|
||||
|
||||
[resources.permissions]
|
||||
main.url = "/"
|
||||
admin.allowed = "admins"
|
||||
admin.additional_urls = ["/webmin"]
|
||||
|
||||
[resources.ports]
|
||||
web_admin.default = 8000
|
||||
local_bma.default = 10901
|
||||
local_ws2p.default = 20901
|
|
@ -4,18 +4,25 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="deb1 deb2 php$YNH_DEFAULT_PHP_VERSION-deb1 php$YNH_DEFAULT_PHP_VERSION-deb2"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
CONFIGURE_DUNITER() {
|
||||
ynh_exec_as duniter duniter --home $datadir config --bma --ipv4 127.0.0.1 --port $port --remoteh $domain --remotep 443 --noupnp
|
||||
ynh_exec_as duniter duniter --home $datadir config --ws2p-host 127.0.0.1 --ws2p-port 20901 --ws2p-remote-host $domain --ws2p-remote-port 443 --ws2p-remote-path "/ws2p" --ws2p-noupnp
|
||||
|
||||
# Add BMAS with path, remove auto-generated BMAS endpoint
|
||||
ynh_exec_as duniter duniter --home $datadir config --addep "BMAS $domain 443 /bma" --remep "BMAS $domain 443"
|
||||
run_duniter() {
|
||||
ynh_exec_as "duniter" duniter --home "$data_dir" "$@"
|
||||
}
|
||||
|
||||
|
||||
CONFIGURE_DUNITER() {
|
||||
run_duniter config --bma --ipv4 127.0.0.1 --port "$port_local_bma" --remoteh $domain --remotep 443 --noupnp
|
||||
|
||||
run_duniter config \
|
||||
--ws2p-host 127.0.0.1 --ws2p-port "$port_local_ws2p" \
|
||||
--ws2p-remote-host "$domain" --ws2p-remote-port 443 \
|
||||
--ws2p-remote-path "/ws2p" --ws2p-noupnp
|
||||
|
||||
# Add BMAS with path, remove auto-generated BMAS endpoint
|
||||
run_duniter config --addep "BMAS $domain 443 /bma" --remep "BMAS $domain 443"
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -10,26 +10,6 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info --message="Loading installation settings…"
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
|
@ -39,20 +19,14 @@ ynh_print_info --message="Declaring files to be backed up…"
|
|||
# BACKUP THE DATA DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$datadir" --is_big
|
||||
ynh_backup --src_path="$data_dir" --is_big
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
# SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
#=================================================
|
||||
# BACKUP SYSTEMD
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -9,65 +9,6 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
old_domain=$YNH_APP_OLD_DOMAIN
|
||||
old_path=$YNH_APP_OLD_PATH
|
||||
|
||||
new_domain=$YNH_APP_NEW_DOMAIN
|
||||
new_path="/"
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings…"
|
||||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
# Add settings here as needed by your application
|
||||
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#db_user=$db_name
|
||||
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)…"
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||
#=================================================
|
||||
|
||||
change_domain=0
|
||||
if [ "$old_domain" != "$new_domain" ]
|
||||
then
|
||||
change_domain=1
|
||||
fi
|
||||
|
||||
change_path=0
|
||||
if [ "$old_path" != "$new_path" ]
|
||||
then
|
||||
change_path=1
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
|
@ -82,35 +23,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd
|
|||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration…"
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
# Change the path in the NGINX config file
|
||||
if [ $change_path -eq 1 ]
|
||||
then
|
||||
# Make a backup of the original NGINX config file if modified
|
||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||
# Set global variables for NGINX helper
|
||||
domain="$old_domain"
|
||||
path_url="$new_path"
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
fi
|
||||
|
||||
# Change the domain for NGINX
|
||||
if [ $change_domain -eq 1 ]
|
||||
then
|
||||
# Delete file checksum for the old conf file location
|
||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||
# Store file checksum for the new config file location
|
||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC MODIFICATIONS
|
||||
#=================================================
|
||||
# …
|
||||
#=================================================
|
||||
ynh_change_url_nginx_config
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
|
@ -120,14 +33,7 @@ fi
|
|||
ynh_script_progression --message="Starting a systemd service…"
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server…"
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_systemd_action --service_name="$app" --action="start" --log_path=systemd --line_match="Web administration accessible"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
118
scripts/install
118
scripts/install
|
@ -9,70 +9,6 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url="/"
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
architecture=$YNH_ARCH
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating installation parameters…"
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings…"
|
||||
|
||||
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=admin --value=$admin
|
||||
|
||||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Finding an available port…"
|
||||
|
||||
# Find an available port
|
||||
port=$(ynh_find_port --port=10901)
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user…"
|
||||
|
||||
# Create a system user
|
||||
datadir=/home/yunohost.app/$app
|
||||
ynh_system_user_create --username=$app --home_dir=$datadir --use_shell
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server…"
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
|
@ -80,23 +16,17 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installation of Debian package of Duniter…"
|
||||
|
||||
tempdir="$(mktemp -d)"
|
||||
|
||||
ynh_setup_source --dest_dir=$tempdir --source_id=$architecture
|
||||
ynh_exec_warn_less dpkg -i $tempdir/duniter-server-v1.8.*-linux-*.deb
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
ynh_exec_warn_less dpkg -i "$install_dir/duniter-server.deb"
|
||||
ynh_secure_remove "$install_dir/duniter-server.deb"
|
||||
|
||||
#=================================================
|
||||
# CREATE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a data directory…"
|
||||
ynh_script_progression --message="Configuring a data directory…"
|
||||
|
||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||
|
||||
mkdir -p $datadir
|
||||
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
chmod -R o-rwx "$data_dir"
|
||||
chown -R $app:www-data "$data_dir"
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE DUNITER
|
||||
|
@ -106,19 +36,16 @@ ynh_script_progression --message="Configure Duniter…"
|
|||
CONFIGURE_DUNITER
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
# SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service…"
|
||||
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost…"
|
||||
|
||||
yunohost service add $app
|
||||
yunohost service add "$app"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
@ -126,26 +53,7 @@ yunohost service add $app
|
|||
ynh_script_progression --message="Starting a systemd service…"
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions…"
|
||||
|
||||
# Change main group to protect sensitive sub-routes (client, API) to Duniter web admin interface, give access to choosen admin
|
||||
ynh_permission_update --permission "main" --add "$admin" --remove "all_users"
|
||||
ynh_permission_url --permission "main" --add_url "/webmin"
|
||||
|
||||
# Create apis permission group to public to allow BMA and WS2P APIs accessible to visitors
|
||||
ynh_permission_create --permission "apis" --url "/bma" --additional_urls "/ws2p" --auth_header=false --allowed "visitors"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server…"
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_systemd_action --service_name="$app" --action="start" --log_path=systemd --line_match="Web administration accessible"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -10,73 +10,28 @@ source _common.sh
|
|||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings…"
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||
# REMOVE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||
|
||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing $app service integration…"
|
||||
yunohost service remove $app
|
||||
if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
|
||||
yunohost service remove "$app"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping and removing the systemd service…"
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DATA DIR
|
||||
#=================================================
|
||||
|
||||
# Remove the data directory if --purge option is used
|
||||
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
|
||||
then
|
||||
ynh_script_progression --message="Removing app data directory…"
|
||||
ynh_secure_remove --file="$datadir"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing NGINX web server configuration…"
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies…"
|
||||
ynh_script_progression --message="Removing Duniter package…"
|
||||
|
||||
dpkg -r duniter
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user…"
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -10,59 +10,6 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings…"
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
architecture=$YNH_ARCH
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# 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"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user…"
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir=$datadir --use_shell
|
||||
|
||||
#=================================================
|
||||
# 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:www-data "$datadir"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
|
@ -70,10 +17,9 @@ chown -R $app:www-data "$datadir"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installation of Debian package of Duniter…"
|
||||
|
||||
tempdir="$(mktemp -d)"
|
||||
|
||||
ynh_setup_source --dest_dir=$tempdir --source_id=$architecture
|
||||
ynh_exec_warn_less dpkg -i $tempdir/duniter-server-v1.8.*-linux-*.deb
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
ynh_exec_warn_less dpkg -i "$install_dir/duniter-server.deb"
|
||||
ynh_secure_remove "$install_dir/duniter-server.deb"
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE DUNITER
|
||||
|
@ -83,33 +29,33 @@ ynh_script_progression --message="Configure Duniter…"
|
|||
CONFIGURE_DUNITER
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
# RESTORE THE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the systemd configuration…"
|
||||
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
||||
|
||||
chown -R "$app:www-data" "$data_dir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
systemctl enable $app.service --quiet
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost…"
|
||||
|
||||
yunohost service add $app
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service…"
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd
|
||||
systemctl enable "$app.service" --quiet
|
||||
yunohost service add "$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server…"
|
||||
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Web administration accessible"
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
|
108
scripts/upgrade
108
scripts/upgrade
|
@ -9,42 +9,6 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings…"
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
architecture=$YNH_ARCH
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Checking version…"
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)…"
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
|
@ -59,29 +23,15 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd
|
|||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility…"
|
||||
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
if [ -z "$(ls -A "$data_dir")" ]; then
|
||||
mv "/root/.config/duniter"/{,.}* "$data_dir"
|
||||
chmod -R o-rwx "$data_dir"
|
||||
chown -R "$app:www-data" "$data_dir"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists…"
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
datadir=/home/yunohost.app/$app
|
||||
ynh_system_user_create --username=$app --home_dir=$datadir --use_shell
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration…"
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
if ynh_compare_current_package_version --comparison lt --version 1.8.7~ynh1; then
|
||||
run_duniter reset data
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
|
@ -90,23 +40,9 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installation of Debian package of Duniter…"
|
||||
|
||||
dpkg -r duniter
|
||||
|
||||
tempdir="$(mktemp -d)"
|
||||
|
||||
ynh_setup_source --dest_dir=$tempdir --source_id=$architecture
|
||||
ynh_exec_warn_less dpkg -i $tempdir/duniter-server-v1.8.*-linux-*.deb
|
||||
|
||||
#=================================================
|
||||
# MOVE DUNITER DIRECTORY
|
||||
#=================================================
|
||||
if [[ ! -d "${datadir}" ]]; then
|
||||
ynh_script_progression --message="Moving data directory…"
|
||||
mv /root/.config/duniter $datadir
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
fi
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
ynh_exec_warn_less dpkg -i "$install_dir/duniter-server.deb"
|
||||
ynh_secure_remove "$install_dir/duniter-server.deb"
|
||||
|
||||
#=================================================
|
||||
# UPDATE DUNITER CONFIG FILE
|
||||
|
@ -116,33 +52,23 @@ ynh_script_progression --message="Configure Duniter…"
|
|||
CONFIGURE_DUNITER
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
# REAPPLY SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading systemd configuration…"
|
||||
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost…"
|
||||
|
||||
yunohost service add $app
|
||||
yunohost service add "$app"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service…"
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server…"
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_systemd_action --service_name="$app" --action="start" --log_path=systemd --line_match="Web administration accessible"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
7
tests.toml
Normal file
7
tests.toml
Normal file
|
@ -0,0 +1,7 @@
|
|||
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
|
||||
|
||||
test_format = 1
|
||||
|
||||
[default]
|
||||
|
||||
test_upgrade_from.70eaf1b90afe598445690e30debe3f39e1082c72.name = "1.8.5~ynh1"
|
Loading…
Reference in a new issue