mirror of
https://github.com/YunoHost-Apps/duniter_ynh.git
synced 2024-09-03 18:26:35 +02:00
commit
c8c8dcf048
18 changed files with 866 additions and 179 deletions
64
README.md
64
README.md
|
@ -1,23 +1,31 @@
|
||||||
# Duniter package for YunoHost
|
<!--
|
||||||
- [Duniter project](https://duniter.org)
|
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
||||||
- [YunoHost project](https://yunohost.org)
|
It shall NOT be edited by hand.
|
||||||
|
-->
|
||||||
|
|
||||||
## Requirements
|
# Duniter for YunoHost
|
||||||
- Debian Buster
|
|
||||||
- YunoHost ≥ v4.1
|
|
||||||
- `x64` or `armlv7` architecture
|
|
||||||
- 200Mo free RAM
|
|
||||||
- A dedicated domain name to install the app on root path. For instance, `duniter.domain.tld`.
|
|
||||||
- A YunoHost user which will have access the web admin.
|
|
||||||
|
|
||||||
## Install and upgrade
|
[![Integration level](https://dash.yunohost.org/integration/duniter.svg)](https://dash.yunohost.org/appci/app/duniter) ![](https://ci-apps.yunohost.org/ci/badges/duniter.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/duniter.maintain.svg)
|
||||||
You shall add the application community list into your instance in order to install it and benefit from upgrades:
|
[![Install Duniter with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=duniter)
|
||||||
```bash
|
|
||||||
sudo yunohost app fetchlist -n community -u https://app.yunohost.org/community.json
|
*[Lire ce readme en français.](./README_fr.md)*
|
||||||
sudo yunohost app install duniter
|
|
||||||
sudo yunohost app upgrade duniter
|
> *This package allows you to install Duniter 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.*
|
||||||
Be carefull when installing applications from the community list.
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
Crypto-currency software to operate Ğ1 libre currency
|
||||||
|
|
||||||
|
**Shipped version:** 1.8.1~ynh1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|
![](./doc/screenshots/duniter_admin_g1.png)
|
||||||
|
|
||||||
|
## Disclaimers / important information
|
||||||
|
|
||||||
## Configurations
|
## Configurations
|
||||||
- In order to compute blocks you will have to set your member credentials with `duniter wizard key` or from the webadmin.
|
- In order to compute blocks you will have to set your member credentials with `duniter wizard key` or from the webadmin.
|
||||||
|
@ -30,6 +38,22 @@ You can manually reset the configuration with following command:
|
||||||
Cesium is a wallet webapp. You can install it with:
|
Cesium is a wallet webapp. You can install it with:
|
||||||
- [With the YunoHost app](https://github.com/YunoHost-Apps/cesium_ynh)
|
- [With the YunoHost app](https://github.com/YunoHost-Apps/cesium_ynh)
|
||||||
<!--- With a Duniter plugin: `duniter plug git+https://github.com/duniter/duniter-ui-cesium.git`-->
|
<!--- With a Duniter plugin: `duniter plug git+https://github.com/duniter/duniter-ui-cesium.git`-->
|
||||||
|
## Documentation and resources
|
||||||
|
|
||||||
## License
|
* Official app website: https://duniter.org
|
||||||
This package and the Duniter software are under GNU AGPL v.3.
|
* Upstream app code repository: https://git.duniter.org/nodes/typescript/duniter
|
||||||
|
* YunoHost documentation for this app: https://yunohost.org/app_duniter
|
||||||
|
* Report a bug: https://github.com/YunoHost-Apps/duniter_ynh/issues
|
||||||
|
|
||||||
|
## Developer info
|
||||||
|
|
||||||
|
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/duniter_ynh/tree/testing).
|
||||||
|
|
||||||
|
To try the testing branch, please proceed like that.
|
||||||
|
```
|
||||||
|
sudo yunohost app install https://github.com/YunoHost-Apps/duniter_ynh/tree/testing --debug
|
||||||
|
or
|
||||||
|
sudo yunohost app upgrade duniter -u https://github.com/YunoHost-Apps/duniter_ynh/tree/testing --debug
|
||||||
|
```
|
||||||
|
|
||||||
|
**More info regarding app packaging:** https://yunohost.org/packaging_apps
|
55
README_fr.md
Normal file
55
README_fr.md
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
# Duniter pour YunoHost
|
||||||
|
|
||||||
|
[![Niveau d'intégration](https://dash.yunohost.org/integration/duniter.svg)](https://dash.yunohost.org/appci/app/duniter) ![](https://ci-apps.yunohost.org/ci/badges/duniter.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/duniter.maintain.svg)
|
||||||
|
[![Installer Duniter avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=duniter)
|
||||||
|
|
||||||
|
*[Read this readme in english.](./README.md)*
|
||||||
|
*[Lire ce readme en français.](./README_fr.md)*
|
||||||
|
|
||||||
|
> *Ce package vous permet d'installer Duniter rapidement et simplement sur un serveur YunoHost.
|
||||||
|
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
|
||||||
|
|
||||||
|
## Vue d'ensemble
|
||||||
|
|
||||||
|
Nœud qui permet de participer à l’écriture de blocs
|
||||||
|
|
||||||
|
**Version incluse :** 1.8.1~ynh1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Captures d'écran
|
||||||
|
|
||||||
|
![](./doc/screenshots/duniter_admin_g1.png)
|
||||||
|
|
||||||
|
## Avertissements / informations importantes
|
||||||
|
|
||||||
|
## Configurations
|
||||||
|
- In order to compute blocks you will have to set your member credentials with `duniter wizard key` or from the webadmin.
|
||||||
|
- The BMA API is accessible from `https://duniter.domain.tld/` if enabled.
|
||||||
|
- **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 for this package.
|
||||||
|
You can manually reset the configuration with following command:
|
||||||
|
`duniter 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:
|
||||||
|
- [With the YunoHost app](https://github.com/YunoHost-Apps/cesium_ynh)
|
||||||
|
<!--- With a Duniter plugin: `duniter plug git+https://github.com/duniter/duniter-ui-cesium.git`-->
|
||||||
|
## Documentations et ressources
|
||||||
|
|
||||||
|
* Site officiel de l'app : https://duniter.org
|
||||||
|
* Dépôt de code officiel de l'app : https://git.duniter.org/nodes/typescript/duniter
|
||||||
|
* Documentation YunoHost pour cette app : https://yunohost.org/app_duniter
|
||||||
|
* Signaler un bug : https://github.com/YunoHost-Apps/duniter_ynh/issues
|
||||||
|
|
||||||
|
## Informations pour les développeurs
|
||||||
|
|
||||||
|
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/duniter_ynh/tree/testing).
|
||||||
|
|
||||||
|
Pour essayer la branche testing, procédez comme suit.
|
||||||
|
```
|
||||||
|
sudo yunohost app install https://github.com/YunoHost-Apps/duniter_ynh/tree/testing --debug
|
||||||
|
ou
|
||||||
|
sudo yunohost app upgrade duniter -u https://github.com/YunoHost-Apps/duniter_ynh/tree/testing --debug
|
||||||
|
```
|
||||||
|
|
||||||
|
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
|
|
@ -1,12 +1,7 @@
|
||||||
;; Test complet
|
;; Test complet
|
||||||
auto_remove=1
|
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld"
|
||||||
path="/" (PATH)
|
admin="john"
|
||||||
port="8999" (PORT)
|
|
||||||
sync_node="duniter.org"
|
|
||||||
sync_port="10900"
|
|
||||||
admin="john" (USER)
|
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=0
|
setup_sub_dir=0
|
||||||
|
@ -15,12 +10,11 @@
|
||||||
setup_private=0
|
setup_private=0
|
||||||
setup_public=0
|
setup_public=0
|
||||||
upgrade=1
|
upgrade=1
|
||||||
|
#upgrade=1 from_commit=CommitHash
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=0
|
multi_instance=0
|
||||||
wrong_user=1
|
port_already_use=0
|
||||||
wrong_path=1
|
change_url=1
|
||||||
incorrect_path=1
|
;;; Options
|
||||||
corrupt_source=0
|
Email=
|
||||||
fail_download_source=0
|
Notification=none
|
||||||
port_already_use=1
|
|
||||||
final_path_already_use=0
|
|
||||||
|
|
7
conf/app.src
Normal file
7
conf/app.src
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
SOURCE_URL=https://git.duniter.org/nodes/typescript/duniter/-/jobs/40430/artifacts/raw/work/bin/duniter-server-v1.8.1-linux-x64.deb
|
||||||
|
SOURCE_SUM=d96f805e2465f76a51a4311f7b194c59bd00f658b27709cf679b710d11d1dac3
|
||||||
|
SOURCE_SUM_PRG=sha256sum
|
||||||
|
SOURCE_FORMAT=deb
|
||||||
|
SOURCE_IN_SUBDIR=true
|
||||||
|
SOURCE_FILENAME=duniter-server-v1.8.1-linux-x64.deb
|
||||||
|
SOURCE_EXTRACT=false
|
|
@ -1,16 +0,0 @@
|
||||||
[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
|
|
|
@ -4,7 +4,7 @@ location / {
|
||||||
proxy_set_header Host $http_host;
|
proxy_set_header Host $http_host;
|
||||||
proxy_set_header X-NginX-Proxy true;
|
proxy_set_header X-NginX-Proxy true;
|
||||||
|
|
||||||
proxy_pass http://localhost:YNH_EXAMPLE_PORT;
|
proxy_pass http://localhost:9220;
|
||||||
proxy_redirect off;
|
proxy_redirect off;
|
||||||
|
|
||||||
# Socket.io support
|
# Socket.io support
|
||||||
|
|
19
conf/systemd.service
Normal file
19
conf/systemd.service
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Duniter node
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Environment="DUNITER_WEB=web"
|
||||||
|
Environment="DUNITER_HOME=__DATADIR__"
|
||||||
|
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
|
||||||
|
ExecStop=/usr/bin/duniter stop --home ${DUNITER_HOME} --mdb ${DUNITER_DATA}
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
0
doc/DESCRIPTION.md
Normal file
0
doc/DESCRIPTION.md
Normal file
11
doc/DISCLAIMER.md
Normal file
11
doc/DISCLAIMER.md
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
## Configurations
|
||||||
|
- In order to compute blocks you will have to set your member credentials with `duniter wizard key` or from the webadmin.
|
||||||
|
- The BMA API is accessible from `https://duniter.domain.tld/` if enabled.
|
||||||
|
- **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 for this package.
|
||||||
|
You can manually reset the configuration with following command:
|
||||||
|
`duniter 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:
|
||||||
|
- [With the YunoHost app](https://github.com/YunoHost-Apps/cesium_ynh)
|
||||||
|
<!--- With a Duniter plugin: `duniter plug git+https://github.com/duniter/duniter-ui-cesium.git`-->
|
BIN
doc/screenshots/duniter_admin_g1.png
Normal file
BIN
doc/screenshots/duniter_admin_g1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 145 KiB |
|
@ -3,18 +3,24 @@
|
||||||
"id": "duniter",
|
"id": "duniter",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
"description": {
|
"description": {
|
||||||
"en": "Duniter node which permits participate to blockchain writing. Monetary system with universal dividend, libre money, relative theory of the money. This package permit to join an existing money.",
|
"en": "Crypto-currency software to operate Ğ1 libre currency",
|
||||||
"fr": "Nœud Duniter qui permet de participer à l’écriture de blocs. Système monétaire à dividende universel, monnaie libre, thérorie relative de la monnaie. Ce paquet permet de rejoindre une monnaie déjà existante."
|
"fr": "Nœud qui permet de participer à l’écriture de blocs"
|
||||||
},
|
},
|
||||||
|
"version": "1.8.1~ynh1",
|
||||||
"url": "https://duniter.org",
|
"url": "https://duniter.org",
|
||||||
"license": "free",
|
"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": {
|
"maintainer": {
|
||||||
"name": "Moul",
|
"name": "Moul",
|
||||||
"email": "moul@moul.re",
|
"email": "moul@moul.re",
|
||||||
"url": "https://moul.re"
|
"url": "https://moul.re"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">> 4.1.7"
|
"yunohost": ">= 4.3.0"
|
||||||
},
|
},
|
||||||
"multi_instance": false,
|
"multi_instance": false,
|
||||||
"services": [
|
"services": [
|
||||||
|
@ -24,21 +30,11 @@
|
||||||
"install" : [
|
"install" : [
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain"
|
||||||
"ask": {
|
|
||||||
"en": "Dedicated domain name on which no application must be installed. Install will be done on root path.",
|
|
||||||
"fr": "Nom de domaine dédié sur lequel aucune application ne doit être installée. L’installation sera faite à la racine."
|
|
||||||
},
|
|
||||||
"example": "duniter.domain.tld"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
"type": "user",
|
"type": "user"
|
||||||
"ask": {
|
|
||||||
"en": "Administrator. Must a YunoHost user.",
|
|
||||||
"fr": "Administrateur. Ce doit être un utilisateur YunoHost"
|
|
||||||
},
|
|
||||||
"example": "jon doe"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
20
scripts/_common.sh
Normal file
20
scripts/_common.sh
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# EXPERIMENTAL HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# FUTURE OFFICIAL HELPERS
|
||||||
|
#=================================================
|
62
scripts/backup
Normal file
62
scripts/backup
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
|
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
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info --message="Declaring files to be backed up..."
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP THE DATA DIR
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup --src_path="$datadir" --is_big
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP THE NGINX 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"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
136
scripts/change_url
Normal file
136
scripts/change_url
Normal file
|
@ -0,0 +1,136 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC STARTING
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
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
|
||||||
|
#=================================================
|
||||||
|
# STOP SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Stopping a systemd service..."
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MODIFY URL IN NGINX CONF
|
||||||
|
#=================================================
|
||||||
|
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
|
||||||
|
#=================================================
|
||||||
|
# ...
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALISATION
|
||||||
|
#=================================================
|
||||||
|
# START SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
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
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Change of URL completed for $app"
|
176
scripts/install
176
scripts/install
|
@ -1,58 +1,150 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Exit on command errors and treat unset variables as an error
|
#=================================================
|
||||||
set -eu
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
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
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Retrieve arguments
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path="/"
|
path_url="/"
|
||||||
port=10901
|
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
|
|
||||||
# Source app helpers and functions
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
source /usr/share/yunohost/helpers
|
|
||||||
source functions.sh
|
|
||||||
|
|
||||||
# Check domain/path availability
|
#=================================================
|
||||||
yunohost app checkurl "${domain}${path}" -a "$app" \
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
|| ynh_die "Path not available: ${domain}${path}"
|
#=================================================
|
||||||
|
ynh_script_progression --message="Validating installation parameters..."
|
||||||
|
|
||||||
# Check port availability
|
# Register (book) web path
|
||||||
yunohost app checkport $port
|
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||||
if [[ ! $? -eq 0 ]]; then
|
|
||||||
ynh_die "Port not available: ${port}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check the admin exists in YunoHost users
|
#=================================================
|
||||||
ynh_user_exists $admin
|
# STORE SETTINGS FROM MANIFEST
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Storing installation settings..."
|
||||||
|
|
||||||
# Get CPU architecture and check it
|
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||||
arch=$(uname -m)
|
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||||
if [ $arch == "x86_64" ]; then
|
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||||
arch="x64"
|
|
||||||
fi
|
|
||||||
if [[ $arch != "x64" && $arch != "armv7l" ]]; then
|
|
||||||
ynh_die "$arch is not supported." 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Store config on YunoHost instance
|
#=================================================
|
||||||
ynh_app_setting_set $app port $port
|
# FIND AND OPEN A PORT
|
||||||
ynh_app_setting_set $app arch $arch
|
#=================================================
|
||||||
ynh_app_setting_set "$app" admin "$admin"
|
ynh_script_progression --message="Finding an available port..."
|
||||||
|
|
||||||
# Open port on firewall
|
# Find an available port
|
||||||
yunohost firewall allow TCP $port > /dev/null 2>&1
|
port=$(ynh_find_port --port=10901)
|
||||||
|
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
|
|
||||||
INSTALL_DUNITER_DEBIAN_PACKAGE
|
#=================================================
|
||||||
INSTALL_SYSTEMD
|
# CREATE DEDICATED USER
|
||||||
CONFIGURE_DUNITER
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring system user..."
|
||||||
|
|
||||||
# Launch Duniter node
|
# Create a system user
|
||||||
systemctl start duniter
|
ynh_system_user_create --username=$app
|
||||||
|
|
||||||
# Add Duniter service to the YunoHost monitoring
|
#=================================================
|
||||||
yunohost service add $app --log /root/.config/$app/"$app"_default/"$app".log
|
# NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring NGINX web server..."
|
||||||
|
|
||||||
CONFIG_PERMISSIONS
|
# Create a dedicated NGINX config
|
||||||
CONFIG_NGINX
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC SETUP
|
||||||
|
#=================================================
|
||||||
|
# INSTALL DUNITER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Building Duniter.. (this will take some time and resources!)"
|
||||||
|
|
||||||
|
tempdir="$(mktemp -d)"
|
||||||
|
|
||||||
|
ynh_setup_source --dest_dir=$tempdir --source_id=app
|
||||||
|
ynh_exec_warn_less dpkg -i $tempdir/duniter-server-v1.8.1-linux-x64.deb
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE DATA DIRECTORY
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Creating a data directory..."
|
||||||
|
|
||||||
|
datadir=/home/yunohost.app/$app
|
||||||
|
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"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ADD A CONFIG FILE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Adding a configuration file..."
|
||||||
|
|
||||||
|
duniter config --bma --ipv4 127.0.0.1 --port $port --remoteh $domain --remotep 443 --noupnp
|
||||||
|
duniter config --ws2p-host 127.0.0.1 --ws2p-port 20901 --ws2p-remote-host $domain --ws2p-remote-port 443 --ws2p-remote-path "/ws2p" --ws2p-noupnp
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP SYSTEMD
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring a systemd service..."
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# START SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
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..."
|
||||||
|
|
||||||
|
# Make app public
|
||||||
|
ynh_permission_update --permission="main" --add="visitors"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reloading NGINX web server..."
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Installation of $app completed"
|
||||||
|
|
|
@ -1,30 +1,84 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Exit and treat unset variables as an error
|
#=================================================
|
||||||
set -u
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Source app helpers
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
source functions.sh
|
|
||||||
|
#=================================================
|
||||||
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
|
||||||
port=$(ynh_app_setting_get $app port)
|
|
||||||
|
|
||||||
REMOVE_DUNITER
|
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)
|
||||||
|
|
||||||
# Disable systemd service
|
#=================================================
|
||||||
systemctl disable duniter.service
|
# STANDARD REMOVE
|
||||||
|
#=================================================
|
||||||
|
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Remove data and conf
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||||
rm -rf /root/.conf/duniter
|
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||||
|
then
|
||||||
|
ynh_script_progression --message="Removing $app service integration..."
|
||||||
|
yunohost service remove $app
|
||||||
|
fi
|
||||||
|
|
||||||
# Remove Duniter service to YunoHost monitoring
|
#=================================================
|
||||||
yunohost service remove $app
|
# STOP AND REMOVE SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Stopping and removing the systemd service..."
|
||||||
|
|
||||||
# Remove Nginx configuration
|
# Remove the dedicated systemd config
|
||||||
rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
ynh_remove_systemd_config
|
||||||
systemctl reload nginx
|
|
||||||
|
|
||||||
# Close opened port
|
#=================================================
|
||||||
yunohost firewall disallow TCP $port
|
# 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..."
|
||||||
|
|
||||||
|
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
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Removal of $app completed"
|
||||||
|
|
120
scripts/restore
Normal file
120
scripts/restore
Normal file
|
@ -0,0 +1,120 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
|
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)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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
|
||||||
|
#=================================================
|
||||||
|
# INSTALL DUNITER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Building Duniter.. (this will take some time and resources!)"
|
||||||
|
|
||||||
|
tempdir="$(mktemp -d)"
|
||||||
|
|
||||||
|
ynh_setup_source --dest_dir=$tempdir --source_id=app
|
||||||
|
ynh_exec_warn_less dpkg -i $tempdir/duniter-server-v1.8.1-linux-x64.deb
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ADD A CONFIG FILE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Adding a configuration file..."
|
||||||
|
|
||||||
|
duniter config --bma --ipv4 127.0.0.1 --port $port --remoteh $domain --remotep 443 --noupnp
|
||||||
|
duniter config --ws2p-host 127.0.0.1 --ws2p-port 20901 --ws2p-remote-host $domain --ws2p-remote-port 443 --ws2p-remote-path "/ws2p" --ws2p-noupnp
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE SYSTEMD
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the systemd configuration..."
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reloading NGINX web server..."
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Restoration completed for $app"
|
147
scripts/upgrade
147
scripts/upgrade
|
@ -1,26 +1,139 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Exit on command errors and treat unset variables as an error
|
#=================================================
|
||||||
set -eu
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Source app helpers and functions
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
source functions.sh
|
|
||||||
|
|
||||||
# Retrive arguments
|
#=================================================
|
||||||
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
|
||||||
port=$(ynh_app_setting_get "$app" port)
|
|
||||||
arch=$(ynh_app_setting_get "$app" arch)
|
|
||||||
admin=$(ynh_app_setting_get "$app" admin)
|
|
||||||
|
|
||||||
REMOVE_DUNITER
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
INSTALL_DUNITER_DEBIAN_PACKAGE
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
INSTALL_SYSTEMD
|
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
CONFIGURE_DUNITER
|
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||||
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
|
|
||||||
# Start duniter service
|
#=================================================
|
||||||
systemctl start duniter
|
# CHECK VERSION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Checking version..."
|
||||||
|
|
||||||
CONFIG_PERMISSIONS
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
CONFIG_NGINX
|
|
||||||
|
#=================================================
|
||||||
|
# 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
|
||||||
|
#=================================================
|
||||||
|
# STOP SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Stopping a systemd service..."
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
|
#=================================================
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||||
|
|
||||||
|
# Create a dedicated user (if not existing)
|
||||||
|
ynh_system_user_create --username=$app
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||||
|
|
||||||
|
# Create a dedicated NGINX config
|
||||||
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC UPGRADE
|
||||||
|
#=================================================
|
||||||
|
# INSTALL DUNITER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Building Duniter.. (this will take some time and resources!)"
|
||||||
|
|
||||||
|
dpkg -r duniter
|
||||||
|
|
||||||
|
tempdir="$(mktemp -d)"
|
||||||
|
|
||||||
|
ynh_setup_source --dest_dir=$tempdir --source_id=app
|
||||||
|
ynh_exec_warn_less dpkg -i $tempdir/duniter-server-v1.8.1-linux-x64.deb
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPDATE A CONFIG FILE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Updating a configuration file..."
|
||||||
|
|
||||||
|
duniter config --bma --ipv4 127.0.0.1 --port $port --remoteh $domain --remotep 443 --noupnp
|
||||||
|
duniter config --ws2p-host 127.0.0.1 --ws2p-port 20901 --ws2p-remote-host $domain --ws2p-remote-port 443 --ws2p-remote-path "/ws2p" --ws2p-noupnp
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP SYSTEMD
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading systemd configuration..."
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Upgrade of $app completed"
|
||||||
|
|
Loading…
Reference in a new issue