From 1a0e6c58c622a04a3550045f09989018d8290c3b Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Thu, 3 Nov 2022 15:26:26 +0330 Subject: cgit update --- terminaldweller.com/cgit/bootstrap/bootstrap.sh | 6 ++-- .../cgit/bootstrap/docker-entrypoint.sh | 5 ++-- terminaldweller.com/cgit/cgit.conf | 19 +++++++++++++ terminaldweller.com/cgit/cgit/Dockerfile | 2 +- terminaldweller.com/cgit/cgit/cgitrc | 4 +-- terminaldweller.com/cgit/cgit/nginx.conf | 32 ---------------------- terminaldweller.com/cgit/docker-compose.yaml | 20 +++++++++----- 7 files changed, 41 insertions(+), 47 deletions(-) create mode 100644 terminaldweller.com/cgit/cgit.conf delete mode 100644 terminaldweller.com/cgit/cgit/nginx.conf diff --git a/terminaldweller.com/cgit/bootstrap/bootstrap.sh b/terminaldweller.com/cgit/bootstrap/bootstrap.sh index a943ffb..d504064 100755 --- a/terminaldweller.com/cgit/bootstrap/bootstrap.sh +++ b/terminaldweller.com/cgit/bootstrap/bootstrap.sh @@ -1,5 +1,6 @@ #!/bin/sh set -e +set -x GIT_REPO_DIR=/etc/gitrepos ORIGIN_HTTPS=https://github.com/terminaldweller @@ -28,7 +29,6 @@ REPOS="cgrep \ seer \ devi-githooks \ kaminokumo \ - wikis \ grpc \ faultreiber \ luatablegen \ @@ -42,12 +42,12 @@ bootstrap() { update_repos() { for REPO in ${REPOS}; do - (cd "${GIT_REPO_DIR}/${REPO}" && git fetch) + (cd "${GIT_REPO_DIR}/${REPO}".git && git fetch || true) done } on_startup() { - dir_list=$(ls -A == "$1") + dir_list=$(ls -A "$1") if [ -z "$dir_list" ]; then bootstrap else diff --git a/terminaldweller.com/cgit/bootstrap/docker-entrypoint.sh b/terminaldweller.com/cgit/bootstrap/docker-entrypoint.sh index a6ea4d5..833d95b 100755 --- a/terminaldweller.com/cgit/bootstrap/docker-entrypoint.sh +++ b/terminaldweller.com/cgit/bootstrap/docker-entrypoint.sh @@ -1,6 +1,7 @@ #!/bin/sh set -e +set -x . /bootstrap.sh -on_startup -crond -s -P -f +on_startup /etc/gitrepos/ +crond -n -s -P diff --git a/terminaldweller.com/cgit/cgit.conf b/terminaldweller.com/cgit/cgit.conf new file mode 100644 index 0000000..ac59b7a --- /dev/null +++ b/terminaldweller.com/cgit/cgit.conf @@ -0,0 +1,19 @@ +server.modules += ( "mod_cgi", "mod_rewrite" ) + +#$SERVER["socket"] == ":443" { +$SERVER["socket"] == ":80" { + #ssl.engine = "enable" + #ssl.pemfile = "/etc/lighttpd/ssl/git.example.com.pem" + + server.name = "git.terminaldweller.com" + server.document-root = "/usr/share/webapps/cgit/" + + index-file.names = ( "cgit.cgi" ) + cgi.assign = ( "cgit.cgi" => "" ) + mimetype.assign = ( ".css" => "text/css" ) + url.rewrite-once = ( + "^/cgit/cgit.css" => "/cgit.css", + "^/cgit/cgit.png" => "/cgit.png", + "^/([^?/]+/[^?]*)?(?:\?(.*))?$" => "/cgit.cgi?url=$1&$2", + ) +} diff --git a/terminaldweller.com/cgit/cgit/Dockerfile b/terminaldweller.com/cgit/cgit/Dockerfile index 247023a..8646b5c 100644 --- a/terminaldweller.com/cgit/cgit/Dockerfile +++ b/terminaldweller.com/cgit/cgit/Dockerfile @@ -1,2 +1,2 @@ FROM alpine:3.16 -RUN apk add && apk add --no-cache cgit git fcgiwrap highlight +RUN apk add && apk add --no-cache busybox-initscripts cgit git spawn-fcgi fcgiwrap highlight nginx diff --git a/terminaldweller.com/cgit/cgit/cgitrc b/terminaldweller.com/cgit/cgit/cgitrc index 3b72aa7..a2c216e 100644 --- a/terminaldweller.com/cgit/cgit/cgitrc +++ b/terminaldweller.com/cgit/cgit/cgitrc @@ -2,7 +2,7 @@ css=/cgit/cgit.css # logo=/cgit.png # git repos go here -scan-path=/srv/git/ +scan-path=/home/git/repositories virtual-root=/ @@ -13,7 +13,7 @@ readme:=README.md # robots robots=noindex, nofollow -include=/etc/cgitrepos +# include=/etc/gitrepos # syntax highlighting source-filter=/usr/lib/cgit/filters/syntax-highlighting-edited.sh diff --git a/terminaldweller.com/cgit/cgit/nginx.conf b/terminaldweller.com/cgit/cgit/nginx.conf deleted file mode 100644 index 1fea320..0000000 --- a/terminaldweller.com/cgit/cgit/nginx.conf +++ /dev/null @@ -1,32 +0,0 @@ -worker_processes 1; - -events { - worker_connections 1024; -} - -http { - include mime.types; - default_type application/octet-stream; - sendfile on; - keepalive_timeout 65; - gzip on; - - server { - listen 80; - - server_name git.terminaldweller.com; - - root /usr/share/git; - - try_files $uri @cgit; - - location @cgit { - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi; - fastcgi_param PATH_INFO $uri; - fastcgi_param QUERY_STRING $args; - fastcgi_param HTTP_HOST $server_name; - fastcgi_pass unix:/run/fcgiwrap.socket; - } - } -} diff --git a/terminaldweller.com/cgit/docker-compose.yaml b/terminaldweller.com/cgit/docker-compose.yaml index 55484ed..d963383 100644 --- a/terminaldweller.com/cgit/docker-compose.yaml +++ b/terminaldweller.com/cgit/docker-compose.yaml @@ -1,18 +1,24 @@ version: "3" services: cgit: - image: cgit - build: - context: ./cgit/ + image: woahbase/alpine-cgit:x86_64 networks: - cgitnet ports: - - "8040:8080" + - "8041:80" + - "8042:22" restart: unless-stopped + environment: + - PGID=1000 + - PUID=1000 volumes: - - ./nginx.conf:/etc/nginx/nginx.conf:ro - - ./cgitrc:/etc/cgitrc:ro - - storage:/etc/gitrepos/ + # - ./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 bootstrap: image: bootstrap build: -- cgit v1.2.3