Zammad: control restart behaviour via systemd
This commit is contained in:
parent
95a3ba934c
commit
824b7de935
8 changed files with 9 additions and 43 deletions
|
@ -31,9 +31,6 @@
|
||||||
- import_tasks: systemd.yml
|
- import_tasks: systemd.yml
|
||||||
tags: systemd
|
tags: systemd
|
||||||
|
|
||||||
- import_tasks: monit.yml
|
|
||||||
tags: monit
|
|
||||||
|
|
||||||
- import_tasks: gateway.yml
|
- import_tasks: gateway.yml
|
||||||
tags: gateway
|
tags: gateway
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
- name: "monit: Kopiere Konfiguration"
|
|
||||||
template:
|
|
||||||
src: monit.j2
|
|
||||||
dest: /etc/monit/conf-enabled/zammad
|
|
||||||
notify: reload monit
|
|
|
@ -1,22 +0,0 @@
|
||||||
check process {{ zammad_rails_service | splitext | first }} with pidfile {{ zammad_home }}/tmp/pids/server.pid
|
|
||||||
start program = "/usr/sbin/service {{ zammad_rails_service | splitext | first }} start"
|
|
||||||
stop program = "/usr/sbin/service {{ zammad_rails_service | splitext | first }} stop"
|
|
||||||
if 2 restarts within 3 cycles then timeout
|
|
||||||
if cpu usage > 95% for 3 cycles then restart
|
|
||||||
if failed host 127.0.0.1 port 3000 for 3 cycles then restart
|
|
||||||
|
|
||||||
check process {{ zammad_websocket_service | splitext | first }}
|
|
||||||
matching "script/websocket-server.rb -b 127.0.0.1 -p 6042 start"
|
|
||||||
start program = "/usr/sbin/service {{ zammad_websocket_service | splitext | first }} start"
|
|
||||||
stop program = "/usr/sbin/service {{ zammad_websocket_service | splitext | first }} stop"
|
|
||||||
if 2 restarts within 3 cycles then timeout
|
|
||||||
if cpu usage > 95% for 3 cycles then restart
|
|
||||||
if failed host 127.0.0.1 port 6042 for 3 cycles then restart
|
|
||||||
|
|
||||||
check process {{ zammad_worker_service | splitext | first }}
|
|
||||||
matching "script/background-worker.rb start"
|
|
||||||
start program = "/usr/sbin/service {{ zammad_worker_service | splitext | first }} start"
|
|
||||||
stop program = "/usr/sbin/service {{ zammad_worker_service | splitext | first }} stop"
|
|
||||||
if 2 restarts within 3 cycles then timeout
|
|
||||||
if cpu usage > 95% for 3 cycles then restart
|
|
||||||
if 5 restarts within 5 cycles then timeout
|
|
|
@ -1,11 +1,13 @@
|
||||||
### {{ ansible_managed }}
|
### {{ ansible_managed }}
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Zammad rails server
|
Description=Zammad webserver
|
||||||
After=syslog.target
|
After=syslog.target
|
||||||
After=network.target
|
After=network.target
|
||||||
After={{ zammad_service }}
|
After={{ zammad_service }}
|
||||||
Requires={{ zammad_service }}
|
Requires={{ zammad_service }}
|
||||||
|
StartLimitIntervalSec=6
|
||||||
|
StartLimitBurst=10
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
#Type=notify
|
#Type=notify
|
||||||
|
|
|
@ -6,6 +6,8 @@ After=syslog.target
|
||||||
After=network.target
|
After=network.target
|
||||||
After={{ zammad_service }}
|
After={{ zammad_service }}
|
||||||
Requires={{ zammad_service }}
|
Requires={{ zammad_service }}
|
||||||
|
StartLimitIntervalSec=6
|
||||||
|
StartLimitBurst=10
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
EnvironmentFile={{ zammad_env_file }}
|
EnvironmentFile={{ zammad_env_file }}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
### {{ ansible_managed }}
|
{{ ansible_managed | comment }}
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Zammad Background Worker
|
Description=Zammad Background Worker
|
||||||
|
@ -6,6 +6,8 @@ After=syslog.target
|
||||||
After=network.target
|
After=network.target
|
||||||
After={{ zammad_service }}
|
After={{ zammad_service }}
|
||||||
Requires={{ zammad_service }}
|
Requires={{ zammad_service }}
|
||||||
|
StartLimitIntervalSec=6
|
||||||
|
StartLimitBurst=10
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
EnvironmentFile={{ zammad_env_file }}
|
EnvironmentFile={{ zammad_env_file }}
|
||||||
|
|
|
@ -11,7 +11,7 @@ Wants={{ zammad_websocket_service }}
|
||||||
EnvironmentFile={{ zammad_env_file }}
|
EnvironmentFile={{ zammad_env_file }}
|
||||||
User={{ zammad_user }}
|
User={{ zammad_user }}
|
||||||
Group={{ zammad_user }}
|
Group={{ zammad_user }}
|
||||||
Restart=always
|
Restart=on-failure
|
||||||
ExecStart=/bin/sleep infinity
|
ExecStart=/bin/sleep infinity
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
@ -6,11 +6,6 @@ set -eu
|
||||||
RUBY_VERSION=$(cat {{ zammad_home }}/.ruby-version)
|
RUBY_VERSION=$(cat {{ zammad_home }}/.ruby-version)
|
||||||
RUBY_INSTALLED_VERSIONS=$(rbenv version | grep $RUBY_VERSION | cut -d ' ' -f2)
|
RUBY_INSTALLED_VERSIONS=$(rbenv version | grep $RUBY_VERSION | cut -d ' ' -f2)
|
||||||
|
|
||||||
echo "Stoppe Monit-Monitoring..."
|
|
||||||
monit unmonitor {{ zammad_websocket_service | splitext | first }}
|
|
||||||
monit unmonitor {{ zammad_rails_service | splitext | first }}
|
|
||||||
monit unmonitor {{ zammad_worker_service | splitext | first }}
|
|
||||||
|
|
||||||
echo "Wechsle Verzeichnis..."
|
echo "Wechsle Verzeichnis..."
|
||||||
cd {{ zammad_home }}
|
cd {{ zammad_home }}
|
||||||
|
|
||||||
|
@ -48,9 +43,4 @@ echo "Starte Zammad..."
|
||||||
systemctl start {{ zammad_service }}
|
systemctl start {{ zammad_service }}
|
||||||
sleep 20
|
sleep 20
|
||||||
|
|
||||||
echo "Starte Monit-Monitoring..."
|
|
||||||
monit monitor {{ zammad_websocket_service | splitext | first }}
|
|
||||||
monit monitor {{ zammad_rails_service | splitext | first }}
|
|
||||||
monit monitor {{ zammad_worker_service | splitext | first }}
|
|
||||||
|
|
||||||
echo "Alles erledigt."
|
echo "Alles erledigt."
|
||||||
|
|
Loading…
Reference in a new issue