1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mattermost_ynh.git synced 2024-09-03 19:36:29 +02:00
This commit is contained in:
ericgaspar 2021-01-11 11:24:21 +01:00
parent 72bc734909
commit a7694d69a7
No known key found for this signature in database
GPG key ID: 574F281483054D44
2 changed files with 30 additions and 5 deletions

View file

@ -31,7 +31,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
db_user=$db_name
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -43,7 +43,6 @@ ynh_webpath_available --domain=$domain --path_url=$path_url \
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
@ -102,7 +101,7 @@ chown -R $app: $logs_path
#=================================================
ynh_restore_file "/etc/systemd/system/$app.service"
systemctl enable $app --quiet
systemctl enable $app.service --quiet
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL

View file

@ -32,6 +32,7 @@ is_public=$(ynh_app_setting_get --app=$app --key=is_public)
port=$(ynh_app_setting_get --app=$app --key=port)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
language=$(ynh_app_setting_get --app=$app --key=language)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#=================================================
# CHECK VERSION
@ -64,6 +65,23 @@ if ! [[ "$language" ]]; then
ynh_app_setting_set --app=$app --key=language --value=$language
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
if ! ynh_permission_exists --permission="admin"; then
# Create the required permissions
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
fi
# Create a permission if needed
if ! ynh_permission_exists --permission="api"; then
ynh_permission_create --permission="api" --url "/api" --allowed="visitors" --show_tile="false" --protected="true"
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -122,6 +140,14 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
#=================================================
# SETUP SYSTEMD
#=================================================
@ -173,7 +199,7 @@ chown -R $app: "/var/log/$app"
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate
ynh_use_logrotate --non-append
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
@ -188,7 +214,7 @@ yunohost service add $app --description="Collaboration platform built for develo
ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started Mattermost"
ynh_systemd_action --service_name=$app --action=start --log_path="systemd" --line_match="Started Mattermost"
#=================================================
# RELOAD NGINX