mirror of
https://github.com/YunoHost-Apps/nodebb_ynh.git
synced 2024-09-03 19:46:29 +02:00
Update install
This commit is contained in:
parent
5d1192bf44
commit
52ea065c2e
1 changed files with 31 additions and 32 deletions
|
@ -62,7 +62,7 @@ ynh_app_setting_set $app is_public $is_public
|
||||||
# FIND AND OPEN A PORT
|
# FIND AND OPEN A PORT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
port=$(ynh_find_port 3000) # Cherche un port libre.
|
port=$(ynh_find_port 4567) # Cherche un port libre.
|
||||||
ynh_app_setting_set $app port $port
|
ynh_app_setting_set $app port $port
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -70,7 +70,7 @@ ynh_app_setting_set $app port $port
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
sudo curl -sL https://deb.nodesource.com/setup_7.x | sudo bash -
|
sudo curl -sL https://deb.nodesource.com/setup_7.x | sudo bash -
|
||||||
sudo apt-get install -yy -qq nodejs
|
sudo apt-get install -yy -qq nodejs mongodb
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
@ -84,16 +84,15 @@ SETUP_SOURCE # Télécharge la source, décompresse et copie dans $final_path
|
||||||
# CREATE A SQL BDD
|
# CREATE A SQL BDD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
#pushd $final_path
|
pushd $final_path
|
||||||
# Setting up the database
|
dbname=$app
|
||||||
#dbname=$app
|
dbuser=$app
|
||||||
#dbuser=$app
|
dbpass=$(ynh_string_random)
|
||||||
|
sudo mongo <<< \
|
||||||
# Generate random password
|
"use $dbname;
|
||||||
#dbpass=$(ynh_string_random)
|
db.createUser( { user: "$dbuser", pwd: "$dbpass", roles: [ "readWrite" ] } );
|
||||||
##### dbpass
|
db.grantRolesToUser("$dbuser",[{ role: "clusterMonitor", db: "admin" }]);"
|
||||||
#ynh_psql_create_db "$dbname" "$dbuser" "$dbpass"
|
popd
|
||||||
#popd
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -127,6 +126,18 @@ sudo chown admin -R $install_log
|
||||||
# Configuration de logrotate
|
# Configuration de logrotate
|
||||||
ynh_use_logrotate
|
ynh_use_logrotate
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CONFIGURE SERVER.JS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
sudo mv ../conf/config.json $final_path/config.json
|
||||||
|
sudo sed -i "s@__URL__@$path_url@g" $final_path/config.json
|
||||||
|
sudo sed -i "s@__PORT__@$port@g" $final_path/config.json
|
||||||
|
sudo sed -i "s@__SECRET__@$secret@g" $final_path/config.json
|
||||||
|
sudo sed -i "s@dbuser@$dbuser@g" $final_path/config.json
|
||||||
|
sudo sed -i "s@dbname@$dbname@g" $final_path/config.json
|
||||||
|
sudo sed -i "s@dbuser@$dbpass@g" $final_path/config.json
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL ETHERPAD
|
# INSTALL ETHERPAD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -136,33 +147,18 @@ pushd "$final_path"
|
||||||
sudo npm install
|
sudo npm install
|
||||||
sudo npm install -g bower
|
sudo npm install -g bower
|
||||||
sudo chown -R $app: $final_path
|
sudo chown -R $app: $final_path
|
||||||
sudo su $app -c "cd $final_path && bower install chainpad#^0.4.0 -f && bower install -F"
|
sudo node app --setup <<< \
|
||||||
|
"$admin_user;
|
||||||
|
$admin_pass;"
|
||||||
|
sudo su $app -c "cd $final_path && bower install -F"
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CONFIGURE SERVER.JS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
sudo mv ../conf/config.js $final_path/config.js
|
|
||||||
sudo sed -i "s@__URL__@$path_url@g" $final_path/config.js
|
|
||||||
sudo sed -i "s@__PORT__@$port@g" $final_path/config.js
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL MODULES FOR CRYPTPAD
|
# INSTALL MODULES FOR CRYPTPAD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
#npm install cryptpad-level-store;
|
#npm install cryptpad-level-store;
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
sudo cp ../conf/cryptpad.service /etc/systemd/system/$app.service
|
|
||||||
sudo chown root: /etc/systemd/system/$app.service
|
|
||||||
sudo sed -i "s@__DIRECTORY__@$final_path/@g" /etc/systemd/system/$app.service
|
|
||||||
sudo sed -i "s@__APP__@$app@g" /etc/systemd/system/$app.service
|
|
||||||
## Démarrage auto du service
|
|
||||||
sudo systemctl enable $app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENABLE SERVICE IN ADMIN PANEL
|
# ENABLE SERVICE IN ADMIN PANEL
|
||||||
|
@ -175,7 +171,10 @@ sudo yunohost service add $app --log "/var/log/$app/cryptpad.log"
|
||||||
# START ETHERPAD IN BACKGROUND
|
# START ETHERPAD IN BACKGROUND
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
sudo systemctl start $app # Démarre etherpad. Le démarrage est fait le plus tôt possible, car il est très long...
|
|
||||||
|
pushd $final_path
|
||||||
|
./nodebb start # Démarre etherpad. Le démarrage est fait le plus tôt possible, car il est très long...
|
||||||
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
|
|
Loading…
Reference in a new issue