From 44a97f1844b5addb7a6ee3d9b27997d27dee9661 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Tue, 14 Aug 2018 22:19:57 +0200 Subject: mw-backend: Creating timer for running runJobs.php. --- .../files/etc/systemd/system/mw-jobqueue.service | 12 ++++++++++++ .../mw-backend/files/etc/systemd/system/mw-jobqueue.timer | 9 +++++++++ ansible/roles/mw-backend/handlers/main.yml | 4 ++++ ansible/roles/mw-backend/tasks/main.yml | 14 ++++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 ansible/roles/mw-backend/files/etc/systemd/system/mw-jobqueue.service create mode 100644 ansible/roles/mw-backend/files/etc/systemd/system/mw-jobqueue.timer (limited to 'ansible/roles/mw-backend') diff --git a/ansible/roles/mw-backend/files/etc/systemd/system/mw-jobqueue.service b/ansible/roles/mw-backend/files/etc/systemd/system/mw-jobqueue.service new file mode 100644 index 0000000..a944443 --- /dev/null +++ b/ansible/roles/mw-backend/files/etc/systemd/system/mw-jobqueue.service @@ -0,0 +1,12 @@ +[Unit] +Description=MediaWiki Job runner + +[Service] +WorkingDirectory=/var/lib/mediawiki/maintenance +ExecStart=/usr/bin/php runJobs.php --maxjobs 100 +User=www-data +Group=www-data +StandardOutput=journal + +Nice=10 +OOMScoreAdjust=500 diff --git a/ansible/roles/mw-backend/files/etc/systemd/system/mw-jobqueue.timer b/ansible/roles/mw-backend/files/etc/systemd/system/mw-jobqueue.timer new file mode 100644 index 0000000..1d12500 --- /dev/null +++ b/ansible/roles/mw-backend/files/etc/systemd/system/mw-jobqueue.timer @@ -0,0 +1,9 @@ +[Unit] +Description=MediaWiki job runner timer + +[Timer] +OnBootSec=15min +OnUnitActiveSec=10m + +[Install] +WantedBy=timers.target diff --git a/ansible/roles/mw-backend/handlers/main.yml b/ansible/roles/mw-backend/handlers/main.yml index 3588f2b..a8bccb6 100644 --- a/ansible/roles/mw-backend/handlers/main.yml +++ b/ansible/roles/mw-backend/handlers/main.yml @@ -7,3 +7,7 @@ service: name: apache2 state: reloaded + +- name: systemd daemon-reload + systemd: + daemon_reload: true diff --git a/ansible/roles/mw-backend/tasks/main.yml b/ansible/roles/mw-backend/tasks/main.yml index 66d1aa7..9db9be9 100644 --- a/ansible/roles/mw-backend/tasks/main.yml +++ b/ansible/roles/mw-backend/tasks/main.yml @@ -98,6 +98,20 @@ template: src: etc/mediawiki/LocalSettings.php.j2 dest: /etc/mediawiki/LocalSettings.php + - name: mediawiki job systemd service + notify: systemd daemon-reload + copy: + src: etc/systemd/system/mw-jobqueue.service + dest: /etc/systemd/system/mw-jobqueue.service + - name: mediawiki job systemd timer + notify: systemd daemon-reload + copy: + src: etc/systemd/system/mw-jobqueue.timer + dest: /etc/systemd/system/mw-jobqueue.timer + - systemd: + enabled: true + state: started + name: mw-jobqueue.timer - name: Semantic MediaWiki tags: -- cgit v1.2.3