Commit
Author: Manos Pitsidianakis [manos@pitsidianak.is]
Hash: 5ac4ce5f66ff60ded1d3d1ce5ced552b86569329
Timestamp: Fri, 31 May 2024 08:54:18 +0000 (6 months ago)

+38 -0 +/-1 browse
contrib/systemd: add template file
contrib/systemd: add template file

This commit adds a template file that can be used to launch oneshot
systemd jobs that execute `/usr/bin/ayllu jobs run path/to/repo`.

See unit file comments for directions.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
1diff --git a/contrib/systemd/user/ayllu-job-template@.service b/contrib/systemd/user/ayllu-job-template@.service
2new file mode 100644
3index 0000000..3effa52
4--- /dev/null
5+++ b/contrib/systemd/user/ayllu-job-template@.service
6 @@ -0,0 +1,38 @@
7+ # A oneshot systemd unit template for running ayllu jobs after updating a repository.
8+ # You can use it as a post-receive hook in your repo's hooks/ directory.
9+ # Do not forget to set the hook file as executable!
10+ #
11+ # How to use:
12+ # - Add to systemd's configuration paths, e.g. $HOME/.config/systemd/user/ or /etc/systemd/user/
13+ # - Run `systemctl --user daemon-reload`
14+ # - To execute the job, run:
15+ # systemctl --user start ayllu-job-template@`systemd-escape "$(pwd)"`.service
16+ # if your current directory is the repository directory. Otherwise replace
17+ # `$(pwd)` with a variable `${VAR}` which holds the path to the repository:
18+ # export VAR=/home/user/repos/user/repo/; \
19+ # systemctl --user start ayllu-job-template@`systemd-escape "${VAR}"`.service
20+ #
21+ # Copyright 2024 Emmanouil Pitsidianakis <manos@pitsidianak.is>
22+ # SPDX-License-Identifier: EUPL-1.2 OR GPL-3.0-or-later
23+
24+ [Unit]
25+ Description=Ayllu job post-receive hook for %I
26+ StartLimitIntervalSec=60
27+ StartLimitBurst=5
28+
29+ [Service]
30+ WantedBy=default.target
31+ Type=oneshot
32+ RemainAfterExit=no
33+ TimeoutStartSec=5
34+ ExecStart=/usr/bin/ayllu jobs run "%I"
35+ KillSignal=SIGTERM
36+ Restart=on-failure
37+ RestartSec=12
38+ RestartSteps=60
39+ RestartMaxDelaySec=3600
40+ OOMPolicy=kill
41+ RuntimeMaxSec=3600
42+
43+ [Install]
44+ WantedBy=default.target