Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[COOK-2303] Added git::server support for RHEL platform_family, and a…

…llowed the base_path to be specified in case we don't all use /srv/git ;)
  • Loading branch information...
commit 2b08e4791bcb6ca12e7721d6189b58a006ae0a89 1 parent f49f113
@rgeyer rgeyer authored
View
6 README.md
@@ -92,9 +92,9 @@ To install git server:
include_recipe "git::server"
-This creates the directory /srv/git and starts a git daemon, exporting
-all repositories found. Repositories need to be added manually, but
-will be available once they are created.
+This creates the directory specified by git/server/base_path (default is /srv/git)
+and starts a git daemon, exporting all repositories found. Repositories need to be
+added manually, but will be available once they are created.
License and Author
==================
View
2  attributes/default.rb
@@ -35,3 +35,5 @@
default['git']['url'] = "https://github.com/git/git/tarball/v#{node['git']['version']}"
default['git']['checksum'] = "24f1895fa74a23b3d9233fa89a9ef04d83a1cd952d659720d6ea231bbd0c973c"
end
+
+default['git']['server']['base_path'] = "/srv/git"
View
6 metadata.rb
@@ -20,3 +20,9 @@
end
depends "runit", "<= 0.16.2"
+
+attribute "git/server/base_path",
+ :display_name => "Git Daemon Base Path",
+ :description => "A directory containing git repositories to be exposed by the git-daemon",
+ :default => "/srv/git",
+ :recipes => ["git::server"]
View
21 recipes/server.rb
@@ -22,7 +22,7 @@
include_recipe "git"
-directory "/srv/git" do
+directory node["git"]["server"]["base_path"] do
owner "root"
group "root"
mode 00755
@@ -31,8 +31,25 @@
case node['platform_family']
when "debian"
include_recipe "runit"
+
+ package "git-daemon-run"
+
runit_service "git-daemon"
+when "rhel"
+ package "git-daemon"
+
+ template "/etc/xinetd.d/git" do
+ backup false
+ source "git-xinetd.d.erb"
+ owner "root"
+ group "root"
+ mode 00644
+ end
+
+ service "xinetd" do
+ action [:enable, :restart]
+ end
else
log "Platform requires setting up a git daemon service script."
- log "Hint: /usr/bin/git daemon --export-all --user=nobody --group=daemon --base-path=/srv/git"
+ log "Hint: /usr/bin/git daemon --export-all --user=nobody --group=daemon --base-path=#{node["git"]["server"]["base_path"]}"
end
View
14 templates/default/git-xinetd.d.erb
@@ -0,0 +1,14 @@
+# default: off
+# description: The git dæmon allows git repositories to be exported using \
+# the git:// protocol.
+
+service git
+{
+ disable = no
+ socket_type = stream
+ wait = no
+ user = nobody
+ server = /usr/libexec/git-core/git-daemon
+ server_args = --base-path=<%= node["git"]["server"]["base_path"] %> --export-all --syslog --inetd --verbose
+ log_on_failure += USERID
+}
View
2  templates/default/sv-git-daemon-run.erb
@@ -1,3 +1,3 @@
#!/bin/sh
exec 2>&1
-exec /usr/bin/git daemon --export-all --user=nobody --group=daemon --base-path=/srv/git /srv/git
+exec /usr/bin/git daemon --export-all --user=nobody --group=daemon --base-path=<%= node["git"]["server"]["base_path"] %> <%= node["git"]["server"]["base_path"] %>
Please sign in to comment.
Something went wrong with that request. Please try again.