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)
|
||||
* [YunoHost project](https://yunohost.org/#/)
|
||||
* 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",
|
||||
"id": "ucoin",
|
||||
"description": {
|
||||
"en": "uCoin node which permits participate chainblocks writing. Monetary system with universal dividende, libre money, Relative Money Theory",
|
||||
"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"
|
||||
"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. Ce paquet permet de rejoindre une monnaie déjà existante."
|
||||
},
|
||||
"url": "http://ucoin.io/",
|
||||
"licence": "free",
|
||||
"license": "free",
|
||||
"maintainer": {
|
||||
"name": "Moul",
|
||||
"email": "moul@moul.re",
|
||||
"url": "https://moul.re/"
|
||||
},
|
||||
"multi_instance": "true",
|
||||
"services": [
|
||||
"nginx"
|
||||
],
|
||||
"arguments": {
|
||||
"install" : [
|
||||
{
|
||||
"name": "domain",
|
||||
"ask": {
|
||||
"en": "Domain name on which install uCoin node",
|
||||
"fr": "Nom de domaine sur lequel installer le nœud uCoin"
|
||||
"en": "Domain name",
|
||||
"fr": "Nom de domaine"
|
||||
},
|
||||
"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",
|
||||
"ask": {
|
||||
|
@ -35,8 +47,8 @@
|
|||
{
|
||||
"name": "sync_node",
|
||||
"ask": {
|
||||
"en": "Node which synchronise with",
|
||||
"fr": "Nœud avec lequel faire la synchronisation"
|
||||
"en": "Node's address to synchronise with",
|
||||
"fr": "Adresse du nœud avec lequel se synchroniser"
|
||||
},
|
||||
"example": "metab.ucoin.io",
|
||||
"default": "metab.ucoin.io"
|
||||
|
@ -58,7 +70,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"name": "psswd",
|
||||
"name": "password",
|
||||
"type": "password",
|
||||
"ask": {
|
||||
"en": "Password of your account",
|
||||
|
|
|
@ -3,29 +3,22 @@
|
|||
#set -e
|
||||
|
||||
# Retrieve arguments
|
||||
app=ucoin
|
||||
domain=$1
|
||||
port=$2
|
||||
sync_node=$3
|
||||
sync_port=$4
|
||||
salt=$5
|
||||
psswd=$6
|
||||
path=$2
|
||||
port=$3
|
||||
sync_node=$4
|
||||
sync_port=$5
|
||||
salt=$6
|
||||
password=$7
|
||||
#cpu=$(($7/100))
|
||||
#cpu=`expr $7 / 100`
|
||||
path=/home/yunohost.app/ucoin
|
||||
ucoin="node --harmony $path/bin/ucoind"
|
||||
data_path=/home/yunohost.app/ucoin
|
||||
ucoin="node --harmony $data_path/bin/ucoind"
|
||||
|
||||
# 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 $path
|
||||
sudo npm install
|
||||
sudo npm install -g pm2
|
||||
# Check domain/path availability
|
||||
sudo yunohost app checkurl $domain$path -a $app \
|
||||
|| (echo "Path not available: $domain$path" && exit 1)
|
||||
|
||||
# Check port availability
|
||||
sudo yunohost app checkport $port
|
||||
|
@ -36,13 +29,43 @@ fi
|
|||
# Open port on firewall
|
||||
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 config --remoteh $domain --port $port --remotep $port --salt $salt --passwd $psswd # --cpu $cpu
|
||||
$ucoin sync $sync_node $sync_port # --nocautious
|
||||
$ucoin config --remoteh $domain --port $port --remotep $port --salt $salt --passwd $password # --cpu $cpu
|
||||
|
||||
# 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
|
||||
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
|
||||
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
|
||||
|
||||
app=ucoin
|
||||
domain=$(sudo yunohost app setting $app domain)
|
||||
port=$(sudo yunohost app setting $app port)
|
||||
|
||||
# Remove uCoin node daemon
|
||||
pm2 delete ucoin
|
||||
sudo pm2 delete ucoin
|
||||
|
||||
# Remove uCoin node
|
||||
sudo npm remove ucoin
|
||||
#sudo npm remove ucoin
|
||||
sudo rm -rf /home/yunohost.app/ucoin
|
||||
|
||||
# Remove uCoin service to YunoHost monitoring
|
||||
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
|
||||
#sudo npm remove pm2
|
||||
#sudo apt -y -qq remove nodejs npm
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
#set -e
|
||||
|
||||
# Stop uCoin daemon
|
||||
pm2 stop ucoin
|
||||
app=ucoin
|
||||
data_path=$(sudo yunohost app setting $app data_path)
|
||||
|
||||
# Upgrade ucoin package
|
||||
cd /home/yunohost.app/ucoin
|
||||
# Upgrade uCoin package
|
||||
cd $data_path
|
||||
git pull
|
||||
sudo npm install -g .
|
||||
sudo npm install
|
||||
|
||||
# Restart uCoin daemon
|
||||
pm2 restart ucoin
|
||||
# Update uCoin daemon
|
||||
sudo pm2 update ucoin
|
||||
|
|
Loading…
Reference in a new issue