mirror of
https://github.com/YunoHost-Apps/rocketchat_ynh.git
synced 2024-09-03 20:16:25 +02:00
75 lines
1.6 KiB
Text
75 lines
1.6 KiB
Text
|
#!/bin/bash
|
||
|
|
||
|
#Retrieve arguments
|
||
|
domain=$1
|
||
|
path=$2
|
||
|
is_public=$3
|
||
|
|
||
|
# Check domain/path availability
|
||
|
sudo yunohost app checkurl $domain$path -a rocketchat
|
||
|
if [[ ! $? -eq 0 ]]; then
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
# Save specific settings
|
||
|
sudo yunohost app setting rocketchat is_public -v $is_public
|
||
|
|
||
|
# Remove trailing "/" for next commands
|
||
|
path=${path%/}
|
||
|
|
||
|
|
||
|
#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 curl graphicsmagick
|
||
|
sudo apt-get install -y npm
|
||
|
sudo npm install -g n
|
||
|
|
||
|
# Meteor needs at least this version of node to work.
|
||
|
sudo n 0.10.40
|
||
|
|
||
|
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf*
|
||
|
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf*
|
||
|
if [ "$path" = "" ];
|
||
|
then
|
||
|
sudo cp ../conf/nginx.conf-nosub /etc/nginx/conf.d/$domain.d/rocketchat.conf
|
||
|
else
|
||
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/rocketchat.conf
|
||
|
fi
|
||
|
|
||
|
|
||
|
|
||
|
# Copy files to the right place
|
||
|
final_path=/var/www/rocketchat
|
||
|
sudo mkdir -p $final_path
|
||
|
sudo cp -a ../sources/* $final_path
|
||
|
|
||
|
sudo cp ../conf/Rocketchat.service /etc/systemd/system/
|
||
|
|
||
|
cd $final_path/programs/server/
|
||
|
|
||
|
sudo npm install
|
||
|
|
||
|
cd $final_path/
|
||
|
|
||
|
sudo chmod +x /var/www/rocketchat/bin/rockit
|
||
|
|
||
|
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
|
||
|
|
||
|
sudo yunohost app ssowatconf
|
||
|
|
||
|
|
||
|
|