From 24bd72d7b2bfacc3caa45509b25e0ed9990b901a Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Fri, 4 Nov 2022 08:33:18 +0330 Subject: update --- terminaldweller.com/cgit/cgit.conf | 9 +- terminaldweller.com/cgit/cgit/Dockerfile | 7 +- terminaldweller.com/cgit/cgit/cgitrc | 143 ++++++++++++++++++++++++--- terminaldweller.com/cgit/docker-compose.yaml | 12 ++- 4 files changed, 149 insertions(+), 22 deletions(-) (limited to 'terminaldweller.com/cgit') diff --git a/terminaldweller.com/cgit/cgit.conf b/terminaldweller.com/cgit/cgit.conf index ac59b7a..caf8876 100644 --- a/terminaldweller.com/cgit/cgit.conf +++ b/terminaldweller.com/cgit/cgit.conf @@ -1,9 +1,8 @@ -server.modules += ( "mod_cgi", "mod_rewrite" ) +server.modules += ( "mod_cgi", "mod_rewrite", "mod_openssl" ) -#$SERVER["socket"] == ":443" { -$SERVER["socket"] == ":80" { - #ssl.engine = "enable" - #ssl.pemfile = "/etc/lighttpd/ssl/git.example.com.pem" +$SERVER["socket"] == ":443" { + ssl.engine = "enable" + ssl.pemfile = "/etc/certs/git.pem" server.name = "git.terminaldweller.com" server.document-root = "/usr/share/webapps/cgit/" diff --git a/terminaldweller.com/cgit/cgit/Dockerfile b/terminaldweller.com/cgit/cgit/Dockerfile index 8646b5c..7ef7134 100644 --- a/terminaldweller.com/cgit/cgit/Dockerfile +++ b/terminaldweller.com/cgit/cgit/Dockerfile @@ -1,2 +1,5 @@ -FROM alpine:3.16 -RUN apk add && apk add --no-cache busybox-initscripts cgit git spawn-fcgi fcgiwrap highlight nginx +FROM woahbase/alpine-cgit:x86_64 +RUN apk add && apk add --no-cache python3 py3-pip +RUN pip3 install pygments +RUN pip3 install md2html +RUN pip3 install markdown diff --git a/terminaldweller.com/cgit/cgit/cgitrc b/terminaldweller.com/cgit/cgit/cgitrc index a2c216e..8306a30 100644 --- a/terminaldweller.com/cgit/cgit/cgitrc +++ b/terminaldweller.com/cgit/cgit/cgitrc @@ -1,19 +1,140 @@ +# +## cgit config +# +# +# Enable caching of up to 1000 output entries +# cache-size=5 + +## ttl for root page +cache-root-ttl=5 + +## ttl for repo summary page +cache-repo-ttl=5 + +## ttl for other dynamic pages +cache-dynamic-ttl=5 + +## ttl for static pages (addressed by SHA-1) +cache-static-ttl=-1 + +# css css=/cgit/cgit.css -# logo=/cgit.png +logo=/cgit/cgit.png -# git repos go here -scan-path=/home/git/repositories +# Enable ASCII art commit history graph on the log pages +enable-commit-graph=1 -virtual-root=/ +enable-follow-links=1 +enable-subject-links=1 +enable-index-links=1 + +enable-git-config=1 +enable-html-serving=1 + +enable-http-clone=1 +enable-git-clone=1 + +enable-index-owner=0 +enable-gitweb-owner=1 + +enable-log-filecount=1 +enable-log-linecount=1 + +enable-remote-branches=1 +enable-tree-linenumbers=1 + +# summary info +summary-branches=10 +summary-log=10 +summary-tags=10 + +# Sort by age/name +repository-sort=name +branch-sort=age +commit-sort=age -# automatically render READMEs -about-file=/usr/lib/cgit/filters/about-formatting.sh -readme:=README.md +# Enable statistics per week, month and quarter +max-stats=year -# robots +# show local time not utc +local-time=1 + +root-title=cGit +root-desc=Keep ALL the stuff in VERSION CONTROL!! +root-readme=/var/www/about.html +# footer=/var/www/footer.html + +# if you do not want that webcrawler (like google) index your site robots=noindex, nofollow -# include=/etc/gitrepos +# if cgit messes up links, use a virtual-root. For example has cgit.example.org/ this value: +virtual-root=/ + +side-by-side-diffs=0 + +# needs python-pygments +source-filter=/usr/lib/cgit/filters/syntax-highlighting.py + +# Format markdown, restructuredtext, manpages, text files, and html files through the right converters +about-filter=/usr/lib/cgit/filters/about-formatting.sh + +# available snaps +snapshots=tar.gz zip + +# Specify some default clone urls using macro expansion +clone-url=ssh://git@hostname.local:64822~repositories/$CGIT_REPO_URL git@hostname.local:/home/git/repositories/$CGIT_REPO_URL + +## +## List of common mimetypes +## + +mimetype.gif=image/gif +mimetype.html=text/html +mimetype.jpg=image/jpeg +mimetype.jpeg=image/jpeg +mimetype.pdf=application/pdf +mimetype.png=image/png +mimetype.svg=image/svg+xml + +## +### Search for these files in the root of the default branch of repositories +### for coming up with the about page: +### +readme=:README.md +readme=:readme.md +readme=:README.mkd +readme=:readme.mkd +readme=:README.rst +readme=:readme.rst +readme=:README.html +readme=:readme.html +readme=:README.htm +readme=:readme.htm +readme=:README.txt +readme=:readme.txt +readme=:README +readme=:readme +readme=:INSTALL.md +readme=:install.md +readme=:INSTALL.mkd +readme=:install.mkd +readme=:INSTALL.rst +readme=:install.rst +readme=:INSTALL.html +readme=:install.html +readme=:INSTALL.htm +readme=:install.htm +readme=:INSTALL.txt +readme=:install.txt +readme=:INSTALL +readme=:install + +# sections +section-from-path=1 +section-sort=1 -# syntax highlighting -source-filter=/usr/lib/cgit/filters/syntax-highlighting-edited.sh +# repos +max-repo-count=99999 +remove-suffix=1 +scan-hidden-path=1 +scan-path=/home/git/repositories/ diff --git a/terminaldweller.com/cgit/docker-compose.yaml b/terminaldweller.com/cgit/docker-compose.yaml index d963383..a578b71 100644 --- a/terminaldweller.com/cgit/docker-compose.yaml +++ b/terminaldweller.com/cgit/docker-compose.yaml @@ -1,24 +1,28 @@ version: "3" services: cgit: - image: woahbase/alpine-cgit:x86_64 + image: cgit + build: + context: ./cgit/ networks: - cgitnet ports: - - "8041:80" + - "127.0.0.1:8041:80" - "8042:22" + - "8043:443" restart: unless-stopped environment: - PGID=1000 - PUID=1000 volumes: - # - ./cgit/cgitrc:/etc/cgitrc:ro + - ./cgit/cgitrc:/etc/cgitrc:ro - storage:/home/git/repositories - ./data/ssh:/etc/ssh # - ./data/web:/var/www # - /etc/hosts:/etc/hosts:ro # - /etc/localtime:/etc/localtime:ro - # - ./cgit.conf:/etc/lighttpd/conf.d/cgit.conf + - ./cgit.conf:/etc/lighttpd/cgit.conf:ro + - /etc/letsencrypt/archive/git.terminaldweller.com/ssl.pem:/etc/certs/git.pem:ro bootstrap: image: bootstrap build: -- cgit v1.2.3