mirror of
https://github.com/YunoHost-Apps/duniter_ynh.git
synced 2024-09-03 18:26:35 +02:00
Clone from https://moul.re/repo/moul/ucoin_ynh/
This commit is contained in:
parent
940f146d5f
commit
49d04d56cd
6 changed files with 118 additions and 41 deletions
27
README.md
27
README.md
|
@ -3,3 +3,30 @@
|
||||||
* [uCoin project](http://ucoin.io)
|
* [uCoin project](http://ucoin.io)
|
||||||
* [YunoHost project](https://yunohost.org/#/)
|
* [YunoHost project](https://yunohost.org/#/)
|
||||||
* Should works on Debian Jessie 64 bits, 32 bits and ARM
|
* Should works on Debian Jessie 64 bits, 32 bits and ARM
|
||||||
|
|
||||||
|
|
||||||
|
## Package state
|
||||||
|
The package is **not working**.
|
||||||
|
Currently, it:
|
||||||
|
|
||||||
|
* Install dependencies: node, npm
|
||||||
|
* Install uCoin, but it fail cause to this [bug](https://github.com/ucoin-io/ucoin/issues/212).
|
||||||
|
* Synchronize with node
|
||||||
|
* Configure the node
|
||||||
|
* Daemonized the node and launch it
|
||||||
|
|
||||||
|
* Remove and uprade scripts should works
|
||||||
|
|
||||||
|
Extra features:
|
||||||
|
|
||||||
|
* Proxy_pass to access to request though the path instead through the port cause it failed.
|
||||||
|
* uCoin logs are displayed on the YunoHost admin interface
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo yunohost app install https://moul.re/repo/moul/ucoin_ynh/
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
This package and the uCoin software are under GNU GPL v.3.
|
||||||
|
|
6
conf/nginx.conf
Normal file
6
conf/nginx.conf
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
location YNH_EXAMPLE_PATH/ {
|
||||||
|
rewrite ^YNH_EXAMPLE_PATH$ YNH_EXAMPLE_PATH/ permanent;
|
||||||
|
proxy_pass http://YNH_EXEMPLE_DOMAIN:YNH_EXAMPLE_PORT/;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_buffering off;
|
||||||
|
}
|
|
@ -2,27 +2,39 @@
|
||||||
"name": "uCoin",
|
"name": "uCoin",
|
||||||
"id": "ucoin",
|
"id": "ucoin",
|
||||||
"description": {
|
"description": {
|
||||||
"en": "uCoin node which permits participate chainblocks writing. Monetary system with universal dividende, libre money, Relative Money Theory",
|
"en": "uCoin node which permits participate to chainblocks writing. Monetary system with universal dividend, libre money, relative theory of money. This package permit join an existing money.",
|
||||||
"fr": "Nœud uCoin qui permet de participer l'écriture de blocs. Système monétaire à Dividende universel, monnaie libre, Thérorie Relative de la Monnaie"
|
"fr": "Nœud uCoin 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."
|
||||||
},
|
},
|
||||||
"url": "http://ucoin.io/",
|
"url": "http://ucoin.io/",
|
||||||
"licence": "free",
|
"license": "free",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "Moul",
|
"name": "Moul",
|
||||||
"email": "moul@moul.re",
|
"email": "moul@moul.re",
|
||||||
"url": "https://moul.re/"
|
"url": "https://moul.re/"
|
||||||
},
|
},
|
||||||
"multi_instance": "true",
|
"multi_instance": "true",
|
||||||
|
"services": [
|
||||||
|
"nginx"
|
||||||
|
],
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"install" : [
|
"install" : [
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Domain name on which install uCoin node",
|
"en": "Domain name",
|
||||||
"fr": "Nom de domaine sur lequel installer le nœud uCoin"
|
"fr": "Nom de domaine"
|
||||||
},
|
},
|
||||||
"example": "example.com"
|
"example": "example.com"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "path",
|
||||||
|
"ask": {
|
||||||
|
"en": "Path on which install the proxy",
|
||||||
|
"fr": "Chemin sur lequel ajouter le proxy"
|
||||||
|
},
|
||||||
|
"example": "/ucoin",
|
||||||
|
"default": "/ucoin"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "port",
|
"name": "port",
|
||||||
"ask": {
|
"ask": {
|
||||||
|
@ -35,8 +47,8 @@
|
||||||
{
|
{
|
||||||
"name": "sync_node",
|
"name": "sync_node",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Node which synchronise with",
|
"en": "Node's address to synchronise with",
|
||||||
"fr": "Nœud avec lequel faire la synchronisation"
|
"fr": "Adresse du nœud avec lequel se synchroniser"
|
||||||
},
|
},
|
||||||
"example": "metab.ucoin.io",
|
"example": "metab.ucoin.io",
|
||||||
"default": "metab.ucoin.io"
|
"default": "metab.ucoin.io"
|
||||||
|
@ -58,7 +70,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "psswd",
|
"name": "password",
|
||||||
"type": "password",
|
"type": "password",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Password of your account",
|
"en": "Password of your account",
|
||||||
|
|
|
@ -3,29 +3,22 @@
|
||||||
#set -e
|
#set -e
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
|
app=ucoin
|
||||||
domain=$1
|
domain=$1
|
||||||
port=$2
|
path=$2
|
||||||
sync_node=$3
|
port=$3
|
||||||
sync_port=$4
|
sync_node=$4
|
||||||
salt=$5
|
sync_port=$5
|
||||||
psswd=$6
|
salt=$6
|
||||||
|
password=$7
|
||||||
#cpu=$(($7/100))
|
#cpu=$(($7/100))
|
||||||
#cpu=`expr $7 / 100`
|
#cpu=`expr $7 / 100`
|
||||||
path=/home/yunohost.app/ucoin
|
data_path=/home/yunohost.app/ucoin
|
||||||
ucoin="node --harmony $path/bin/ucoind"
|
ucoin="node --harmony $data_path/bin/ucoind"
|
||||||
|
|
||||||
# Install dependencies: nodejs 0.12.x, npm
|
# Check domain/path availability
|
||||||
#sudo apt -y -qq install npm node nodejs-legacy
|
sudo yunohost app checkurl $domain$path -a $app \
|
||||||
sudo apt -y -qq install curl g++ make
|
|| (echo "Path not available: $domain$path" && exit 1)
|
||||||
sudo curl --silent --location https://deb.nodesource.com/setup_0.12 | sudo bash -
|
|
||||||
sudo apt -y -qq install nodejs
|
|
||||||
|
|
||||||
# Install uCoin node and pm2 daemon manager
|
|
||||||
cd /home/yunohost.app/
|
|
||||||
sudo git clone https://github.com/ucoin-io/ucoin
|
|
||||||
cd $path
|
|
||||||
sudo npm install
|
|
||||||
sudo npm install -g pm2
|
|
||||||
|
|
||||||
# Check port availability
|
# Check port availability
|
||||||
sudo yunohost app checkport $port
|
sudo yunohost app checkport $port
|
||||||
|
@ -36,13 +29,43 @@ fi
|
||||||
# Open port on firewall
|
# Open port on firewall
|
||||||
sudo yunohost firewall allow TCP $port > /dev/null 2>&1
|
sudo yunohost firewall allow TCP $port > /dev/null 2>&1
|
||||||
|
|
||||||
# Configure and sync uCoin node
|
# Store config on YunoHost instance
|
||||||
|
sudo yunohost app setting $app port -v $port
|
||||||
|
sudo yunohost app setting $app data_path -v $data_path
|
||||||
|
|
||||||
|
# Install dependencies: nodejs 0.12.x, npm
|
||||||
|
#sudo apt -y -qq install npm node nodejs-legacy
|
||||||
|
sudo apt -y -qq install curl g++ make
|
||||||
|
sudo curl --silent --location https://deb.nodesource.com/setup_0.12 | sudo bash -
|
||||||
|
sudo apt -y -qq install nodejs
|
||||||
|
|
||||||
|
# Install uCoin node and pm2 daemon manager
|
||||||
|
cd /home/yunohost.app/
|
||||||
|
sudo git clone https://github.com/ucoin-io/ucoin
|
||||||
|
cd $data_path
|
||||||
|
sudo npm install
|
||||||
|
sudo npm install -g pm2
|
||||||
|
|
||||||
|
# Configure uCoin node
|
||||||
$ucoin init --autoconf
|
$ucoin init --autoconf
|
||||||
$ucoin config --remoteh $domain --port $port --remotep $port --salt $salt --passwd $psswd # --cpu $cpu
|
$ucoin config --remoteh $domain --port $port --remotep $port --salt $salt --passwd $password # --cpu $cpu
|
||||||
$ucoin sync $sync_node $sync_port # --nocautious
|
|
||||||
|
# Synchronize uCoin node
|
||||||
|
echo "Synchronizing with $sync_node:$sync_port"
|
||||||
|
$ucoin sync $sync_node $sync_port --nointeractive > /dev/null 2>&1
|
||||||
|
|
||||||
# Launch uCoin node with pm2 daemon
|
# Launch uCoin node with pm2 daemon
|
||||||
pm2 start $path/bin/ucoind --name ucoin --interpreter=node --node-args="--harmony" --log /var/log/ucoin.log -- start
|
sudo pm2 start $data_path/bin/ucoind --name ucoin --interpreter=node --node-args="--harmony" --log /var/log/$app.log -- start
|
||||||
|
|
||||||
# Add uCoin service to the YunoHost monitoring
|
# Add uCoin service to the YunoHost monitoring
|
||||||
sudo yunohost service add ucoin --log /var/log/ucoin.log
|
sudo yunohost service add $app --log /var/log/$app.log
|
||||||
|
|
||||||
|
# SSOwat Configuration
|
||||||
|
sudo yunohost app setting $app skipped_uris -v "/"
|
||||||
|
|
||||||
|
# Add proxy_pass
|
||||||
|
sudo sed -i "s@YNH_EXAMPLE_PATH@$path@" ../conf/nginx.conf
|
||||||
|
sudo sed -i "s@YNH_EXAMPLE_PORT@$port@" ../conf/nginx.conf
|
||||||
|
sudo sed -i "s@YNH_EXEMPLE_DOMAIN@$domain@" ../conf/nginx.conf
|
||||||
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
sudo service nginx reload
|
||||||
|
|
|
@ -2,15 +2,24 @@
|
||||||
|
|
||||||
#set -e
|
#set -e
|
||||||
|
|
||||||
|
app=ucoin
|
||||||
|
domain=$(sudo yunohost app setting $app domain)
|
||||||
|
port=$(sudo yunohost app setting $app port)
|
||||||
|
|
||||||
# Remove uCoin node daemon
|
# Remove uCoin node daemon
|
||||||
pm2 delete ucoin
|
sudo pm2 delete ucoin
|
||||||
|
|
||||||
# Remove uCoin node
|
# Remove uCoin node
|
||||||
sudo npm remove ucoin
|
#sudo npm remove ucoin
|
||||||
|
sudo rm -rf /home/yunohost.app/ucoin
|
||||||
|
|
||||||
# Remove uCoin service to YunoHost monitoring
|
# Remove uCoin service to YunoHost monitoring
|
||||||
sudo yunohost service remove ucoin
|
sudo yunohost service remove ucoin
|
||||||
|
|
||||||
|
# Remove proxy_pass
|
||||||
|
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
sudo service nginx reload
|
||||||
|
|
||||||
# I can't remove thoses packages which could be used by other apps
|
# I can't remove thoses packages which could be used by other apps
|
||||||
#sudo npm remove pm2
|
#sudo npm remove pm2
|
||||||
#sudo apt -y -qq remove nodejs npm
|
#sudo apt -y -qq remove nodejs npm
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
#set -e
|
#set -e
|
||||||
|
|
||||||
# Stop uCoin daemon
|
app=ucoin
|
||||||
pm2 stop ucoin
|
data_path=$(sudo yunohost app setting $app data_path)
|
||||||
|
|
||||||
# Upgrade ucoin package
|
# Upgrade uCoin package
|
||||||
cd /home/yunohost.app/ucoin
|
cd $data_path
|
||||||
git pull
|
git pull
|
||||||
sudo npm install -g .
|
sudo npm install
|
||||||
|
|
||||||
# Restart uCoin daemon
|
# Update uCoin daemon
|
||||||
pm2 restart ucoin
|
sudo pm2 update ucoin
|
||||||
|
|
Loading…
Reference in a new issue