1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/rocketchat_ynh.git synced 2024-09-03 20:16:25 +02:00
rocketchat_ynh/scripts/install

68 lines
1.7 KiB
Text
Raw Normal View History

2016-04-29 16:32:48 +02:00
#!/bin/bash
#Retrieve arguments
domain=$1
2016-04-29 21:02:20 +02:00
is_public=$2
ROCKETCHAT_VERSION=0.57.2
NODE_VERSION=4.7.1
2016-04-29 16:32:48 +02:00
# Check domain/path availability
2016-04-29 21:24:00 +02:00
sudo yunohost app checkurl $domain -a rocketchat
2016-04-29 16:32:48 +02:00
if [[ ! $? -eq 0 ]]; then
exit 1
fi
# Save specific settings
sudo yunohost app setting rocketchat is_public -v $is_public
#Install dependencies
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org gunzip curl graphicsmagick npm n
2016-04-29 16:32:48 +02:00
# Meteor needs at least this version of node to work.
sudo n $NODE_VERSION
2016-04-29 16:32:48 +02:00
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf*
2016-04-29 21:02:20 +02:00
sed -i "s@CHANGEMETOROOTURL@$domain/@g" ../conf/Rocketchat.service
2016-04-29 18:16:29 +02:00
2016-04-29 21:02:20 +02:00
sudo cp ../conf/nginx.conf-nosub /etc/nginx/conf.d/$domain.d/rocketchat.conf
2016-04-29 16:32:48 +02:00
2016-04-29 18:08:30 +02:00
pkgdir=$(pwd)
2016-04-29 16:32:48 +02:00
# Copy files to the right place
final_path=/var/www/rocketchat
sudo mkdir -p $final_path
# download and extract rocketchat
cd /tmp && curl -sO https://rocket.chat/releases/$ROCKETCHAT_VERSION/download
cd $final_path && gunzip -c /tmp/rocket.chat-$ROCKETCHAT_VERSION.gtar | tar xvf -
cd $final_path && rm -r PaxHeader && mv bundle/** .
2016-04-29 16:32:48 +02:00
sudo cp ../conf/Rocketchat.service /etc/systemd/system/
cd $final_path/programs/server/
sudo npm install
cd $final_path/
sudo chown -R www-data: $final_path
sudo service nginx reload
if [ "$is_public" = "Yes" ];
then
sudo yunohost app setting rocketchat unprotected_uris -v "/"
fi
sudo systemctl start Rocketchat.service
sudo systemctl enable Rocketchat.service
2016-04-29 21:50:20 +02:00
sleep 25s
2016-04-29 18:08:30 +02:00
cd $pkgdir
sudo mongo < ../conf/rocketchat_ldap.js
2016-04-29 16:32:48 +02:00
sudo yunohost app ssowatconf