mirror of
https://github.com/YunoHost-Apps/rocketchat_ynh.git
synced 2024-09-03 20:16:25 +02:00
dfc1bb75f5
- Update to rocket chat 0.73.2 - Update install routine based on https://rocket.chat/docs/installation/manual-installation/debian/ - Conditional service init for mongodb on armhf. Addresses #64. - Minor improvements to upgrade and restore
92 lines
2.5 KiB
Bash
92 lines
2.5 KiB
Bash
#!/bin/bash
|
|
set -eu
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source ./_common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# MANAGE SCRIPT FAILURE
|
|
#=================================================
|
|
|
|
# Exit on command errors and treat access to unset variables as an error
|
|
ynh_abort_if_errors
|
|
|
|
#=================================================
|
|
# LOAD SETTINGS
|
|
#=================================================
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
domain=$(ynh_app_setting_get $app domain)
|
|
path=$(ynh_app_setting_get $app path)
|
|
final_path=$(ynh_app_setting_get $app final_path)
|
|
serviceuser=$(ynh_app_setting_get $app serviceuser)
|
|
port=$(ynh_app_setting_get $app port)
|
|
|
|
# Check domain/path availability
|
|
ynh_webpath_available $domain $path
|
|
if [[ ! $? -eq 0 ]]; then
|
|
ynh_die "domain not available"
|
|
fi
|
|
|
|
# Check destination directory
|
|
[[ -d $final_path ]] && ynh_die \
|
|
"The destination directory '$final_path' already exists.\
|
|
You should safely delete it before restoring this app."
|
|
|
|
# Create destination
|
|
sudo mkdir -p $final_path
|
|
|
|
# Create user
|
|
id -u $serviceuser || sudo useradd -d "$final_path" -M $serviceuser
|
|
|
|
#=================================================
|
|
# STANDARD RESTORATION STEPS
|
|
#=================================================
|
|
|
|
ynh_restore
|
|
|
|
#=================================================
|
|
# RELOAD THE NGINX CONFIGURATION
|
|
#=================================================
|
|
|
|
sudo systemctl reload nginx
|
|
|
|
#=================================================
|
|
# RELOAD AND ENABLE THE SYSTEMD CONFIGURATION
|
|
#=================================================
|
|
sudo systemctl daemon-reload
|
|
sudo systemctl enable rocketchat
|
|
|
|
#=================================================
|
|
# RESTORE PERMISSIONS IN THE APP MAIN DIR
|
|
#=================================================
|
|
|
|
sudo chown -R $serviceuser: $final_path
|
|
|
|
#=================================================
|
|
# INSTALL DEPENDENCIES
|
|
#=================================================
|
|
|
|
installdeps
|
|
|
|
#=================================================
|
|
# RESTORE THE MONGODB
|
|
#=================================================
|
|
|
|
sudo mongorestore ./dump
|
|
|
|
#=================================================
|
|
# START APP RELATED SERVICES
|
|
#=================================================
|
|
|
|
sudo systemctl start rocketchat
|
|
waitforservice
|