1
0
Fork 0
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:
Selamanse 2019-02-10 21:21:55 +01:00
parent 28a2bf66a3
commit 6bb0d1166c
6 changed files with 55 additions and 53 deletions

View file

@ -41,6 +41,7 @@
}, },
{ {
"name": "is_public", "name": "is_public",
"type": "boolean",
"ask": { "ask": {
"en": "Is it a public application?" "en": "Is it a public application?"
}, },
@ -49,6 +50,7 @@
}, },
{ {
"name": "lang", "name": "lang",
"type": "string",
"ask": { "ask": {
"en": "Select default language" "en": "Select default language"
}, },

View file

@ -36,4 +36,4 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/nginx"
# BACKUP THE MONGODB DATABASE # BACKUP THE MONGODB DATABASE
#================================================= #=================================================
sudo mongodump -o "./dump" mongodump -o "./dump"

View file

@ -82,35 +82,35 @@ ynh_app_setting_set $app is_public $is_public
installdeps installdeps
# Create destination # Create destination
sudo mkdir -p $final_path mkdir -p $final_path
# Create user # 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 # Copy and set systemd configuration
sed -i "s@#ROOTURL#@$domain@g" ../conf/rocketchat.service ynh_replace_string "s@#ROOTURL#@$domain@g" ../conf/rocketchat.service
sed -i "s@#LOCATION#@${path:-/}@g" ../conf/rocketchat.service ynh_replace_string "s@#LOCATION#@${path:-/}@g" ../conf/rocketchat.service
sed -i "s@#PORT#@$port@g" ../conf/rocketchat.service ynh_replace_string "s@#PORT#@$port@g" ../conf/rocketchat.service
sed -i "s@#USER#@$serviceuser@g" ../conf/rocketchat.service ynh_replace_string "s@#USER#@$serviceuser@g" ../conf/rocketchat.service
sed -i "s@#DESTDIR#@$final_path@g" ../conf/rocketchat.service ynh_replace_string "s@#DESTDIR#@$final_path@g" ../conf/rocketchat.service
sed -i "s@#DBNAME#@$dbname@g" ../conf/rocketchat.service ynh_replace_string "s@#DBNAME#@$dbname@g" ../conf/rocketchat.service
# absolute node path needed # absolute node path needed
NODE_BIN=$(which node) NODE_BIN=$(which node)
sed -i "s@#NODE#@$NODE_BIN@g" ../conf/rocketchat.service ynh_replace_string "s@#NODE#@$NODE_BIN@g" ../conf/rocketchat.service
sudo cp ../conf/rocketchat.service /etc/systemd/system/$app.service cp ../conf/rocketchat.service /etc/systemd/system/$app.service
sudo systemctl daemon-reload systemctl daemon-reload
# Copy and set nginx configuration # Copy and set nginx configuration
nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf" nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
sed -i "s@#APP#@$app@g" ../conf/nginx.conf ynh_replace_string "s@#APP#@$app@g" ../conf/nginx.conf
sed -i "s@#PATH#@$path@g" ../conf/nginx.conf ynh_replace_string "s@#PATH#@$path@g" ../conf/nginx.conf
sed -i "s@#PORT#@$port@g" ../conf/nginx.conf ynh_replace_string "s@#PORT#@$port@g" ../conf/nginx.conf
sed -i "s@#LOCATION#@${path:-/}@g" ../conf/nginx.conf ynh_replace_string "s@#LOCATION#@${path:-/}@g" ../conf/nginx.conf
#set db name into ldap config #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 # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -118,33 +118,33 @@ sudo cp ../conf/nginx.conf "$nginx_conf"
ynh_setup_source "$final_path" ynh_setup_source "$final_path"
sudo chown -R $serviceuser: $final_path chown -R $serviceuser: $final_path
cd $final_path/programs/server/ cd $final_path/programs/server/
sudo -u $serviceuser npm install --production -u $serviceuser npm install --production
cd $workdir cd $workdir
sudo systemctl reload nginx systemctl reload nginx
if [ "$is_public" = "Yes" ]; if [ "$is_public" = "Yes" ];
then then
ynh_app_setting_set "$app" skipped_uris "/" ynh_app_setting_set "$app" skipped_uris "/"
fi fi
sudo systemctl start $app.service systemctl start $app.service
sudo systemctl enable $app.service systemctl enable $app.service
# add rocketchat to services # add rocketchat to services
sudo yunohost service add $app 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 mongo < ../conf/rocketchat_ldap.js
sudo systemctl restart $app.service systemctl restart $app.service
waitforservice waitforservice
sudo yunohost app ssowatconf yunohost app ssowatconf

View file

@ -14,18 +14,18 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get $app domain)
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get $app final_path)
sudo systemctl stop $app.service systemctl stop $app.service
# remove Rocketchat from services # remove Rocketchat from services
sudo yunohost service remove $app yunohost service remove $app
sudo rm -rf $final_path ynh_secure_remove $final_path
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf ynh_secure_remove /etc/nginx/conf.d/$domain.d/$app.conf
sudo rm -rf /var/log/$app ynh_secure_remove /var/log/$app
sudo rm -f /etc/systemd/system/$app.service ynh_secure_remove /etc/systemd/system/$app.service
# remove database!!! # remove database!!!
sudo mongo rocketchat --eval "db.dropDatabase()" mongo rocketchat --eval "db.dropDatabase()"
sudo systemctl daemon-reload systemctl daemon-reload
sudo systemctl reload nginx systemctl reload nginx

