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

add multiple instances support

This commit is contained in:
Clément 2018-05-05 12:37:51 +02:00
parent 372c00d2f2
commit 51603b2f58
4 changed files with 15 additions and 10 deletions

View file

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

View file

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

View file

@ -13,7 +13,7 @@
"email": "selamanse@scheinfrei.info",
"url": "https://github.com/selamanse"
},
"multi_instance": false,
"multi_instance": true,
"services": [
"nginx"
],

View file

@ -27,6 +27,7 @@ is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANG
app=$YNH_APP_INSTANCE_NAME
dbname=$app
serviceuser=rocketchat
workdir=$(pwd)
@ -81,7 +82,9 @@ sed -i "s@#ROOTURL#@$domain@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@#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
# Copy and set nginx configuration
@ -90,7 +93,9 @@ sed -i "s@#APP#@$app@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@#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"
@ -119,18 +124,18 @@ then
ynh_app_setting_set "$app" skipped_uris "/"
fi
sudo systemctl start rocketchat.service
sudo systemctl enable rocketchat.service
sudo systemctl start $app.service
sudo systemctl enable $app.service
# add rocketchat to services
sudo yunohost service add rocketchat
sudo yunohost service add $app
# wait for rocketchat to populate db and start
waitforservice
sudo mongo < ../conf/rocketchat_ldap.js
sudo systemctl restart rocketchat.service
sudo systemctl restart $app.service
waitforservice