mirror of
https://github.com/YunoHost-Apps/rocketchat_ynh.git
synced 2024-09-03 20:16:25 +02:00
Fix linter issues
This commit is contained in:
parent
28a2bf66a3
commit
6bb0d1166c
6 changed files with 55 additions and 53 deletions
|
@ -41,6 +41,7 @@
|
|||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Is it a public application?"
|
||||
},
|
||||
|
@ -49,6 +50,7 @@
|
|||
},
|
||||
{
|
||||
"name": "lang",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Select default language"
|
||||
},
|
||||
|
|
|
@ -36,4 +36,4 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/nginx"
|
|||
# BACKUP THE MONGODB DATABASE
|
||||
#=================================================
|
||||
|
||||
sudo mongodump -o "./dump"
|
||||
mongodump -o "./dump"
|
||||
|
|
|
@ -82,35 +82,35 @@ ynh_app_setting_set $app is_public $is_public
|
|||
installdeps
|
||||
|
||||
# Create destination
|
||||
sudo mkdir -p $final_path
|
||||
mkdir -p $final_path
|
||||
|
||||
# Create user
|
||||
id -u $serviceuser || sudo useradd -d "$final_path" -M $serviceuser
|
||||
id -u $serviceuser || useradd -d "$final_path" -M $serviceuser
|
||||
|
||||
# Copy and set systemd configuration
|
||||
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
|
||||
sed -i "s@#DESTDIR#@$final_path@g" ../conf/rocketchat.service
|
||||
sed -i "s@#DBNAME#@$dbname@g" ../conf/rocketchat.service
|
||||
ynh_replace_string "s@#ROOTURL#@$domain@g" ../conf/rocketchat.service
|
||||
ynh_replace_string "s@#LOCATION#@${path:-/}@g" ../conf/rocketchat.service
|
||||
ynh_replace_string "s@#PORT#@$port@g" ../conf/rocketchat.service
|
||||
ynh_replace_string "s@#USER#@$serviceuser@g" ../conf/rocketchat.service
|
||||
ynh_replace_string "s@#DESTDIR#@$final_path@g" ../conf/rocketchat.service
|
||||
ynh_replace_string "s@#DBNAME#@$dbname@g" ../conf/rocketchat.service
|
||||
# absolute node path needed
|
||||
NODE_BIN=$(which node)
|
||||
sed -i "s@#NODE#@$NODE_BIN@g" ../conf/rocketchat.service
|
||||
sudo cp ../conf/rocketchat.service /etc/systemd/system/$app.service
|
||||
sudo systemctl daemon-reload
|
||||
ynh_replace_string "s@#NODE#@$NODE_BIN@g" ../conf/rocketchat.service
|
||||
cp ../conf/rocketchat.service /etc/systemd/system/$app.service
|
||||
systemctl daemon-reload
|
||||
|
||||
# Copy and set nginx configuration
|
||||
nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||
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
|
||||
ynh_replace_string "s@#APP#@$app@g" ../conf/nginx.conf
|
||||
ynh_replace_string "s@#PATH#@$path@g" ../conf/nginx.conf
|
||||
ynh_replace_string "s@#PORT#@$port@g" ../conf/nginx.conf
|
||||
ynh_replace_string "s@#LOCATION#@${path:-/}@g" ../conf/nginx.conf
|
||||
|
||||
#set db name into ldap config
|
||||
sed -i "s@#DBNAME#@$dbname@g" ../conf/rocketchat_ldap.js
|
||||
ynh_replace_string "s@#DBNAME#@$dbname@g" ../conf/rocketchat_ldap.js
|
||||
|
||||
sudo cp ../conf/nginx.conf "$nginx_conf"
|
||||
cp ../conf/nginx.conf "$nginx_conf"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -118,33 +118,33 @@ sudo cp ../conf/nginx.conf "$nginx_conf"
|
|||
|
||||
ynh_setup_source "$final_path"
|
||||
|
||||
sudo chown -R $serviceuser: $final_path
|
||||
chown -R $serviceuser: $final_path
|
||||
|
||||
cd $final_path/programs/server/
|
||||
|
||||
sudo -u $serviceuser npm install --production
|
||||
-u $serviceuser npm install --production
|
||||
|
||||
cd $workdir
|
||||
|
||||
sudo systemctl reload nginx
|
||||
systemctl reload nginx
|
||||
if [ "$is_public" = "Yes" ];
|
||||
then
|
||||
ynh_app_setting_set "$app" skipped_uris "/"
|
||||
fi
|
||||
|
||||
sudo systemctl start $app.service
|
||||
sudo systemctl enable $app.service
|
||||
systemctl start $app.service
|
||||
systemctl enable $app.service
|
||||
|
||||
# add rocketchat to services
|
||||
sudo yunohost service add $app
|
||||
yunohost service add $app
|
||||
|
||||
# wait for rocketchat to populate db and start
|
||||
waitforservice
|
||||
|
||||
sudo mongo < ../conf/rocketchat_ldap.js
|
||||
mongo < ../conf/rocketchat_ldap.js
|
||||
|
||||
sudo systemctl restart $app.service
|
||||
systemctl restart $app.service
|
||||
|
||||
waitforservice
|
||||
|
||||
sudo yunohost app ssowatconf
|
||||
yunohost app ssowatconf
|
||||
|
|
|
@ -14,18 +14,18 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
domain=$(ynh_app_setting_get $app domain)
|
||||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
|
||||
sudo systemctl stop $app.service
|
||||
systemctl stop $app.service
|
||||
|
||||
# remove Rocketchat from services
|
||||
sudo yunohost service remove $app
|
||||
yunohost service remove $app
|
||||
|
||||
sudo rm -rf $final_path
|
||||
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
sudo rm -rf /var/log/$app
|
||||
sudo rm -f /etc/systemd/system/$app.service
|
||||
ynh_secure_remove $final_path
|
||||
ynh_secure_remove /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
ynh_secure_remove /var/log/$app
|
||||
ynh_secure_remove /etc/systemd/system/$app.service
|
||||
|
||||
# remove database!!!
|
||||
sudo mongo rocketchat --eval "db.dropDatabase()"
|
||||
mongo rocketchat --eval "db.dropDatabase()"
|
||||
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl reload nginx
|
||||
systemctl daemon-reload
|
||||
systemctl reload nginx
|
||||
|
|
|
@ -6,8 +6,8 @@ set -eu
|
|||
#=================================================
|
||||
if [ ! -e _common.sh ]; then
|
||||
# Fetch helpers file if not in current directory
|
||||
sudo cp ../settings/scripts/_common.sh ./_common.sh
|
||||
sudo chmod a+rx _common.sh
|
||||
cp ../settings/scripts/_common.sh ./_common.sh
|
||||
chmod a+rx _common.sh
|
||||
fi
|
||||
source /usr/share/yunohost/helpers
|
||||
source _common.sh
|
||||
|
@ -45,10 +45,10 @@ fi
|
|||
You should safely delete it before restoring this app."
|
||||
|
||||
# Create destination
|
||||
sudo mkdir -p $final_path
|
||||
mkdir -p $final_path
|
||||
|
||||
# Create user
|
||||
id -u $serviceuser || sudo useradd -d "$final_path" -M $serviceuser
|
||||
id -u $serviceuser || useradd -d "$final_path" -M $serviceuser
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
|
@ -60,19 +60,19 @@ ynh_restore
|
|||
# RELOAD THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
sudo systemctl reload nginx
|
||||
systemctl reload nginx
|
||||
|
||||
#=================================================
|
||||
# RELOAD AND ENABLE THE SYSTEMD CONFIGURATION
|
||||
#=================================================
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable rocketchat
|
||||
systemctl daemon-reload
|
||||
systemctl enable rocketchat
|
||||
|
||||
#=================================================
|
||||
# RESTORE PERMISSIONS IN THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
sudo chown -R $serviceuser: $final_path
|
||||
chown -R $serviceuser: $final_path
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
|
@ -84,11 +84,11 @@ installdeps
|
|||
# RESTORE THE MONGODB
|
||||
#=================================================
|
||||
|
||||
sudo mongorestore ./dump
|
||||
mongorestore ./dump
|
||||
|
||||
#=================================================
|
||||
# START APP RELATED SERVICES
|
||||
#=================================================
|
||||
|
||||
sudo systemctl start rocketchat
|
||||
systemctl start rocketchat
|
||||
waitforservice
|
||||
|
|
|
@ -25,22 +25,22 @@ port=$(ynh_app_setting_get $app port)
|
|||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade > >(tee "upgrade.log")
|
||||
|
||||
sudo systemctl stop rocketchat
|
||||
systemctl stop rocketchat
|
||||
|
||||
sudo rm -rf $final_path
|
||||
sudo mkdir -p $final_path
|
||||
ynh_secure_remove $final_path
|
||||
mkdir -p $final_path
|
||||
|
||||
# update to latest required node setup
|
||||
installnode
|
||||
|
||||
ynh_setup_source "$final_path"
|
||||
|
||||
sudo chown -R $serviceuser: $final_path
|
||||
chown -R $serviceuser: $final_path
|
||||
|
||||
cd $final_path/programs/server/
|
||||
sudo npm install --production
|
||||
npm install --production
|
||||
|
||||
sudo chown -R $serviceuser: $final_path
|
||||
chown -R $serviceuser: $final_path
|
||||
|
||||
sudo systemctl start rocketchat
|
||||
systemctl start rocketchat
|
||||
waitforservice
|
||||
|
|
Loading…
Add table
Reference in a new issue