diff --git a/conf/systemd.service b/conf/systemd.service index 7a7977f..7b2b574 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -5,14 +5,8 @@ After=mysql.service Requires=mysql.service [Service] -Type=simple +Type=notify ExecStart=__FINALPATH__/bin/platform -# HACK: Wait for Mattermost port to be open before declaring the service to be launched successfully. -# This avoids to report the service as launched even when it crashes a few milliseconds after start. -# -# TODO: improve mattermost to send a STARTED notification, and -# switch the service to 'Type=notify' instead. -ExecStartPost=/usr/bin/timeout 10 /bin/sh -c 'while ! nc -z localhost __PORT__; do sleep 0.2; done' Restart=always RestartSec=10 WorkingDirectory=__FINALPATH__ diff --git a/scripts/_common.sh b/scripts/_common.sh deleted file mode 100644 index 02b43dc..0000000 --- a/scripts/_common.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -# Add a systemd configuration using ynh_add_systemd_config, -# by replacing __PORT__ with the $port variable value. -mattermost_add_systemd_config () { - local config_path="../conf" - - # Replace variables in the systemd template config file - sed -i'.template' "s/__PORT__/$port/g" "$config_path/systemd.service" - - # Create a dedicated systemd config - ynh_add_systemd_config - - # Restore the original configuration template - rm "$config_path/systemd.service" - mv "$config_path/systemd.service.template" "$config_path/systemd.service" -} diff --git a/scripts/install b/scripts/install index e1f29bf..621960d 100644 --- a/scripts/install +++ b/scripts/install @@ -6,7 +6,6 @@ # IMPORT GENERIC HELPERS #================================================= -source _common.sh source /usr/share/yunohost/helpers #================================================= @@ -168,7 +167,7 @@ ynh_add_nginx_config # SYSTEMD CONFIGURATION #================================================= -mattermost_add_systemd_config +ynh_add_systemd_config #================================================= # ADVERTISE SERVICE IN ADMIN PANEL diff --git a/scripts/upgrade b/scripts/upgrade index 332de9b..965f1f8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -6,7 +6,6 @@ # IMPORT GENERIC HELPERS #================================================= -source _common.sh source /usr/share/yunohost/helpers #================================================= @@ -132,7 +131,7 @@ ynh_add_nginx_config # SYSTEMD CONFIGURATION #================================================= -mattermost_add_systemd_config +ynh_add_systemd_config #================================================= # ADVERTISE SERVICE IN ADMIN PANEL