View file

@ -6,8 +6,8 @@ set -eu
#================================================= #=================================================
if [ ! -e _common.sh ]; then if [ ! -e _common.sh ]; then
# Fetch helpers file if not in current directory # Fetch helpers file if not in current directory
sudo cp ../settings/scripts/_common.sh ./_common.sh cp ../settings/scripts/_common.sh ./_common.sh
sudo chmod a+rx _common.sh chmod a+rx _common.sh
fi fi
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
source _common.sh source _common.sh
@ -45,10 +45,10 @@ fi
You should safely delete it before restoring this app." You should safely delete it before restoring this app."
# Create destination # Create destination
sudo mkdir -p $final_path mkdir -p $final_path
# Create user # Create user
id -u $serviceuser || sudo useradd -d "$final_path" -M $serviceuser id -u $serviceuser || useradd -d "$final_path" -M $serviceuser
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
@ -60,19 +60,19 @@ ynh_restore
# RELOAD THE NGINX CONFIGURATION # RELOAD THE NGINX CONFIGURATION
#================================================= #=================================================
sudo systemctl reload nginx systemctl reload nginx
#================================================= #=================================================
# RELOAD AND ENABLE THE SYSTEMD CONFIGURATION # RELOAD AND ENABLE THE SYSTEMD CONFIGURATION
#================================================= #=================================================
sudo systemctl daemon-reload systemctl daemon-reload
sudo systemctl enable rocketchat systemctl enable rocketchat
#================================================= #=================================================
# RESTORE PERMISSIONS IN THE APP MAIN DIR # RESTORE PERMISSIONS IN THE APP MAIN DIR
#================================================= #=================================================
sudo chown -R $serviceuser: $final_path chown -R $serviceuser: $final_path
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
@ -84,11 +84,11 @@ installdeps
# RESTORE THE MONGODB # RESTORE THE MONGODB
#================================================= #=================================================
sudo mongorestore ./dump mongorestore ./dump
#================================================= #=================================================
# START APP RELATED SERVICES # START APP RELATED SERVICES
#================================================= #=================================================
sudo systemctl start rocketchat systemctl start rocketchat
waitforservice waitforservice

View file

@ -25,22 +25,22 @@ port=$(ynh_app_setting_get $app port)
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade > >(tee "upgrade.log") ynh_backup_before_upgrade > >(tee "upgrade.log")
sudo systemctl stop rocketchat systemctl stop rocketchat
sudo rm -rf $final_path ynh_secure_remove $final_path
sudo mkdir -p $final_path mkdir -p $final_path
# update to latest required node setup # update to latest required node setup
installnode installnode
ynh_setup_source "$final_path" ynh_setup_source "$final_path"
sudo chown -R $serviceuser: $final_path chown -R $serviceuser: $final_path
cd $final_path/programs/server/ 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 waitforservice