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

first commit

This commit is contained in:
Moul 2015-05-24 17:01:16 -04:00
parent ce9e5ce64a
commit ecd048b3d7
5 changed files with 158 additions and 0 deletions

6
README.md Normal file
View file

@ -0,0 +1,6 @@
# uCoin for YunoHost
* [uCoin project](http://ucoin.io)
* [YunoHost project](https://yunohost.org/#/)
* For Debian Jessie

69
manifest.json Normal file
View file

@ -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 dinstallation 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"
}
}
]
}
}

39
scripts/install Executable file
View file

@ -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

17
scripts/remove Executable file
View file

@ -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

27
scripts/upgrade Executable file
View file

@ -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