Permalink
Browse files

Merge pull request #14 from rgeyer-rs-cookbooks/server_enhancements

[COOK-2303] Added RHEL platform_family support to git::server
  • Loading branch information...
2 parents 56f905c + 96723c1 commit 9a096fd20397426fd1df933683a3b58a56c2b9ea @jtimberman jtimberman committed Feb 2, 2013
Showing with 49 additions and 6 deletions.
  1. +3 −3 README.md
  2. +3 −0 attributes/default.rb
  3. +13 −0 metadata.rb
  4. +19 −2 recipes/server.rb
  5. +10 −0 templates/default/git-xinetd.d.erb
  6. +1 −1 templates/default/sv-git-daemon-run.erb
View
@@ -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
@@ -35,3 +35,6 @@
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"
+default['git']['server']['export_all'] = "true"
View
@@ -20,3 +20,16 @@
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"]
+
+attribute "git/server/export_all",
+ :display_name => "Git Daemon Export All",
+ :description => "Adds the --export-all option to the git-daemon parameters, making all repositories publicly readable even if they lack the \"git-daemon-export-ok\" file",
+ :choice => ["true", "false"],
+ :default => "true",
+ :recipes => ["git::server"]
View
@@ -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
@@ -0,0 +1,10 @@
+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"] %> <% if node["git"]["server"]["export_all"] == "true" %>--export-all <% end %>--syslog --inetd --verbose
+ log_on_failure += USERID
+}
@@ -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 <% if node["git"]["server"]["export_all"] == "true" %>--export-all <% end %>--user=nobody --group=daemon --syslog --base-path=<%= node["git"]["server"]["base_path"] %> <%= node["git"]["server"]["base_path"] %>

0 comments on commit 9a096fd

Please sign in to comment.