1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/duniter_ynh.git synced 2024-09-03 18:26:35 +02:00
duniter_ynh/scripts/install

49 lines
1.2 KiB
Text
Raw Normal View History

2015-05-24 23:01:16 +02:00
#!/bin/bash
#set -e
2015-05-24 23:01:16 +02:00
# Retrieve arguments
domain=$1
port=$2
sync_node=$3
sync_port=$4
salt=$5
psswd=$6
#cpu=$(($7/100))
2015-06-02 23:57:56 +02:00
#cpu=`expr $7 / 100`
path=/home/yunohost.app/ucoin
ucoin="node --harmony $path/bin/ucoind"
2015-05-24 23:01:16 +02:00
# 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
2015-05-24 23:01:16 +02:00
# 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
2015-05-24 23:01:16 +02:00
# Check port availability
sudo yunohost app checkport $port
if [[ ! $? -eq 0 ]]; then
exit 1
fi
# Open port on firewall
2015-05-24 23:01:16 +02:00
sudo yunohost firewall allow TCP $port > /dev/null 2>&1
2015-06-02 22:53:19 +02:00
# Configure and sync 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
2015-05-24 23:01:16 +02:00
# Launch uCoin node with pm2 daemon
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