summaryrefslogtreecommitdiff
path: root/config-service-git.PKGBUILD
blob: 607c519d0acb7c5dbb9c4ab6c05d651b4815642d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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'))
}