1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mattermost_ynh.git synced 2024-09-03 19:36:29 +02:00

Merge pull request #95 from YunoHost-Apps/remove-systemd-hacks

Remove service startup hacks
This commit is contained in:
Pierre de La Morinerie 2018-03-16 19:03:43 +05:30 committed by GitHub
commit 4afa2df5ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 28 deletions

View file

@ -1,3 +1,6 @@
# This file is managed by the Yunohost Mattermost package,
# and will be overwritten on upgrade.
[Unit]
Description=Mattermost
After=network.target
@ -5,14 +8,9 @@ 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'
TimeoutStartSec=3600
Restart=always
RestartSec=10
WorkingDirectory=__FINALPATH__

View file

@ -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"
}

View file

@ -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

View file

@ -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