diff --git a/README.md b/README.md new file mode 100644 index 0000000..2b2b684 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# uCoin for YunoHost + +* [uCoin project](http://ucoin.io) +* [YunoHost project](https://yunohost.org/#/) + +* For Debian Jessie diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..9a70f83 --- /dev/null +++ b/manifest.json @@ -0,0 +1,69 @@ +{ + "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œux 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/", + "licence": "MIT", + "maintainer": { + "name": "Moul", + "email": "moul@moul.re", + "url": "https://moul.re/" + }, + "multi_instance": "true", + "arguments": { + "install" : [ + { + "name": "domain", + "ask": { + "en": "Domain name for uCoin node installation", + "fr": "Nom de domaine d’installation du nœud uCoin" + }, + "example": "example.com" + }, + { + "name": "port", + "ask": { + "en": "Port of uCoin node", + "fr": "Port du nœud uCoin" + }, + "example": "9201", + "default": "9201" + }, + { + "name": "sync_node", + "ask": { + "en": "Node to synchronise with", + "fr": "Nœud avec lequel synchroniser" + }, + "example": "metab.ucoin.io", + "default": "metab.ucoin.io" + }, + { + "name": "sync_port", + "ask": { + "en": "Port to synchronise with", + "fr": "Port avec lequel faire la synchronisation" + }, + "example": "9201", + "default": "9201" + }, + { + "name": "salt", + "ask": { + "en": "Enter salt of your account", + "fr": "Entrez le salt de votre compte" + } + }, + { + "name": "pwd", + "ask": { + "en": "Password of your account", + "fr": "Mot de passe de votre compte" + } + } + ] + } +} diff --git a/scripts/install b/scripts/install new file mode 100755 index 0000000..f09e80b --- /dev/null +++ b/scripts/install @@ -0,0 +1,39 @@ +#!/bin/bash + +# Retrieve arguments +domain=$1 +port=$2 +sync_node=$3 +sync_port=$4 +salt=$5 +pwd=$6 + +# Install dependencies: nodejs, npm +sudo apt-get -y -qq install nodejs npm nodejs-legacy +sudo npm install -g npm +sudo apt-get -y -qq install node-gyp + +# Install uCoin node and pm2 daemon manager +sudo npm install -g ucoin pm2 + +# Check port availability +sudo yunohost app checkport $port +if [[ ! $? -eq 0 ]]; then + exit 1 +fi + +# Open port in firewall +sudo yunohost firewall allow TCP $port > /dev/null 2>&1 + +# Init and configure uCoin node +ucoind init $sync_node $sync_port +ucoind config --noupnp --remoteh $domain --port $port --salt $salt --passwd $pwd + +# Launch uCoin node with daemon pm2 +pm2 start /usr/bin/ucoind -- start --noupnp + +# Add uCoin daemon to the YunoHost monitoring +#sudo yunohost service add ucoin --log pm2 logs + +# Reload SSOwat +#sudo yunohost app ssowatconf diff --git a/scripts/remove b/scripts/remove new file mode 100755 index 0000000..92641d6 --- /dev/null +++ b/scripts/remove @@ -0,0 +1,17 @@ +#!/bin/bash + +# Retrieve argument +port=$2 + +# Delete uCoin node daemon +pm2 delete ucoind + +# Remove uCoin node +sudo npm remove ucoin pm2 +sudo apt-get -y remove nodejs node-gyp npm + +# Close opened port +sudo yunohost firewall disallow TCP $port + +# Reload SSOwat +sudo yunohost app ssowatconf diff --git a/scripts/upgrade b/scripts/upgrade new file mode 100755 index 0000000..113c925 --- /dev/null +++ b/scripts/upgrade @@ -0,0 +1,27 @@ +#!/bin/bash +app=ucoin + +# Retrieve arguments +domain=$(sudo yunohost app setting $app domain) +path=$(sudo yunohost app setting $app path) +is_public=$(sudo yunohost app setting $app is_public) + +# Remove trailing "/" for next commands +path=${path%/} + +# Upgrade ucoin package +sudo apt-get update + +# If app is public, add url to SSOWat conf as skipped_uris +if [ "$is_public" = "Yes" ]; +then + # See install script + sudo yunohost app setting $app unprotected_uris -v "/" + # Remove old settings + sudo yunohost app setting $app skipped_uris -d +fi + +# Restart services +sudo service nginx reload +sudo yunohost app ssowatconf +