about summary refs log tree commit diff
path: root/bundles/git/files
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2026-04-09 11:04:46 +0900
committerRobert Günzler <r@gnzler.io>2026-04-22 14:36:52 +0900
commitf87c066685098da9a67dd410104cbba8c5fdcdbd (patch)
tree5fe9d3c916931959d267123973e3123b1740a5e1 /bundles/git/files
parentaa913b59b3e5048fec396ee4b50288f740cdfccf (diff)
deploy cgit
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to 'bundles/git/files')
-rw-r--r--bundles/git/files/Caddyfile58
-rw-r--r--bundles/git/files/cgit.conf1
-rw-r--r--bundles/git/files/cgitrc28
-rw-r--r--bundles/git/files/custom.css12
-rw-r--r--bundles/git/files/traefik.yaml18
5 files changed, 117 insertions, 0 deletions
diff --git a/bundles/git/files/Caddyfile b/bundles/git/files/Caddyfile
new file mode 100644
index 0000000..99a011e
--- /dev/null
+++ b/bundles/git/files/Caddyfile
@@ -0,0 +1,58 @@
+# vim: noet ts=2 sw=2
+{
+	admin off
+	auto_https off
+	http_port {$CADDY_HTTP_PORT:1414}
+}
+
+http:// {
+	encode zstd gzip
+
+	handle /healthz {
+		respond OK 200
+	}
+
+	handle /custom.css {
+		root * /var/www/cgit/
+		file_server
+	}
+
+	@static_paths {
+		path /robots.txt
+		path /cgit.css
+		path /cgit.png
+	}
+	handle @static_paths {
+		root * /usr/share/webapps/cgit/
+		file_server
+	}
+
+	handle {
+		reverse_proxy unix//run/fcgiwrap/fcgiwrap.sock {
+			transport fastcgi {
+				env DOCUMENT_ROOT /usr/share/webapps/cgit/
+				env SCRIPT_FILENAME /usr/share/webapps/cgit/cgit.cgi
+			}
+		}
+	}
+
+	log {
+		format filter {
+			wrap console {
+				time_format wall_milli
+				level_format color
+			}
+			fields {
+				common_log delete
+				request>headers>Accept-Encoding delete
+				request>headers>Accept-Language delete
+				request>headers>Connection delete
+				request>headers>Authorization delete
+				request>remote_addr ip_mask {
+					ipv4 24
+					ipv6 32
+				}
+			}
+		}
+	}
+}
diff --git a/bundles/git/files/cgit.conf b/bundles/git/files/cgit.conf
new file mode 100644
index 0000000..a7c0fbe
--- /dev/null
+++ b/bundles/git/files/cgit.conf
@@ -0,0 +1 @@
+www_port=${node.metadata.get("www/cgit/port")}
diff --git a/bundles/git/files/cgitrc b/bundles/git/files/cgitrc
new file mode 100644
index 0000000..36eb882
--- /dev/null
+++ b/bundles/git/files/cgitrc
@@ -0,0 +1,28 @@
+enable-blame=1
+enable-commit-graph=1
+enable-follow-links=1
+enable-log-filecount=1
+enable-log-linecount=1
+
+css=/custom.css
+logo=https://gzr.im/media/interface/logo.svg
+
+mimetype.html=text/html
+mimetype.js=text/javascript
+mimetype.css=text/css
+mimetype.py=text/x-script.python
+mimetype.png=image/png
+mimetype.gif=image/gif
+mimetype.jpg=image/jpeg
+mimetype.jpeg=image/jpeg
+
+root-title=robert's git repos
+root-desc=nothing to see here
+
+about-filter=/usr/lib/cgit/filters/about-formatting.sh
+source-filter=/usr/lib/cgit/filters/syntax-highlighting.py
+
+readme=:README.md
+readme=:README
+
+scan-path=/var/lib/git/
diff --git a/bundles/git/files/custom.css b/bundles/git/files/custom.css
new file mode 100644
index 0000000..cdb5e61
--- /dev/null
+++ b/bundles/git/files/custom.css
@@ -0,0 +1,12 @@
+@import url("cgit.css");
+
+div#cgit {
+	max-width: 117ch;
+	margin: auto;
+	font-family: monospace;
+	tab-size: 4;
+}
+
+div#cgit table#header td.logo img {
+	max-width: 96px;
+}
diff --git a/bundles/git/files/traefik.yaml b/bundles/git/files/traefik.yaml
new file mode 100644
index 0000000..d3333f4
--- /dev/null
+++ b/bundles/git/files/traefik.yaml
@@ -0,0 +1,18 @@
+http:
+  services:
+    cgit:
+      loadBalancer:
+        servers:
+          - url: http://${node.metadata.get("container_gateway", "10.89.0.1")}:${node.metadata.get("www/cgit/port")}
+
+  routers:
+    cgit:
+      rule: Host(`git.demo.gzr.im`)
+      entryPoints:
+        - http
+        - https
+      service: cgit
+      middlewares:
+        - tls-redirect@file
+      tls:
+        certResolver: le