summaryrefslogtreecommitdiff
path: root/per-service
diff options
context:
space:
mode:
authorAndy Doan <andy.doan@linaro.org>2016-10-28 11:06:06 -0500
committerAndy Doan <andy.doan@linaro.org>2016-10-28 17:24:54 +0000
commitced55980f10f4f305be13539485d1aaeace23915 (patch)
treeaa3c752fa7c9fa09f2388fd954a73d6e6fbc4c78 /per-service
parentbb86fad7b62c827a10a708e756fc82f580b6debc (diff)
downloadansible-playbooks-ced55980f10f4f305be13539485d1aaeace23915.tar.gz
cgit: fix the git-http-backend
Now that we don't expose the old gitweb apache directory, we need to handle git http smart protocol requests. This copies the template and task from the apache-website role. Once we convert everything over to cgit, there will be no need for this role, so I think this is the easiest path forward. Change-Id: I58c9657d7cb2ea16504a3aa4d1ad9f4509e42ea0 Reviewed-on: https://review.linaro.org/15099 Reviewed-by: Ben Copeland <ben.copeland@linaro.org>
Diffstat (limited to 'per-service')
-rw-r--r--per-service/git-servers/files/git.linaro.org.conf12
-rw-r--r--per-service/git-servers/roles/cgit/tasks/main.yml5
-rw-r--r--per-service/git-servers/roles/cgit/templates/git-http-backend.cgi11
3 files changed, 18 insertions, 10 deletions
diff --git a/per-service/git-servers/files/git.linaro.org.conf b/per-service/git-servers/files/git.linaro.org.conf
index d292b96..6d697eb 100644
--- a/per-service/git-servers/files/git.linaro.org.conf
+++ b/per-service/git-servers/files/git.linaro.org.conf
@@ -80,16 +80,12 @@ ServerTokens Prod
AliasMatch ^/git-http/(.*)/clone.bundle$ {{ repo_root }}/$1/clone.bundle
AliasMatch ^/git/(.*)/clone.bundle$ {{ repo_root }}/$1/clone.bundle
- SetEnv GIT_HTTP_EXPORT_ALL 1
- SetEnv GIT_PROJECT_ROOT {{ repo_root }}
- SetEnv GITWEB_CONFIG /etc/gitweb.{{ git_host }}.conf
-
SetEnvIf User-Agent "Amazon Route 53 Health Check" dontlog
AliasMatch ^/git/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ {{ repo_root }}/$1
AliasMatch ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ {{ repo_root }}/$1
- ScriptAliasMatch "(?x)^/git/(.*/(HEAD | info/refs | objects/info/[^/]+ | git-(upload|receive)-pack))$" /var/www/{{ git_host }}/git-http-backend.cgi
+ ScriptAliasMatch "(?x)^/git/(.*/(HEAD | info/refs | objects/info/[^/]+ | git-(upload|receive)-pack))$" {{ apache_root }}/cgit/git-http-backend.cgi
<Directory "{{ repo_root }}">
AllowOverride None
@@ -213,16 +209,12 @@ ServerTokens Prod
AliasMatch ^/git-http/(.*)/clone.bundle$ {{ repo_root }}/$1/clone.bundle
AliasMatch ^/git/(.*)/clone.bundle$ {{ repo_root }}/$1/clone.bundle
- SetEnv GIT_HTTP_EXPORT_ALL 1
- SetEnv GIT_PROJECT_ROOT {{ repo_root }}
- SetEnv GITWEB_CONFIG /etc/gitweb.{{ git_host }}.conf
-
SetEnvIf User-Agent "Amazon Route 53 Health Check" dontlog
AliasMatch ^/git/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ {{ repo_root }}/$1
AliasMatch ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ {{ repo_root }}/$1
- ScriptAliasMatch "(?x)^/git/(.*/(HEAD | info/refs | objects/info/[^/]+ | git-(upload|receive)-pack))$" /var/www/{{ git_host }}/git-http-backend.cgi
+ ScriptAliasMatch "(?x)^/git/(.*/(HEAD | info/refs | objects/info/[^/]+ | git-(upload|receive)-pack))$" {{ apache_root }}/cgit/git-http-backend.cgi
<Directory "{{ repo_root }}/">
AllowOverride None
diff --git a/per-service/git-servers/roles/cgit/tasks/main.yml b/per-service/git-servers/roles/cgit/tasks/main.yml
index 845f1fb..c645b27 100644
--- a/per-service/git-servers/roles/cgit/tasks/main.yml
+++ b/per-service/git-servers/roles/cgit/tasks/main.yml
@@ -44,5 +44,10 @@
copy: dest={{ apache_root }}/cgit/cgit owner=root group=root mode=0755
content="#!/bin/sh\n{{ tools_checkout_dir }}/cgit/cgit\n"
+- name: Install git-http-backend suexec script
+ template: src=git-http-backend.cgi
+ dest={{ apache_root }}/cgit/git-http-backend.cgi
+ mode=0755
+
- name: Create a symlink for rst2html.py
file: src=/usr/bin/rst2html dest=/usr/bin/rst2html.py state=link
diff --git a/per-service/git-servers/roles/cgit/templates/git-http-backend.cgi b/per-service/git-servers/roles/cgit/templates/git-http-backend.cgi
new file mode 100644
index 0000000..b84afb5
--- /dev/null
+++ b/per-service/git-servers/roles/cgit/templates/git-http-backend.cgi
@@ -0,0 +1,11 @@
+#!/bin/sh
+# {{ MANAGED_HEADER }}
+# suexec wrapper for git-http-backend
+
+export GIT_PROJECT_ROOT={{ repo_root }}
+{% if server_access == "public" %}
+export GIT_HTTP_EXPORT_ALL=true
+{% endif %}
+export PATH_INFO=$(echo $SCRIPT_URL | sed 's.^/git..')
+
+/usr/lib/git-core/git-http-backend