Repositories / gitweb2.git

gitweb2.git

Clone (read-only): git clone http://git.guha-anderson.com/git/gitweb2.git

Branch

systemd: homebox-only unit with direct binary and bash pygments quoting

Use fixed paths for this host, _build/install/default/bin/gitweb2, PATH for
uv, and bash -c so systemd preserves the --pygments argument. Document install
and checks in service/README.md; link from main README.

Made-with: Cursor
Author
Arjun Guha <a.guha@northeastern.edu>
Date
2026-04-30 05:43:00 -0400
Commit
cbd9d6cbfd10ac58eda02eedb5e30c5fe708d019
README.md
index c19eade..2bb310b 100644
--- a/README.md
+++ b/README.md
@@ -36,6 +36,11 @@ dune exec gitweb2 -- ~/repos --host 127.0.0.1 --port 8080 --pygments "uv run --w
 
 Press `Ctrl+C` to stop the server.
 
+## systemd (homebox)
+
+This repo carries a **user** unit for the host **homebox** (paths and ports are
+fixed in the unit). See [service/README.md](service/README.md).
+
 The server scans nested directories for Git repositories and renders
 repository, branch, file, directory, and commit history pages. Nested repository
 paths and branch names that contain slashes are percent-encoded in URLs:
service/README.md
index e8e2e5e..f03c77a 100644
--- a/service/README.md
+++ b/service/README.md
@@ -1,10 +1,24 @@
-# gitweb2 service
+# gitweb2 on homebox
 
-The service file runs the OCaml `gitweb2` executable. Build the project first:
+User systemd unit for this machine only: [`gitweb2.service`](gitweb2.service).
+
+Build the binary first (`dune build` from the repo root; binary is
+`_build/install/default/bin/gitweb2`), then:
+
+```sh
+mkdir -p ~/.config/systemd/user
+cp service/gitweb2.service ~/.config/systemd/user/
+systemctl --user daemon-reload
+systemctl --user enable --now gitweb2.service
+```
+
+Check status and logs:
 
 ```sh
-dune build
+systemctl --user status gitweb2.service
+journalctl --user-unit gitweb2.service -f
 ```
 
-Then point `ExecStart` at the built executable or an installed `gitweb2` on
-`PATH`.
+The unit listens on **0.0.0.0:8002**, serves **`/home/git/repos`**, and uses this checkout at **`/media/external0/arjun/repos/homebox/gitweb2`**. **`ExecStart`** goes through **`bash -c`** so the **`--pygments`** command stays a single argument (systemd splits unquoted strings). Edit the unit file if any of that moves.
+
+Without [lingering](https://www.freedesktop.org/software/systemd/man/latest/loginctl.html), the user service stops when you log out (`loginctl enable-linger "$USER"` to keep it).
service/gitweb2.service
index 6113451..fdd978d 100644
--- a/service/gitweb2.service
+++ b/service/gitweb2.service
@@ -2,13 +2,12 @@
 Description=gitweb2 OCaml Git repository browser
 After=network-online.target
 Wants=network-online.target
-StartLimitIntervalSec=300
-StartLimitBurst=1
 
 [Service]
 Type=simple
-WorkingDirectory=/home/arjun/repos/homebox/gitweb2
-ExecStart=/usr/bin/env jai -j agents dune exec gitweb2 -- /home/git/repos --host 0.0.0.0 --port 8002 --pygments "uv run --with pygments pygmentize"
+WorkingDirectory=/media/external0/arjun/repos/homebox/gitweb2
+Environment=PATH=/home/arjun/.local/bin:/usr/local/bin:/usr/bin:/bin
+ExecStart=/bin/bash -c 'exec /media/external0/arjun/repos/homebox/gitweb2/_build/install/default/bin/gitweb2 /home/git/repos --host 0.0.0.0 --port 8002 --pygments "uv run --with pygments pygmentize"'
 Restart=on-failure
 RestartSec=5