aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL37
-rw-r--r--etc/buildfile8
-rw-r--r--etc/systemd/brep-loader.service9
-rw-r--r--etc/systemd/brep-loader.timer23
4 files changed, 72 insertions, 5 deletions
diff --git a/INSTALL b/INSTALL
index 65c9146..7519bb2 100644
--- a/INSTALL
+++ b/INSTALL
@@ -187,7 +187,40 @@ To verify, visit the repository root. To troubleshoot, see Apache logs.
7. Setup Periodic Loader Execution
-@@ TODO
+In this guide we will use the systemd user session to periodically run loader
+as the brep user. If your installation doesn't use systemd, then a cron job
+would be a natural alternative.
+
+As the first step, make sure systemd user sessions support is working for the
+brep user:
+
+$ systemctl --user status
+
+If there are any errors, make sure the dbus and libpam-systemd packages are
+installed, relogin as brep, and try again. If it still doesn't work, google
+for the error message and your distribution name.
+
+Next enable the brep's systemd session to remain running after logging off
+since we want the loader to run even when we are not logged in:
+
+$ sudo loginctl enable-linger brep
+
+$ mkdir -p .config/systemd/user
+$ cp install/share/brep/etc/systemd/brep-loader.* .config/systemd/user/
+
+Start the service to make sure there are no issues:
+
+$ systemctl --user start brep-loader.service
+$ journalctl
+
+Start the timer and monitor it to make sure it fires:
+
+$ systemctl --user start brep-loader.timer
+$ journalctl -f
+
+If everything looks good, enable the timer to be started at boot time:
+
+$ systemctl --user enable brep-loader.timer
8. Upgrade procedure
@@ -201,3 +234,5 @@ To verify, visit the repository root. To troubleshoot, see Apache logs.
- start apache
- save old config, install
+
+systemctl --user daemon-reload
diff --git a/etc/buildfile b/etc/buildfile
index fc192b6..c2db5cf 100644
--- a/etc/buildfile
+++ b/etc/buildfile
@@ -2,8 +2,8 @@
# copyright : Copyright (c) 2014-2015 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
-define conf: file
-conf{*}: extension = conf
-conf{*}: install = data/etc
+./: file{brep-module.conf brep-apache2.conf} \
+systemd/file{brep-loader.service brep-loader.timer}
-./: conf{brep-module brep-apache2}
+install = data/etc
+systemd/: install = data/etc/systemd
diff --git a/etc/systemd/brep-loader.service b/etc/systemd/brep-loader.service
new file mode 100644
index 0000000..dec7944
--- /dev/null
+++ b/etc/systemd/brep-loader.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=brep repository loader service
+
+[Service]
+Type=oneshot
+ExecStart=/home/brep/install/bin/brep-loader /home/brep/config/brep-loader.conf
+
+[Install]
+WantedBy=default.target
diff --git a/etc/systemd/brep-loader.timer b/etc/systemd/brep-loader.timer
new file mode 100644
index 0000000..22ff22b
--- /dev/null
+++ b/etc/systemd/brep-loader.timer
@@ -0,0 +1,23 @@
+[Unit]
+Description=brep repository loader timer
+RefuseManualStart=no
+RefuseManualStop=no
+
+[Timer]
+Unit=brep-loader.service
+
+# Don't keep track of the timer across reboots.
+#
+Persistent=false
+
+# Wait 20 seconds until the first run.
+#
+OnBootSec=20
+
+# Then wait 5 minutes until the next run.
+#
+OnUnitInactiveSec=5m
+
+
+[Install]
+WantedBy=timers.target