From 56150650dc2f1adfb72301489d926a8a67b82b27 Mon Sep 17 00:00:00 2001 From: onelin Date: Tue, 7 Jul 2026 21:04:17 +0200 Subject: Unify docker image This makes it easier to manage and unifies the services that essentially belong together. Might consider making it a split configuration again later, but for now it makes much more sense such that fail2ban can better operate with all the available logs instead of managing the circus that is docker volumes. --- cgit/40-fcgiwrap.sh | 10 ---- cgit/Dockerfile | 50 ------------------ cgit/about.html | 4 -- cgit/cgit.png | Bin 1462 -> 0 bytes cgit/cgitrc | 28 ---------- cgit/css_variable_colors.sh | 30 ----------- cgit/everforest.css | 49 ------------------ cgit/favicon.png | Bin 6713 -> 0 bytes cgit/nginx.conf | 22 -------- docker-compose-setup.yml | 2 +- docker-compose.yml | 17 +++--- gitolite/Dockerfile | 98 ++++++++++++++++++++++++++++++++--- gitolite/cgit/40-fcgiwrap.sh | 10 ++++ gitolite/cgit/Dockerfile | 50 ++++++++++++++++++ gitolite/cgit/about-formatting.sh | 34 ++++++++++++ gitolite/cgit/about.html | 4 ++ gitolite/cgit/cgit.png | Bin 0 -> 1462 bytes gitolite/cgit/cgitrc | 37 +++++++++++++ gitolite/cgit/css_variable_colors.sh | 35 +++++++++++++ gitolite/cgit/everforest.css | 61 ++++++++++++++++++++++ gitolite/cgit/favicon.ico | Bin 0 -> 432254 bytes gitolite/cgit/favicon.png | Bin 0 -> 6713 bytes gitolite/cgit/nginx.conf | 22 ++++++++ gitolite/docker-entrypoint.sh | 12 ++++- rawhost.sh | 28 ++++++++++ 25 files changed, 392 insertions(+), 211 deletions(-) delete mode 100644 cgit/40-fcgiwrap.sh delete mode 100644 cgit/Dockerfile delete mode 100644 cgit/about.html delete mode 100644 cgit/cgit.png delete mode 100644 cgit/cgitrc delete mode 100644 cgit/css_variable_colors.sh delete mode 100644 cgit/everforest.css delete mode 100644 cgit/favicon.png delete mode 100644 cgit/nginx.conf create mode 100644 gitolite/cgit/40-fcgiwrap.sh create mode 100644 gitolite/cgit/Dockerfile create mode 100644 gitolite/cgit/about-formatting.sh create mode 100644 gitolite/cgit/about.html create mode 100644 gitolite/cgit/cgit.png create mode 100644 gitolite/cgit/cgitrc create mode 100644 gitolite/cgit/css_variable_colors.sh create mode 100644 gitolite/cgit/everforest.css create mode 100644 gitolite/cgit/favicon.ico create mode 100644 gitolite/cgit/favicon.png create mode 100644 gitolite/cgit/nginx.conf create mode 100644 rawhost.sh diff --git a/cgit/40-fcgiwrap.sh b/cgit/40-fcgiwrap.sh deleted file mode 100644 index 3f788af..0000000 --- a/cgit/40-fcgiwrap.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -set -ex - -# start fastcgiwrap -rm -f /run/fcgiwrap.socket -nohup fcgiwrap -s unix:/run/fcgiwrap.socket & -while ! [ -S /run/fcgiwrap.socket ]; do sleep .2; done -chown nginx:www-data /run/fcgiwrap.socket -#chmod g+rwx /run/fcgiwrap.socket -#test -f nohup.out && rm -f ./nohup.out diff --git a/cgit/Dockerfile b/cgit/Dockerfile deleted file mode 100644 index 007fe23..0000000 --- a/cgit/Dockerfile +++ /dev/null @@ -1,50 +0,0 @@ -FROM nginx:1.29.7-alpine-slim AS build - -RUN set -x \ - && apk add --no-cache gcc make curl linux-headers musl-dev zlib-dev libressl-dev libintl musl-libintl - -RUN wget 'https://git.zx2c4.com/cgit/snapshot/cgit-1.3.tar.xz' \ - && tar -xvf cgit-1.3.tar.xz - -WORKDIR /cgit-1.3 -RUN make get-git \ - && DESTDIR=pkg NO_REGEX=NeedsStartEnd make install - -WORKDIR /cgit-1.3/pkg -RUN tar -czvf cgit-1.3.tar.gz . - - -FROM nginx:1.29.7-alpine-slim -COPY --from=build /cgit-1.3/pkg/cgit-1.3.tar.gz /cgit-1.3.tar.gz - -ARG DOMAIN=localhost - -RUN set -x \ - && apk add --no-cache fcgiwrap envsubst \ - && tar -xvf /cgit-1.3.tar.gz - -RUN apk update && apk update - -COPY 40-fcgiwrap.sh /docker-entrypoint.d/ -RUN chmod +x /docker-entrypoint.d/40-fcgiwrap.sh - -COPY cgitrc /etc/ - -COPY nginx.conf / -RUN sed "s/\$DOMAIN/$DOMAIN/g" /nginx.conf > /etc/nginx/conf.d/default.conf -RUN rm /nginx.conf - -RUN addgroup nginx www-data - -COPY about.html /var/www/htdocs/cgit/ -COPY cgit.png /var/www/htdocs/cgit/logo.png -COPY favicon.ico /var/www/htdocs/cgit/ - -COPY css_variable_colors.sh / -COPY everforest.css /var/www/htdocs/cgit/ -RUN sh css_variable_colors.sh - -#RUN sed -i -Ee 's/pid\s+.*;/pid \/tmp\/nginx.pid;/' /etc/nginx/nginx.conf -#RUN sed -i -Ee 's/error_log\s+.*;/error_log \/dev\/stdout;/' /etc/nginx/nginx.conf -# -#USER nginx diff --git a/cgit/about.html b/cgit/about.html deleted file mode 100644 index ede0cb5..0000000 --- a/cgit/about.html +++ /dev/null @@ -1,4 +0,0 @@ -

