diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-02-09 10:14:57 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-02-09 10:14:57 +0200 |
commit | 270b670ecad2426d31f36e3386696622274208a0 (patch) | |
tree | dd9ff47f0a47e0324b39dfbae04e5705834ac6f7 | |
parent | 998147157df57db40fbf017224c488e9479e4e72 (diff) |
Add instructions on how to run loader via cron
-rw-r--r-- | INSTALL | 37 | ||||
-rw-r--r-- | etc/systemd/brep-load.service | 2 |
2 files changed, 34 insertions, 5 deletions
@@ -225,9 +225,29 @@ $ for i in *.scss; do sassc -s compressed $i `basename -s .scss $i`.css; done 8. Setup Periodic Loader Execution -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. +Initially this guide suggested using systemd user session support to run the +loader. However, the current state of user sessions has one major drawback: +they are not strated/attached to when logging in with su -l (see Debian bug +#813789 for details). This limitation makes them unusable in our setup. If you +still would like to use systemd to run the loader, then you can set it up as a +system-wide service which runs the loader as the brep user/group. Otherwise, a +cron job is a natural choice. + + +8.a Setup Periodic Loader Execution with cron + +The following crontab entry will execute the loader every five minutes: + +$ crontab - +MAILTO=<brep-admin-email> +*/5 * * * * $HOME/install/bin/brep-load $HOME/config/brep-load.conf + + +8.b Setup Periodic Loader Execution with systemd + +In this version we will use the systemd user session to periodically run the +loader as the brep user. If your installation doesn't use systemd, then a cron +job would be a natural alternative (see above). As the first step, make sure systemd user sessions support is working for the brep user: @@ -278,11 +298,16 @@ Build new version of brep: $ bpkg -d brep build brep -Stop and disable loader: +If you are using a systemd-based setup, then stop and disable the loader: $ systemctl --user disable --now brep-load.timer $ systemctl --user stop brep-load.service +If you are using a cron-based setup, then it is not worth it commenting out the +job entry. If the new version of the loader gets executed before or during the +migration, then it will fail and you will get an email with the diagnostics. +Other than that, it should be harmless. + Stop apache: $ sudo systemctl stop apache2 @@ -300,7 +325,7 @@ Update database schema: $ install/bin/brep-migrate -Start and enable loader: +If using systemd, then start and enable the loader: $ systemctl --user start brep-load.service $ systemctl --user status brep-load.service @@ -309,6 +334,8 @@ If everything looks good, enable periodic execution: $ systemctl --user enable --now brep-load.timer +If using cron, then simply wait for the next run. + Start apache: $ sudo systemctl start apache2 diff --git a/etc/systemd/brep-load.service b/etc/systemd/brep-load.service index 34a7c9a..bc12e4b 100644 --- a/etc/systemd/brep-load.service +++ b/etc/systemd/brep-load.service @@ -3,6 +3,8 @@ Description=brep repository loader service [Service] Type=oneshot +#User=brep +#Group=brep ExecStart=/home/brep/install/bin/brep-load /home/brep/config/brep-load.conf [Install] |