summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--mkosi.default20
-rw-r--r--mkosi.nspawn14
-rwxr-xr-xmkosi.postinst16
-rw-r--r--mkosi.skeleton/root/nginx.git.dnns.no19
5 files changed, 71 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3dff6a2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+# mkosi cache
+mkosi.cache/*
diff --git a/mkosi.default b/mkosi.default
new file mode 100644
index 0000000..6b15bb9
--- /dev/null
+++ b/mkosi.default
@@ -0,0 +1,20 @@
+[Distribution]
+Distribution=ubuntu
+Release=bionic
+Repositories=main,universe
+Mirror=http://no.archive.ubuntu.com
+
+[Output]
+Format=directory
+Output=/var/lib/machines/cgit
+
+[Packages]
+WithNetwork=yes
+Packages=
+ nginx-light
+ cgit
+ fcgiwrap
+ highlight
+ python3-markdown
+ python3-minimal
+ python3-pygments
diff --git a/mkosi.nspawn b/mkosi.nspawn
new file mode 100644
index 0000000..2dacb6a
--- /dev/null
+++ b/mkosi.nspawn
@@ -0,0 +1,14 @@
+[Exec]
+Hostname=cgit
+ResolvConf=copy-host
+Timezone=copy
+#PrivateUsers=pick
+NoNewPrivileges=yes
+
+[Files]
+PrivateUsersChown=true
+BindReadOnly=/etc/cgitrc
+BindReadOnly=/var/lib/gitolite3
+
+[Network]
+VirtualEthernet=no
diff --git a/mkosi.postinst b/mkosi.postinst
new file mode 100755
index 0000000..202b135
--- /dev/null
+++ b/mkosi.postinst
@@ -0,0 +1,16 @@
+#!/bin/sh
+set -ex
+
+export DEBIAN_FRONTEND=noninteractive
+
+# locales
+#sed -i 's/# en_IE.UTF-8 UTF-8/en_IE.UTF-8 UTF-8/' /etc/locale.gen
+#locale-gen
+
+groupadd --gid 997 --system git
+useradd --home-dir /var/lib/gitolite3 --system --gid 997 git
+adduser www-data git
+
+mv /root/nginx.git.dnns.no /etc/nginx/sites-available/git.dnns.no
+rm /etc/nginx/sites-enabled/default
+ln -s /etc/nginx/sites-available/git.dnns.no /etc/nginx/sites-enabled/
diff --git a/mkosi.skeleton/root/nginx.git.dnns.no b/mkosi.skeleton/root/nginx.git.dnns.no
new file mode 100644
index 0000000..a43e4fb
--- /dev/null
+++ b/mkosi.skeleton/root/nginx.git.dnns.no
@@ -0,0 +1,19 @@
+server {
+ listen 8305 default_server;
+ listen [::]:8305 default_server;
+ server_name git.dnns.no;
+
+ access_log /var/log/nginx/git.dnns.no-access.log;
+ error_log /var/log/nginx/git.dnns.no-error.log;
+
+ location / {
+ fastcgi_pass unix:/run/fcgiwrap.socket;
+ fastcgi_param SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi;
+ fastcgi_param PATH_INFO $uri;
+ fastcgi_param QUERY_STRING $args;
+ }
+
+ location /cgit {
+ alias /usr/share/cgit;
+ }
+}