Repositories / gitweb2.git
gitweb2.git
Clone (read-only): git clone http://git.guha-anderson.com/git/gitweb2.git
@@ -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:
@@ -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).
@@ -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