Commit: 6df01ec
Parent: a2f21b8

Smart HTTP clone with nginx+FastCGI

Mårten Åsberg committed on 2025-11-22 at 20:19
WIP: Nginx+FastCGI Smart HTTP clone

WIP: Nginx as git user

WIP: AI "help" for "fixing" smart HTTP clone

WIP: Better fix maybe

WIP: I don't know

I mean, I don't know better than that AI, but it can't seem to fix it either 🤷

WIP: AI AI AI

Can it AI?

Working smart HTTP clone implementation

The AI did it!
GitBrowser.containerfile +0 -0
diff --git a/.containerfile b/GitBrowser.containerfile
similarity index 100%
rename from .containerfile
rename to GitBrowser.containerfile
SmartHttpClone.containerfile +21 -0
diff --git a/SmartHttpClone.containerfile b/SmartHttpClone.containerfile
new file mode 100644
index 0000000..279744e
@@ -0,0 +1,21 @@
FROM nginx:1.29.3@sha256:553f64aecdc31b5bf944521731cd70e35da4faed96b2b7548a3d8e2598c52a42
RUN apt-get update && apt-get install -y \
git \
fcgiwrap \
spawn-fcgi \
&& rm -rf /var/lib/apt/lists/*
RUN groupadd -g 1001 git && \
useradd -r -u 1001 -g git -s /bin/bash git && \
mkdir -p /git /var/run/fcgiwrap && \
mkdir -p /var/cache/nginx/client_temp /var/cache/nginx/proxy_temp /var/cache/nginx/fastcgi_temp /var/cache/nginx/uwsgi_temp /var/cache/nginx/scgi_temp && \
chown -R git:git /git /var/run/fcgiwrap /var/cache/nginx
COPY ./SmartHttpClone/nginx.conf /etc/nginx/nginx.conf
COPY ./SmartHttpClone/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 80
ENTRYPOINT ["/entrypoint.sh"]
SmartHttpClone/entrypoint.sh +8 -0
diff --git a/SmartHttpClone/entrypoint.sh b/SmartHttpClone/entrypoint.sh
new file mode 100644
index 0000000..1730f52
@@ -0,0 +1,8 @@
#!/bin/bash
set -e
# Start fcgiwrap (will run as current user when container runs as --user 1001:1001)
spawn-fcgi -s /var/run/fcgiwrap/fcgiwrap.socket -- /usr/sbin/fcgiwrap
# Start nginx in foreground
exec nginx -g 'daemon off;'
SmartHttpClone/nginx.conf +28 -0
diff --git a/SmartHttpClone/nginx.conf b/SmartHttpClone/nginx.conf
new file mode 100644
index 0000000..ff84710
@@ -0,0 +1,28 @@
worker_processes 1;
error_log /tmp/nginx-error.log;
pid /tmp/nginx.pid;
events {
worker_connections 1024;
}
http {
server {
listen *:80;
server_name $hostname;
location ~ (^/\w+\.git/.*) {
# Set chunks to unlimited, as the bodies can be huge
client_max_body_size 0;
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
include fastcgi_params;
fastcgi_param GIT_HTTP_EXPORT_ALL "0";
fastcgi_param GIT_PROJECT_ROOT /git;
fastcgi_param PATH_INFO $1;
fastcgi_pass unix:/var/run/fcgiwrap/fcgiwrap.socket;
}
}
}