diff options
| author | Paul Buetow <paul@buetow.org> | 2026-01-10 11:41:30 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-01-10 11:41:30 +0200 |
| commit | 716065b4b3708840fb2c3ecc293139d717f12f4d (patch) | |
| tree | 6922922647c9e6c63bb4105404e51d616cbd4382 /f3s/git-server | |
| parent | 963378fb61a63086ac1159563ef1957e8984a439 (diff) | |
Fix git-http-backend: insert location into existing server block
- Use sed to insert git-http-backend location into default.conf
- Location must be inside server block, not separate file
- Fixes nginx config syntax error
Diffstat (limited to 'f3s/git-server')
| -rw-r--r-- | f3s/git-server/helm-chart/templates/deployment.yaml | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/f3s/git-server/helm-chart/templates/deployment.yaml b/f3s/git-server/helm-chart/templates/deployment.yaml index 608b28b..4c17e2f 100644 --- a/f3s/git-server/helm-chart/templates/deployment.yaml +++ b/f3s/git-server/helm-chart/templates/deployment.yaml @@ -94,28 +94,24 @@ spec: sed -i 's|pid /var/run/nginx.pid;|pid /tmp/nginx.pid;|' /tmp/nginx.conf sed -i 's|/etc/nginx/conf.d/|/tmp/conf.d/|' /tmp/nginx.conf - # Add git-http-backend location to default.conf (before the cgit location) - cat > /tmp/conf.d/git-http-backend.conf <<'EOF' - # Git HTTP backend for clone/fetch/pull operations - location ~ ^/([^/]+\.git)/(.*) { - # Enable CORS for cross-origin requests - add_header 'Access-Control-Allow-Origin' '*'; - add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; - - # FastCGI parameters for git-http-backend - fastcgi_pass unix:/tmp/fcgiwrap.sock; - fastcgi_param SCRIPT_FILENAME /usr/libexec/git-core/git-http-backend; - fastcgi_param GIT_PROJECT_ROOT /repos/repos; - fastcgi_param GIT_HTTP_EXPORT_ALL ""; - fastcgi_param PATH_INFO /$1/$2; - fastcgi_param REMOTE_USER $remote_user; - include fastcgi_params; - } - EOF - # Update default.conf to use /tmp socket for cgit sed -i 's|unix:/var/run/fcgiwrap.sock|unix:/tmp/fcgiwrap.sock|' /tmp/conf.d/default.conf + # Add git-http-backend location to default.conf (insert before the cgit location) + # Find the server block and add the location directive + sed -i '/location \/ {/i \ + # Git HTTP backend for clone/fetch/pull operations\ + location ~ ^/([^/]+\\.git)/(.*) {\ + fastcgi_pass unix:/tmp/fcgiwrap.sock;\ + fastcgi_param SCRIPT_FILENAME /usr/libexec/git-core/git-http-backend;\ + fastcgi_param GIT_PROJECT_ROOT /repos/repos;\ + fastcgi_param GIT_HTTP_EXPORT_ALL "";\ + fastcgi_param PATH_INFO /$1/$2;\ + fastcgi_param REMOTE_USER $remote_user;\ + include fastcgi_params;\ + }\ + ' /tmp/conf.d/default.conf + # Start fcgiwrap with socket in /tmp spawn-fcgi -s /tmp/fcgiwrap.sock -n -- /usr/bin/fcgiwrap & sleep 1 |