Disclaimer

-I request that none of this code, in part or in full, be hosted on Github, -Sourceforge, or any other proprietary platform. This request is made out of -respect for both me, the developer and for you, the user. diff --git a/cgit/cgit.png b/cgit/cgit.png deleted file mode 100644 index 65cb7da..0000000 Binary files a/cgit/cgit.png and /dev/null differ diff --git a/cgit/cgitrc b/cgit/cgitrc deleted file mode 100644 index 6abeaf5..0000000 --- a/cgit/cgitrc +++ /dev/null @@ -1,28 +0,0 @@ -# Needed to avoid duplicating URI in every href -virtual-root=/ - -# Enable us "ignoring" specific repositories -enable-git-config=1 - -# Self explanatory -enable-http-clone=1 - -# Remove .git suffix -remove-suffix=1 - -# Needs to be mountpoint of the gitolite volume -scan-path=/var/lib/git/repositories -project-list=/var/lib/git/projects.list - -# Requires python -#source-filter=/usr/lib/cgit/filters/syntax-high.py -#about-filter=/usr/lib/cgit/filters/about-formatting.sh - -root-title=Personal projects -root-desc=A brief collection -root-readme=/var/www/htdocs/cgit/about.html -local-time=1 - -css=/everforest.css -css=/cgit.css -logo=/logo.png diff --git a/cgit/css_variable_colors.sh b/cgit/css_variable_colors.sh deleted file mode 100644 index 9ef2818..0000000 --- a/cgit/css_variable_colors.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -CGIT_CSS_PATH=/var/www/htdocs/cgit/cgit.css -sed -i -Ee 's/\/var(--color-bg)/g' "${CGIT_CSS_PATH}" -sed -i -Ee 's/\/var(--color-accent)/g' "${CGIT_CSS_PATH}" -sed -i -Ee 's/\/var(--color-fg)/g' "${CGIT_CSS_PATH}" -sed -i -Ee 's/#333\>/var(--color-fg)/g' "${CGIT_CSS_PATH}" - -sed -i -Ee 's/#ccc\>/var(--color-white-dim)/g' "${CGIT_CSS_PATH}" -sed -i -Ee 's/#000\>/var(--color-fg-bright)/g' "${CGIT_CSS_PATH}" - -sed -i -Ee 's/#777\>/var(--color-white-dim)/g' "${CGIT_CSS_PATH}" -sed -i -Ee 's/#f7f7f7\>/var(--color-bg-bright)/g' "${CGIT_CSS_PATH}" - -sed -i -Ee 's/#eee\>/var(--color-black-bright)/g' "${CGIT_CSS_PATH}" - -# links -sed -i -Ee 's/#00f\>/var(--color-accent)/g' "${CGIT_CSS_PATH}" - -# ago, minutes, hours -sed -i -Ee 's/#080\>/var(--color-green)/g' "${CGIT_CSS_PATH}" -# ago, days -sed -i -Ee 's/#040\>/var(--color-green-bright)/g' "${CGIT_CSS_PATH}" -# ago, weeks -sed -i -Ee 's/#444\>/var(--color-yellow)/g' "${CGIT_CSS_PATH}" -# ago, months -sed -i -Ee 's/#888\>/var(--color-yellow-bright)/g' "${CGIT_CSS_PATH}" -# ago, years -sed -i -Ee 's/#bbb\>/var(--color-white)/g' "${CGIT_CSS_PATH}" - diff --git a/cgit/everforest.css b/cgit/everforest.css deleted file mode 100644 index 60c64f3..0000000 --- a/cgit/everforest.css +++ /dev/null @@ -1,49 +0,0 @@ -:root { - - /* Regular */ - --color-black: #1e2326; - --color-red: #e67e80; - --color-green: #a7c080; - --color-yellow: #dbbc7f; - --color-blue: #7fbbb3; - --color-purple: #d699b6; - --color-turquoise: #7fbbb3; - --color-white: #d3c6aa; - - /* Bright */ - --color-black-bright: #4f5b58; - --color-red-bright: #e66868; - --color-green-bright: #93b259; - --color-yellow-bright: #dfa000; - --color-blue-bright: #3a94c5; - --color-purple-bright: #df69ba; - --color-turquoise-bright: #3a94c5; - --color-white-bright: #ffffff; - - --color-white-dim: #7a8478; - - - --color-fg: #d3c6aa; - --color-bg: #3c4841; /*#272e33;*/ - --color-fg-bright: #fff; - --color-bg-bright: #374145; - --color-fg-sel: #fff; - --color-bg-sel: #414b50; - - --color-accent: var(--color-green); - --color-header: var(--color-accent); - --color-list-point: var(--color-accent); - - --color-var(--color-blue): -} - -body { - background-color: var(--color-bg); - color: var(--color-fg); -} - -div#cgit table.tabs td.form input, -div#cgit table.tabs td.form select { - background-color: var(--color-bg-bright); - color: var(--color-fg-bright); -} diff --git a/cgit/favicon.png b/cgit/favicon.png deleted file mode 100644 index da6269e..0000000 Binary files a/cgit/favicon.png and /dev/null differ diff --git a/cgit/nginx.conf b/cgit/nginx.conf deleted file mode 100644 index 7b03929..0000000 --- a/cgit/nginx.conf +++ /dev/null @@ -1,22 +0,0 @@ -server { - server_name $DOMAIN; - - listen [::]:80; - listen 80; - - access_log /var/log/nginx/cgit-access.log; - error_log /var/log/nginx/cgit-error.log; - - root /var/www/htdocs/cgit; - try_files $uri @cgit; - - location @cgit { - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME /var/www/htdocs/cgit/cgit.cgi; - fastcgi_pass unix:/run/fcgiwrap.socket; - - fastcgi_param PATH_INFO $uri; - fastcgi_param QUERY_STRING $args; - fastcgi_param HTTP_HOST $server_name; - } -} diff --git a/docker-compose-setup.yml b/docker-compose-setup.yml index da619ac..43d69fd 100644 --- a/docker-compose-setup.yml +++ b/docker-compose-setup.yml @@ -7,7 +7,7 @@ services: volumes: - gitolite-sshkeys:/etc/ssh/keys - gitolite-git:/var/lib/git - command: ["true"] + command: ["/docker-entrypoint.sh", "true"] volumes: gitolite-sshkeys: diff --git a/docker-compose.yml b/docker-compose.yml index 143c85e..4fbbbc9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,24 +1,23 @@ services: gitolite: build: gitolite - ports: - - 2222:22 - volumes: - - gitolite-sshkeys:/etc/ssh/keys - - gitolite-git:/var/lib/git - cgit: - build: cgit environment: - DOMAIN=${DOMAIN} ports: + - 2222:22 - 8080:80 volumes: + - gitolite-sshkeys:/etc/ssh/keys - gitolite-git:/var/lib/git - logs_nginx:/var/log/nginx - #command: ["nginx-debug"] + #cgit: + # build: cgit + # ports: + # volumes: + # - gitolite-git:/var/lib/git + # #command: ["nginx-debug"] volumes: gitolite-sshkeys: gitolite-git: logs_nginx: - diff --git a/gitolite/Dockerfile b/gitolite/Dockerfile index 8ac87f6..44af1f0 100644 --- a/gitolite/Dockerfile +++ b/gitolite/Dockerfile @@ -1,27 +1,109 @@ +# Compile cgit +FROM alpine:3.23.3 AS build + +RUN set -x \ + && apk add --no-cache gcc g++ cmake make curl linux-headers musl-dev zlib-dev libressl-dev libintl musl-libintl + +# Compile cgit +RUN set -x \ + && wget 'https://git.zx2c4.com/cgit/snapshot/cgit-1.3.tar.xz' \ + && tar -xvf cgit-1.3.tar.xz \ + && make -C /cgit-1.3 get-git \ + && DESTDIR=/pkg NO_REGEX=NeedsStartEnd make -C /cgit-1.3 install + + + #&& tar -czvf deps.tar.gz -C /cgit-1.3/pkg . + + +# Compile cmark-gfm +RUN set -x \ + && wget https://github.com/github/cmark-gfm/archive/refs/tags/0.29.0.gfm.13.tar.gz \ + && tar -xvf 0.29.0.gfm.13.tar.gz \ + && cmake -S /cmark-gfm-0.29.0.gfm.13 -B /cmark-gfm-0.29.0.gfm.13/build \ + -DCMAKE_POLICY_VERSION_MINIMUM=4.0 -DCMAKE_INSTALL_PREFIX=pkg \ + && cmake --build /cmark-gfm-0.29.0.gfm.13/build \ + && cmake --install /cmark-gfm-0.29.0.gfm.13/build + +RUN set -x \ + && tar -czvf deps.tar.gz -C pkg . + +# Configure nginx & cgit + fcgiwrap FROM alpine:3.23.3 +COPY --from=build /deps.tar.gz /deps.tar.gz + +ARG DOMAIN=localhost -# Install OpenSSH server and Gitolite -# Unlock the automatically-created git user RUN set -x \ - && apk add --no-cache openrc fail2ban gitolite openssh + && apk add --no-cache \ + curl cmark fail2ban fcgiwrap gcc gitolite libintl libressl-dev linux-headers \ + make musl-dev musl-libintl nginx openrc openssh py3-pygments zlib-dev \ + && tar -xvf /deps.tar.gz -RUN apk update && apk update +RUN apk update \ + && apk upgrade --no-cache \ + && sed -i '/getty/d' /etc/inittab -RUN rc-update add fail2ban +COPY cgit/40-fcgiwrap.sh /docker-entrypoint.d/ +RUN chmod +x /docker-entrypoint.d/40-fcgiwrap.sh -RUN git config --system advice.defaultBranchName false +COPY cgit/cgitrc /etc/ + +COPY cgit/nginx.conf / +RUN sed "s/\$DOMAIN/$DOMAIN/g" /nginx.conf > /etc/nginx/http.d/default.conf \ + && rm /nginx.conf + +RUN addgroup nginx www-data + +COPY cgit/about.html /var/www/htdocs/cgit/ +COPY cgit/cgit.png /var/www/htdocs/cgit/logo.png +COPY cgit/favicon.ico /var/www/htdocs/cgit/ + +COPY cgit/css_variable_colors.sh / +COPY cgit/everforest.css /var/www/htdocs/cgit/ +RUN sh css_variable_colors.sh + +COPY cgit/about-formatting.sh /usr/local/lib/cgit/filters/about-formatting.sh +RUN chmod 755 /usr/local/lib/cgit/filters/about-formatting.sh # Volume used to store SSH host keys, generated on first run VOLUME /etc/ssh/keys +RUN rc-update add fail2ban \ + && rc-update add fcgiwrap \ + && rc-update add nginx \ + && rc-update add sshd + +# www-data may not be necessary +RUN addgroup fcgiwrap git +#RUN usermod -G nginx,www-data,git nginx +# Configure gitolite +# Install OpenSSH server and Gitolite +# Unlock the automatically-created git user + +#RUN addgroup -g 102 -S git \ +# && adduser -S -D -H -u 102 -h /var/lib/git -s /sbin/nologin -G git -g git git + +RUN git config --system advice.defaultBranchName false + # Volume used to store all Gitolite data (keys, config and repositories), initialized on first run VOLUME /var/lib/git +RUN chmod 750 /var/lib/git + +# Disable unwanted authentications and Disable sftp subsystem +RUN perl -i -pe 's/^#?((?!Kerberos|GSSAPI|Password)\w*Authentication)\s.*/\1 no/;s/^(PubkeyAuthentication) no/\1 yes/' /etc/ssh/sshd_config \ + && perl -i -pe 's/^#?(PermitRootLogin)\s.*/\1 no/' /etc/ssh/sshd_config \ + && perl -i -pe 's/^(Subsystem\ssftp\s)/#\1/' /etc/ssh/sshd_config + # Permissions are fixed in docker-entrypoint.sh RUN mkdir -p /var/lib/git/local/hooks/common COPY post-receive /var/lib/git/local/hooks/common/ RUN chmod +x /var/lib/git/local/hooks/common/post-receive +# Configure nginx & cgit + fcgiwrap +#RUN addgroup -g 101 -S nginx \ +# && adduser -S -D -H -u 101 -h /var/cache/nginx -s /sbin/nologin -G nginx -g nginx nginx + # Entrypoint responsible for SSH host keys generation, and Gitolite data initialization COPY docker-entrypoint.sh / RUN chmod +x /docker-entrypoint.sh @@ -31,4 +113,6 @@ ENTRYPOINT ["/docker-entrypoint.sh"] EXPOSE 22 # Default command is to run the SSH server -CMD ["sshd"] +#CMD ["sshd"] +#CMD ["/sbin/init"] +CMD ["/sbin/init"] diff --git a/gitolite/cgit/40-fcgiwrap.sh b/gitolite/cgit/40-fcgiwrap.sh new file mode 100644 index 0000000..3f788af --- /dev/null +++ b/gitolite/cgit/40-fcgiwrap.sh @@ -0,0 +1,10 @@ +#!/bin/sh +set -ex + +# start fastcgiwrap +rm -f /run/fcgiwrap.socket +nohup fcgiwrap -s unix:/run/fcgiwrap.socket & +while ! [ -S /run/fcgiwrap.socket ]; do sleep .2; done +chown nginx:www-data /run/fcgiwrap.socket +#chmod g+rwx /run/fcgiwrap.socket +#test -f nohup.out && rm -f ./nohup.out diff --git a/gitolite/cgit/Dockerfile b/gitolite/cgit/Dockerfile new file mode 100644 index 0000000..0c41144 --- /dev/null +++ b/gitolite/cgit/Dockerfile @@ -0,0 +1,50 @@ +FROM nginx:1.29.7-alpine-slim AS build + +RUN set -x \ + && apk add --no-cache gcc make curl linux-headers musl-dev zlib-dev libressl-dev libintl musl-libintl + +RUN wget 'https://git.zx2c4.com/cgit/snapshot/cgit-1.3.tar.xz' \ + && tar -xvf cgit-1.3.tar.xz + +WORKDIR /cgit-1.3 +RUN make get-git \ + && DESTDIR=pkg NO_REGEX=NeedsStartEnd make install + +WORKDIR /cgit-1.3/pkg +RUN tar -czvf cgit-1.3.tar.gz . + + +FROM nginx:1.29.7-alpine-slim +COPY --from=build /cgit-1.3/pkg/cgit-1.3.tar.gz /cgit-1.3.tar.gz + +ARG DOMAIN=localhost + +RUN set -x \ + && apk add --no-cache fcgiwrap py3-pygments \ + && tar -xvf /cgit-1.3.tar.gz + +RUN apk update && apk update + +COPY 40-fcgiwrap.sh /docker-entrypoint.d/ +RUN chmod +x /docker-entrypoint.d/40-fcgiwrap.sh + +COPY cgitrc /etc/ + +COPY nginx.conf / +RUN sed "s/\$DOMAIN/$DOMAIN/g" /nginx.conf > /etc/nginx/conf.d/default.conf +RUN rm /nginx.conf + +RUN addgroup nginx www-data + +COPY about.html /var/www/htdocs/cgit/ +COPY cgit.png /var/www/htdocs/cgit/logo.png +COPY favicon.ico /var/www/htdocs/cgit/ + +COPY css_variable_colors.sh / +COPY everforest.css /var/www/htdocs/cgit/ +RUN sh css_variable_colors.sh + +#RUN sed -i -Ee 's/pid\s+.*;/pid \/tmp\/nginx.pid;/' /etc/nginx/nginx.conf +#RUN sed -i -Ee 's/error_log\s+.*;/error_log \/dev\/stdout;/' /etc/nginx/nginx.conf +# +#USER nginx diff --git a/gitolite/cgit/about-formatting.sh b/gitolite/cgit/about-formatting.sh new file mode 100644 index 0000000..0cd0e5d --- /dev/null +++ b/gitolite/cgit/about-formatting.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +# This may be used with the about-filter or repo.about-filter setting in cgitrc. +# It passes formatting of about pages to differing programs, depending on the usage. + +# Markdown support requires python and markdown-python. +# RestructuredText support requires python and docutils. +# Man page support requires groff. + +# The following environment variables can be used to retrieve the configuration +# of the repository for which this script is called: +# CGIT_REPO_URL ( = repo.url setting ) +# CGIT_REPO_NAME ( = repo.name setting ) +# CGIT_REPO_PATH ( = repo.path setting ) +# CGIT_REPO_OWNER ( = repo.owner setting ) +# CGIT_REPO_DEFBRANCH ( = repo.defbranch setting ) +# CGIT_REPO_SECTION ( = section setting ) +# CGIT_REPO_CLONE_URL ( = repo.clone-url setting ) + +cd "$(dirname $0)/html-converters/" +case "$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]')" in + *.markdown|*.mdown|*.md|*.mkd) cmark-gfm --to html \ + -e footnotes \ + -e table \ + -e strikethrough \ + -e autolink \ + -e tagfilter \ + -e tasklist \ + --width 80 <(cat -); ;; + *.rst) exec ./rst2html; ;; + *.[1-9]) exec ./man2html; ;; + *.htm|*.html) exec cat; ;; + *.txt|*) exec ./txt2html; ;; +esac diff --git a/gitolite/cgit/about.html b/gitolite/cgit/about.html new file mode 100644 index 0000000..ede0cb5 --- /dev/null +++ b/gitolite/cgit/about.html @@ -0,0 +1,4 @@ +

