mirror of
https://github.com/YunoHost-Apps/rocketchat_ynh.git
synced 2024-09-03 20:16:25 +02:00
Add common install routine for restore
This commit is contained in:
parent
63b41a73d2
commit
43f0aafb8b
3 changed files with 33 additions and 17 deletions
|
@ -8,5 +8,24 @@ waitforservice() {
|
||||||
isup=false; x=90; while [ $x -gt 0 ];do echo "Waiting approx. $x seconds..."; \
|
isup=false; x=90; while [ $x -gt 0 ];do echo "Waiting approx. $x seconds..."; \
|
||||||
x=$(( $x - 1 )); sleep 1; if $(curl -m 1 -s localhost:$port${path:-/}/api/v1/info | \
|
x=$(( $x - 1 )); sleep 1; if $(curl -m 1 -s localhost:$port${path:-/}/api/v1/info | \
|
||||||
grep -e "success.*true" >/dev/null 2>&1); then isup=true; break; fi; done && if $isup; \
|
grep -e "success.*true" >/dev/null 2>&1); then isup=true; break; fi; done && if $isup; \
|
||||||
then echo "service is up"; else ynh_die "$app could not be started"; fi
|
then echo "service is up"; else {ynh_die "$app could not be started"; fi
|
||||||
|
}
|
||||||
|
|
||||||
|
installdeps(){
|
||||||
|
#Install dependencies
|
||||||
|
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
|
||||||
|
echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y mongodb-org gzip curl graphicsmagick npm
|
||||||
|
|
||||||
|
# start mongodb service
|
||||||
|
sudo systemctl enable mongod.service
|
||||||
|
sudo systemctl start mongod.service
|
||||||
|
|
||||||
|
# add mongodb to services
|
||||||
|
sudo yunohost service add mongod -l /var/log/mongodb/mongod.log
|
||||||
|
|
||||||
|
# Meteor needs at least this version of node to work.
|
||||||
|
sudo npm install -g n
|
||||||
|
sudo n $NODE_VERSION
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,21 +55,7 @@ ynh_app_setting_set $app path $path
|
||||||
ynh_app_setting_set $app is_public $is_public
|
ynh_app_setting_set $app is_public $is_public
|
||||||
|
|
||||||
#Install dependencies
|
#Install dependencies
|
||||||
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
|
installdeps
|
||||||
echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y mongodb-org gzip curl graphicsmagick npm
|
|
||||||
|
|
||||||
# start mongodb service
|
|
||||||
sudo systemctl enable mongod.service
|
|
||||||
sudo systemctl start mongod.service
|
|
||||||
|
|
||||||
# add mongodb to services
|
|
||||||
sudo yunohost service add mongod -l /var/log/mongodb/mongod.log
|
|
||||||
|
|
||||||
# Meteor needs at least this version of node to work.
|
|
||||||
sudo npm install -g n
|
|
||||||
sudo n $NODE_VERSION
|
|
||||||
|
|
||||||
# Create destination
|
# Create destination
|
||||||
sudo mkdir -p $final_path
|
sudo mkdir -p $final_path
|
||||||
|
|
|
@ -4,7 +4,12 @@ set -eu
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
if [ ! -e _common ]; then
|
||||||
|
# Fetch helpers file if not in current directory
|
||||||
|
sudo cp ../settings/scripts/_common.sh ./_common.sh
|
||||||
|
sudo chmod a+rx _common
|
||||||
|
fi
|
||||||
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -64,6 +69,12 @@ sudo systemctl enable rocketchat
|
||||||
sudo tar -xzf ./rocket.chat.gtar -C $final_path
|
sudo tar -xzf ./rocket.chat.gtar -C $final_path
|
||||||
sudo chown -R $serviceuser: $final_path
|
sudo chown -R $serviceuser: $final_path
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INSTALL DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
installdeps
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE MONGODB
|
# RESTORE THE MONGODB
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue