1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/duniter_ynh.git synced 2024-09-03 18:26:35 +02:00
This commit is contained in:
Moul 2015-12-02 21:41:55 +01:00
parent de060047d7
commit 940f146d5f
4 changed files with 46 additions and 25 deletions

View file

@ -3,10 +3,10 @@
"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 chainblocks writing. Monetary system with universal dividende, libre money, Relative Money Theory",
"fr": "Nœux 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"
}, },
"url": "http://ucoin.io/", "url": "http://ucoin.io/",
"licence": "GPL3", "licence": "free",
"maintainer": { "maintainer": {
"name": "Moul", "name": "Moul",
"email": "moul@moul.re", "email": "moul@moul.re",
@ -29,8 +29,8 @@
"en": "Port of uCoin node", "en": "Port of uCoin node",
"fr": "Port du nœud uCoin" "fr": "Port du nœud uCoin"
}, },
"example": "9201", "example": "8999",
"default": "9201" "default": "8999"
}, },
{ {
"name": "sync_node", "name": "sync_node",
@ -58,7 +58,8 @@
} }
}, },
{ {
"name": "pwd", "name": "psswd",
"type": "password",
"ask": { "ask": {
"en": "Password of your account", "en": "Password of your account",
"fr": "Mot de passe de votre compte" "fr": "Mot de passe de votre compte"

View file

@ -1,23 +1,31 @@
#!/bin/bash #!/bin/bash
#set -e
# Retrieve arguments # Retrieve arguments
#ipv4=$(ifconfig | grep "inet addr:" | sed '1!d' | cut -d : -f 2 | cut -b -14)
#ipv4=$(traceroute -4 maelstro.me | grep ms | cut -d " " -f 4)
domain=$1 domain=$1
port=$2 port=$2
sync_node=$3 sync_node=$3
sync_port=$4 sync_port=$4
salt=$5 salt=$5
pwd=$6 psswd=$6
#cpu=$(($7/100)) #cpu=$(($7/100))
#cpu=`expr $7 / 100` #cpu=`expr $7 / 100`
path=/home/yunohost.app/ucoin
ucoin="node --harmony $path/bin/ucoind"
# Install dependencies: nodejs, npm # Install dependencies: nodejs 0.12.x, npm
sudo apt-get -y -qq install nodejs npm nodejs-legacy #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 # Install uCoin node and pm2 daemon manager
git clone https://github.com/ucoin-io/ucoin /tmp/ucoin cd /home/yunohost.app/
sudo npm install -g /tmp/ucoin pm2 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
@ -29,9 +37,12 @@ fi
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 # Configure and sync uCoin node
ucoind config --noupnp --ipv4 $ipv4 --remote4 $ipv4 --remoteh $domain --port $port --remotep $port --salt $salt --passwd $pwd $ucoin init --autoconf
# --cpu $cpu $ucoin config --remoteh $domain --port $port --remotep $port --salt $salt --passwd $psswd # --cpu $cpu
ucoind sync $sync_node $sync_port $ucoin sync $sync_node $sync_port # --nocautious
# Launch uCoin node with pm2 daemon # Launch uCoin node with pm2 daemon
pm2 start ucoind -- start pm2 start $path/bin/ucoind --name ucoin --interpreter=node --node-args="--harmony" --log /var/log/ucoin.log -- start
# Add uCoin service to the YunoHost monitoring
sudo yunohost service add ucoin --log /var/log/ucoin.log

View file

@ -1,14 +1,19 @@
#!/bin/bash #!/bin/bash
# Retrieve argument #set -e
port=$2
# Delete uCoin node daemon # Remove uCoin node daemon
pm2 delete ucoind pm2 delete ucoin
# Remove uCoin node # Remove uCoin node
sudo npm remove ucoin pm2 sudo npm remove ucoin
#sudo apt-get -y remove nodejs npm
# Remove uCoin service to YunoHost monitoring
sudo yunohost service remove ucoin
# I can't remove thoses packages which could be used by other apps
#sudo npm remove pm2
#sudo apt -y -qq remove nodejs npm
# Close opened port # Close opened port
sudo yunohost firewall disallow TCP $port sudo yunohost firewall disallow TCP $port

View file

@ -1,10 +1,14 @@
#!/bin/bash #!/bin/bash
#set -e
# Stop uCoin daemon # Stop uCoin daemon
pm2 stop ucoind pm2 stop ucoin
# Upgrade ucoin package # Upgrade ucoin package
sudo npm install -g ucoin cd /home/yunohost.app/ucoin
git pull
sudo npm install -g .
# Restart uCoin daemon # Restart uCoin daemon
pm2 restart ucoind pm2 restart ucoin