Disclaimer

+I request that none of this code, in part or in full, be hosted on Github, +Sourceforge, or any other proprietary platform. This request is made out of +respect for both me, the developer and for you, the user. diff --git a/gitolite/cgit/cgit.png b/gitolite/cgit/cgit.png new file mode 100644 index 0000000..65cb7da Binary files /dev/null and b/gitolite/cgit/cgit.png differ diff --git a/gitolite/cgit/cgitrc b/gitolite/cgit/cgitrc new file mode 100644 index 0000000..cbfa6a9 --- /dev/null +++ b/gitolite/cgit/cgitrc @@ -0,0 +1,37 @@ +repository-sort=age +clone-url=https://$HTTP_HOST$SCRIPT_NAME/$CGIT_REPO_URL +enable-http-clone=1 + +# Needed to avoid duplicating URI in every href +virtual-root=/ + +# Extra +head-include=/usr/lib/cgit/include.html + +# Enable us "ignoring" specific repositories +enable-git-config=1 + +# Self explanatory +enable-http-clone=1 + +# Remove .git suffix +remove-suffix=1 + +readme=:README.md +about-filter=/usr/local/lib/cgit/filters/about-formatting.sh + +# Needs to be mountpoint of the gitolite volume +project-list=/var/lib/git/projects.list +scan-path=/var/lib/git/repositories + +# Requires python +#source-filter=/usr/lib/cgit/filters/syntax-high.py + +root-title=Personal projects +root-desc=A brief collection +root-readme=/var/www/htdocs/cgit/about.html +local-time=1 + +css=/everforest.css +css=/cgit.css +logo=/logo.png diff --git a/gitolite/cgit/css_variable_colors.sh b/gitolite/cgit/css_variable_colors.sh new file mode 100644 index 0000000..fbab0cc --- /dev/null +++ b/gitolite/cgit/css_variable_colors.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +CGIT_CSS_PATH=/var/www/htdocs/cgit/cgit.css +sed -i -Ee 's/\/var(--color-bg)/g' "${CGIT_CSS_PATH}" +sed -i -Ee 's/\/var(--color-accent)/g' "${CGIT_CSS_PATH}" +sed -i -Ee 's/\/var(--color-fg)/g' "${CGIT_CSS_PATH}" + +# Diffs? +sed -i -Ee 's/\/var(--color-green)/g' "${CGIT_CSS_PATH}" +sed -i -Ee 's/#009\>/var(--color-blue)/g' "${CGIT_CSS_PATH}" +sed -i -Ee 's/\/var(--color-red)/g' "${CGIT_CSS_PATH}" + +sed -i -Ee 's/#333\>/var(--color-fg)/g' "${CGIT_CSS_PATH}" + +sed -i -Ee 's/#ccc\>/var(--color-bg-2)/g' "${CGIT_CSS_PATH}" +sed -i -Ee 's/#000\>/var(--color-fg)/g' "${CGIT_CSS_PATH}" + +sed -i -Ee 's/#777\>/var(--color-white)/g' "${CGIT_CSS_PATH}" +sed -i -Ee 's/#f7f7f7\>/var(--color-bg-1)/g' "${CGIT_CSS_PATH}" + +sed -i -Ee 's/#eee\>/var(--color-bg-2)/g' "${CGIT_CSS_PATH}" + +# links +sed -i -Ee 's/#00f\>/var(--color-accent)/g' "${CGIT_CSS_PATH}" + +# ago, minutes, hours +sed -i -Ee 's/#080\>/var(--color-blue)/g' "${CGIT_CSS_PATH}" +# ago, days +sed -i -Ee 's/#040\>/var(--color-green)/g' "${CGIT_CSS_PATH}" +# ago, weeks +sed -i -Ee 's/#444\>/var(--color-yellow)/g' "${CGIT_CSS_PATH}" +# ago, months +sed -i -Ee 's/#888\>/var(--color-bg-yellow)/g' "${CGIT_CSS_PATH}" +# ago, years +sed -i -Ee 's/#bbb\>/var(--color-grey)/g' "${CGIT_CSS_PATH}" diff --git a/gitolite/cgit/everforest.css b/gitolite/cgit/everforest.css new file mode 100644 index 0000000..46333e3 --- /dev/null +++ b/gitolite/cgit/everforest.css @@ -0,0 +1,61 @@ +:root { + --color-bg-dim: #1e2326; + --color-bg-0: #272e33; + --color-bg-1: #2e383c; + --color-bg-2: #374145; + --color-bg-3: #414b50; + --color-bg-4: #495156; + --color-bg-5: #4f5b58; + --color-bg-red: #493b40; + --color-bg-yellow: #45443c; + --color-bg-green: #3c4841; + --color-bg-blue: #384b55; + --color-bg-purple: #463f48; + --color-bg-visual: #4c3743; + + /* Regular */ + --color-fg: #d3c6aa; + --color-red: #e67e80; + --color-yellow: #dbbc7f; + --color-green: #a7c080; + --color-blue: #7fbbb3; + --color-purple: #d699b6; + --color-aqua: #83c092; + --color-orange: #e69875; + --color-grey-0: #7a8478; + --color-grey-1: #859289; + --color-grey-2: #9da9a0; + --color-grey: var(--color-grey-2); + + --color-black: var(--color-bg-dim); + --color-turquoise: var(--color-aqua); + --color-white: var(--color-grey); + + + --color-bg: var(--color-bg-0); + --color-fg-sel: var(--color-fg); + --color-bg-sel: var(--color-bg-visual); + + --color-accent: var(--color-green); + --color-header-0: var(--color-red); + --color-header-1: var(--color-orange); + --color-header-2: var(--color-yellow); + --color-header-3: var(--color-green); + --color-header-4: var(--color-blue); + --color-header-5: var(--color-purple); + --color-header-delim:var(--color-grey-1); + + --color-list-point-0: var(--color-red); + --color-list-point-1: var(--color-orange); + --color-list-point-2: var(--color-yellow); + --color-list-point-3: var(--color-green); + --color-list-point-4: var(--color-blue); + --color-list-point-5: var(--color-purple); + + --color-var(--color-blue): +} + +body { + background-color: var(--color-bg); + color: var(--color-fg); +} diff --git a/gitolite/cgit/favicon.ico b/gitolite/cgit/favicon.ico new file mode 100644 index 0000000..f4d51ba Binary files /dev/null and b/gitolite/cgit/favicon.ico differ diff --git a/gitolite/cgit/favicon.png b/gitolite/cgit/favicon.png new file mode 100644 index 0000000..da6269e Binary files /dev/null and b/gitolite/cgit/favicon.png differ diff --git a/gitolite/cgit/nginx.conf b/gitolite/cgit/nginx.conf new file mode 100644 index 0000000..f4a115b --- /dev/null +++ b/gitolite/cgit/nginx.conf @@ -0,0 +1,22 @@ +server { + server_name $DOMAIN; + + listen [::]:80; + listen 80; + + access_log /var/log/nginx/cgit-access.log; + error_log /var/log/nginx/cgit-error.log; + + root /var/www/htdocs/cgit; + try_files $uri @cgit; + + location @cgit { + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME /var/www/htdocs/cgit/cgit.cgi; + fastcgi_pass unix:/run/fcgiwrap/fcgiwrap.sock; + + fastcgi_param PATH_INFO $uri; + fastcgi_param QUERY_STRING $args; + fastcgi_param HTTP_HOST $server_name; + } +} diff --git a/gitolite/docker-entrypoint.sh b/gitolite/docker-entrypoint.sh index 3d08d34..d83d9e0 100644 --- a/gitolite/docker-entrypoint.sh +++ b/gitolite/docker-entrypoint.sh @@ -42,8 +42,18 @@ else su - git -c "gitolite setup" fi +su - git -c "chmod 750 ~git/repositories" +su - git -c "chmod 640 ~git/projects.list" + if [ "${1}" != 'sshd' ]; then - sed -i -Ee "s/^([^#]*GIT_CONFIG_KEYS\\s*=>\\s*)'[^']*'\\s*,/\\1'cgit.*',/" /var/lib/git/.gitolite.rc + # LOCAL_CODE => "$ENV{HOME}/local", + + su - git -c "sed -i -Ee \"s/^([^#]*UMASK\\s*=>\\s*)[0-9]*\\s*,/\\1 0027,/\" /var/lib/git/.gitolite.rc" + su - git -c "sed -i -Ee \"s/^([^#]*GIT_CONFIG_KEYS\\s*=>\\s*)'[^']*'\\s*,/\\1'.*',/\" /var/lib/git/.gitolite.rc" + #su - git -c "sed -i -Ee 's/#?(\\s*LOCAL_CODE\\s+=>\\s+\"\\\$ENV\\{HOME\\}\\/local\",.*)/\\1/' ~/.gitolite.rc" + #su - git -c "chmod 650 ~git/repositories" + #su - git -c "chmod 640 ~git/projects.list" + #sed -i -Ee "s/^([^#]*UMASK\\s*=>)\\s*'[^']*'\\s*,/\\1 0027,/" /var/lib/git/.gitolite.rc #sed -i -Ee "s/^([^#]*GIT_CONFIG_KEYS\\s*=>\\s*)'[^']*'\\s*,/\\1'.*',/" /var/lib/git/.gitolite.rc fi diff --git a/rawhost.sh b/rawhost.sh new file mode 100644 index 0000000..f846266 --- /dev/null +++ b/rawhost.sh @@ -0,0 +1,28 @@ +apk add --no-cache gcc make curl linux-headers musl-dev zlib-dev libressl-dev libintl musl-libintl fcgiwrap nginx gitolite +apk update && apk update + +tar -xvf cgit-1.3.tar.xz +cd ~/cgit-1.3 +make get-git + +DESTDIR=pkg NO_REGEX=NeedsStartEnd make install + +cd ~/cgit-1.3/pkg +tar -czvf cgit-1.3.tar.gz . + +cp ~/cgit-1.3/pkg/cgit-1.3.tar.gz /cgit-1.3.tar.gz + +cd / +tar -xvf /cgit-1.3.tar.gz + +scp cgitrc git.nelin.dk:/etc/ +scp nginx.conf git.nelin.dk:/etc/nginx/http.d/ +scp css_variable_colors.sh git.nelin.dk:/ + +scp about.html git.nelin.dk:/var/www/htdocs/cgit/ +scp cgit.png git.nelin.dk:/var/www/htdocs/cgit/logo.png +scp favicon.ico git.nelin.dk:/var/www/htdocs/cgit/ +scp everforest.css git.nelin.dk:/var/www/htdocs/cgit/ +sh css_variable_colors.sh + +chmod 750 /var/lib/git -- cgit v1.3