1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/rocketchat_ynh.git synced 2024-09-03 20:16:25 +02:00
This commit is contained in:
Jonathan Dahan 2017-10-10 16:20:33 +00:00 committed by GitHub
commit 24a9487362
2 changed files with 36 additions and 14 deletions

View file

@ -5,18 +5,37 @@ ROCKETCHAT_SHASUM=ed53712b37571b959b5c8c8947d6335c21fced316f2b3174bfe027fa25700c
NODE_VERSION=4.7.1
waitforservice() {
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 | \
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
isup=false
seconds=90
while [ $seconds -gt 0 ]; do
echo "Waiting approx. $seconds seconds..."
seconds=$(( $seconds - 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
$isup && echo "service is up" || ynh_die "$app could not be started"
}
installdeps(){
mongo=mongod
if [ $(dpkg --print-architecture) == "armhf" ]; then
#Install mongodb for debian armhf
# We instal this for the user and service files
sudo apt-get update
sudo apt-get install -y mongodb-server
# Rocket chat requires mongodb > 2.4, which raspbian does not provide
tarball=mongodb-linux-i686-v3.2-latest.tgz
wget http://downloads.mongodb.org/linux/$tarball
tar xf tarball
sudo cp ${tarball%%.tgz}*/bin/* /usr/local/bin
sudo sed -i -e's/bin/local\/bin/' /lib/systemd/system/mongodb.service
mongo=mongodb
else
#Install mongodb for debian x86/x64
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
@ -26,11 +45,11 @@ installdeps(){
fi
# start mongodb service
sudo systemctl enable mongod.service
sudo systemctl start mongod.service
sudo systemctl enable ${mongo}.service
sudo systemctl start ${mongo}.service
# add mongodb to services
sudo yunohost service add mongod -l /var/log/mongodb/mongod.log
sudo yunohost service add ${mongo} -l /var/log/mongodb/${mongo}.log
#Install other dependencies
sudo apt-get install -y gzip curl graphicsmagick npm

View file

@ -82,15 +82,18 @@ sed -i "s@#DESTDIR#@$final_path@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf "$nginx_conf"
# download and extract rocketchat
echo "Downloading rocket.chat-$ROCKETCHAT_VERSION.gtar from https://rocket.chat/releases/${ROCKETCHAT_VERSION}/download."
sudo curl -s -L -o $final_path/rocket.chat-$ROCKETCHAT_VERSION.gtar "https://rocket.chat/releases/${ROCKETCHAT_VERSION}/download"
SHA_DOWNLOAD=$(sha256sum $final_path/rocket.chat-$ROCKETCHAT_VERSION.gtar | grep -o "^[a-f0-9]*")
tarball=rocket.chat-$ROCKETCHAT_VERSION.gtar
tarpath=$final_path/$tarball
url=https://rocket.chat/releases/${ROCKETCHAT_VERSION}/download
echo "Downloading $tarball from $url"
sudo curl -s -L -o $tarpath "$url"
SHA_DOWNLOAD=$(sha256sum $tarpath | grep -o "^[a-f0-9]*")
if [[ ! "$SHA_DOWNLOAD" == "$ROCKETCHAT_SHASUM" ]]; then
ynh_die "The sha256sum does not match the configured one"
fi
sudo tar -xzf $final_path/rocket.chat-$ROCKETCHAT_VERSION.gtar -C $final_path --strip-components=1 bundle
sudo rm $final_path/rocket.chat-$ROCKETCHAT_VERSION.gtar
sudo tar -xzf $tarpath -C $final_path --strip-components=1 bundle
sudo rm $tarpath
sudo chown -R $serviceuser: $final_path
@ -103,7 +106,7 @@ cd $workdir
sudo systemctl reload nginx
if [ "$is_public" = "Yes" ];
then
ynh_app_setting_set "$app" skipped_uris "/"
ynh_app_setting_set "$app" skipped_uris "/"
fi
sudo systemctl start rocketchat.service