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

Merge pull request #47 from plopoyop/master

fixes, new feature and upgrade
This commit is contained in:
Selamanse 2018-05-15 21:30:26 +02:00 committed by GitHub
commit da187b970d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 12 deletions

View file

@ -4,7 +4,7 @@ After=network.target
[Service] [Service]
Type=simple Type=simple
WorkingDirectory=/var/lib/rocketchat WorkingDirectory=#DESTDIR#
User=#USER# User=#USER#
ExecStart=/usr/local/bin/node main.js ExecStart=/usr/local/bin/node main.js
Restart=always Restart=always
@ -12,7 +12,7 @@ SyslogIdentifier=rocketchat
Environment="BIND_IP=127.0.0.1" Environment="BIND_IP=127.0.0.1"
Environment="ROOT_URL=https://#ROOTURL##LOCATION#" Environment="ROOT_URL=https://#ROOTURL##LOCATION#"
Environment="PORT=#PORT#" Environment="PORT=#PORT#"
Environment="MONGO_URL=mongodb://localhost:27017/rocketchat" Environment="MONGO_URL=mongodb://localhost:27017/#DBNAME#"
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -1,4 +1,4 @@
use rocketchat use #DBNAME#
db.rocketchat_settings.update( db.rocketchat_settings.update(

View file

@ -7,7 +7,7 @@
}, },
"url": "https://github.com/YunoHost-Apps/rocketchat_ynh", "url": "https://github.com/YunoHost-Apps/rocketchat_ynh",
"license": "GPL-3.0", "license": "GPL-3.0",
"version": "0.64.0", "version": "0.64.1",
"maintainer": { "maintainer": {
"name": "selamanse", "name": "selamanse",
"email": "selamanse@scheinfrei.info", "email": "selamanse@scheinfrei.info",

View file

@ -1,7 +1,7 @@
# common.sh # common.sh
ROCKETCHAT_VERSION=0.64.0 ROCKETCHAT_VERSION=0.64.1
ROCKETCHAT_SHASUM=06aa2c6307c784bc19885fb1e80e1eb7320601c9bc2bfbb0f48c9941d93c6030 ROCKETCHAT_SHASUM=8c97b33d9efea7edc2db72462c866ea1c8c4f7054988bebb9fd028c8d6219ec0
NODE_VERSION=8.9.4 NODE_VERSION=8.9.4
checkcmd() { checkcmd() {

View file

@ -27,6 +27,7 @@ is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANG language=$YNH_APP_ARG_LANG
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
dbname=$app
serviceuser=rocketchat serviceuser=rocketchat
workdir=$(pwd) workdir=$(pwd)
@ -34,6 +35,16 @@ workdir=$(pwd)
# find suitable port (default 3000) # find suitable port (default 3000)
port=$(ynh_find_port 3000) port=$(ynh_find_port 3000)
# if path do not begin with / add a / at the begining
if [ "${path:0:1}" != "/" ]; then
path="/$path"
fi
# if path do not end with / add a / at the end
if [ "${path:${#path}-1}" != "/" ] && [ ${#path} -gt 1 ]; then
path="$path/"
fi
# Check domain/path availability # Check domain/path availability
ynh_webpath_available $domain $path ynh_webpath_available $domain $path
if [[ ! $? -eq 0 ]]; then if [[ ! $? -eq 0 ]]; then
@ -71,7 +82,9 @@ sed -i "s@#ROOTURL#@$domain@g" ../conf/rocketchat.service
sed -i "s@#LOCATION#@${path:-/}@g" ../conf/rocketchat.service sed -i "s@#LOCATION#@${path:-/}@g" ../conf/rocketchat.service
sed -i "s@#PORT#@$port@g" ../conf/rocketchat.service sed -i "s@#PORT#@$port@g" ../conf/rocketchat.service
sed -i "s@#USER#@$serviceuser@g" ../conf/rocketchat.service sed -i "s@#USER#@$serviceuser@g" ../conf/rocketchat.service
sudo cp ../conf/rocketchat.service /etc/systemd/system/ sed -i "s@#DESTDIR#@$final_path@g" ../conf/rocketchat.service
sed -i "s@#DBNAME#@$dbname@g" ../conf/rocketchat.service
sudo cp ../conf/rocketchat.service /etc/systemd/system/$app.service
sudo systemctl daemon-reload sudo systemctl daemon-reload
# Copy and set nginx configuration # Copy and set nginx configuration
@ -80,7 +93,9 @@ sed -i "s@#APP#@$app@g" ../conf/nginx.conf
sed -i "s@#PATH#@$path@g" ../conf/nginx.conf sed -i "s@#PATH#@$path@g" ../conf/nginx.conf
sed -i "s@#PORT#@$port@g" ../conf/nginx.conf sed -i "s@#PORT#@$port@g" ../conf/nginx.conf
sed -i "s@#LOCATION#@${path:-/}@g" ../conf/nginx.conf sed -i "s@#LOCATION#@${path:-/}@g" ../conf/nginx.conf
sed -i "s@#DESTDIR#@$final_path@g" ../conf/nginx.conf
#set db name into ldap config
sed -i "s@#DBNAME#@$dbname@g" ../conf/rocketchat_ldap.js
sudo cp ../conf/nginx.conf "$nginx_conf" sudo cp ../conf/nginx.conf "$nginx_conf"
@ -109,18 +124,18 @@ then
ynh_app_setting_set "$app" skipped_uris "/" ynh_app_setting_set "$app" skipped_uris "/"
fi fi
sudo systemctl start rocketchat.service sudo systemctl start $app.service
sudo systemctl enable rocketchat.service sudo systemctl enable $app.service
# add rocketchat to services # add rocketchat to services
sudo yunohost service add rocketchat sudo yunohost service add $app
# wait for rocketchat to populate db and start # wait for rocketchat to populate db and start
waitforservice waitforservice
sudo mongo < ../conf/rocketchat_ldap.js sudo mongo < ../conf/rocketchat_ldap.js
sudo systemctl restart rocketchat.service sudo systemctl restart $app.service
waitforservice waitforservice