summaryrefslogtreecommitdiff
path: root/config-service-git.PKGBUILD
diff options
context:
space:
mode:
Diffstat (limited to 'config-service-git.PKGBUILD')
-rw-r--r--config-service-git.PKGBUILD75
1 files changed, 75 insertions, 0 deletions
diff --git a/config-service-git.PKGBUILD b/config-service-git.PKGBUILD
new file mode 100644
index 0000000..607c519
--- /dev/null
+++ b/config-service-git.PKGBUILD
@@ -0,0 +1,75 @@
+. ${BUILDFILE%/*}/common.sh
+pkgver=20160713.2
+
+depends=(git cgit uwsgi-plugin-cgi config-uwsgi)
+
+package() {
+cd "$pkgdir"
+
+add-file -m755 etc/ssl/misc/certbot-get.d/10-git <<EOF
+#!/bin/bash
+echo git.{parabola.nu,parabolagnulinux.org}
+EOF
+
+# Metadata about all of the git repositories, as well as most of the
+# setup, lives in the git-meta.git repository. The git user has a
+# cron-job to update this repository every hour.
+install -d etc/cron.spool
+add-file -m600 -o git -g git etc/cron.spool/git <<EOF
+MAILTO=maintenance@lists.parabola.nu
+PATH=/srv/git/.local/bin:/bin
+#min hour dom mon dow cmd
+0 * * * * chronic bash -c "update-gitmeta 'Update from cron' 2>&1"
+EOF
+
+
+# ## transport: git protocol
+
+add-unit etc/systemd/system/sockets.target.wants/git-daemon.socket
+
+# ## transport: HTTPS
+
+# The git web interface is cgit, which is managed by uWSGI speaking
+# uwsgi/modifier1=9, which is the variant of the uwsgi protocol for
+# CGI requests.
+add-file etc/nginx/sites/server-git.parabola.nu.conf <<EOF
+# -*- Mode: nginx; nginx-indent-level: 8; indent-tabs-mode: t -*-
+
+server {
+ server_name git.parabola.nu;
+ listen 443 ssl http2;
+ listen [::]:443 ssl http2;
+
+ error_log /var/log/nginx/nginx.http.git.parabola.nu.error.log error;
+ access_log /var/log/nginx/nginx.http.git.parabola.nu.access.log specific;
+
+ location / {
+ try_files \$uri @cgit;
+ }
+
+ location @cgit {
+ uwsgi_pass unix:/run/uwsgi/git.sock;
+ uwsgi_modifier1 9; # Standard CGI request
+ include uwsgi_params;
+ }
+}
+EOF
+
+# uwsgi/git.ini sets CGIT_CONFIG=/srv/http/git.parabola.nu/cgitrc.
+add-file etc/uwsgi/git.ini <<EOF
+[uwsgi]
+master = true
+processes = 1
+
+uid = http
+gid = http
+
+plugins = cgi
+env = CGIT_CONFIG=/srv/http/git.parabola.nu/cgitrc
+cgi = /srv/http/git.parabola.nu/cgit.cgi
+EOF
+
+add-unit etc/systemd/system/sockets.target.wants/uwsgi@git.socket
+
+backup=($(find "$pkgdir" -type f -printf '%P\n'))
+}