mirror of
https://github.com/YunoHost-Apps/duniter_ynh.git
synced 2024-09-03 18:26:35 +02:00
60 lines
1.4 KiB
Bash
Executable file
60 lines
1.4 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#set -e
|
|
|
|
# Retrieve arguments
|
|
app=ucoin
|
|
domain=$1
|
|
path=$2
|
|
port=$3
|
|
sync_node=$4
|
|
sync_port=$5
|
|
salt=$6
|
|
password=$7
|
|
#cpu=$(($7/100))
|
|
#cpu=`expr $7 / 100`
|
|
|
|
# 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
|
|
if [[ ! $? -eq 0 ]]; then
|
|
exit 1
|
|
fi
|
|
|
|
# Open port on firewall
|
|
sudo yunohost firewall allow TCP $port > /dev/null 2>&1
|
|
|
|
# Store config on YunoHost instance
|
|
sudo yunohost app setting $app port -v $port
|
|
|
|
# Install uCoin
|
|
sudo bash ../sources/install.sh
|
|
exec bash -l
|
|
|
|
# Configure uCoin node
|
|
ucoind init --autoconf
|
|
ucoind config --remoteh $domain --port $port --remotep $port --salt $salt --passwd $password # --cpu $cpu
|
|
|
|
# Synchronize uCoin node
|
|
echo "Synchronizing with $sync_node:$sync_port"
|
|
ucoind sync $sync_node $sync_port --nointeractive > /dev/null 2>&1
|
|
|
|
# Launch uCoin node
|
|
ucoind start
|
|
|
|
# Add uCoin service to the YunoHost monitoring
|
|
sudo yunohost service add $app --log /root/.config/ucoin/ucoin_default/ucoin.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
|