Skip to content

Commit

Permalink
Use special run and log directories for radosgw
Browse files Browse the repository at this point in the history
(not needed to be owned by root)
Let radosgw restart on ceph.conf change.
  • Loading branch information
jsuchome committed Sep 24, 2014
1 parent ebbf464 commit 0845115
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
23 changes: 23 additions & 0 deletions recipes/radosgw.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,35 @@
include_recipe 'ceph::radosgw_install'
include_recipe 'ceph::conf'

directory '/var/log/radosgw' do
owner node['apache']['user']
group node['apache']['group']
mode '0755'
action :create
end

file '/var/log/radosgw/radosgw.log' do
owner node['apache']['user']
group node['apache']['group']
end

directory '/var/run/ceph-radosgw' do
owner node['apache']['user']
group node['apache']['group']
mode '0755'
action :create
end

if !::File.exist?("/var/lib/ceph/radosgw/ceph-radosgw.#{node['hostname']}/done")
if node['ceph']['radosgw']['webserver_companion']
include_recipe "ceph::radosgw_#{node['ceph']['radosgw']['webserver_companion']}"
end

ceph_client 'radosgw' do
caps('mon' => 'allow rw', 'osd' => 'allow rwx')
owner 'root'
group node['apache']['group']
mode 0640
end

directory "/var/lib/ceph/radosgw/ceph-radosgw.#{node['hostname']}" do
Expand All @@ -54,6 +76,7 @@
end
supports :restart => true
action [:enable, :start]
subscribes :restart, 'template[/etc/ceph/ceph.conf]'
end
else
Log.info('Rados Gateway already deployed')
Expand Down
6 changes: 4 additions & 2 deletions templates/default/ceph.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@
<% if (@is_rgw) -%>
[client.radosgw.<%= node['hostname'] %>]
host = <%= node['hostname'] %>
rgw socket path = /var/run/ceph/radosgw.<%= node['hostname'] %>
rgw socket path = /var/run/ceph-radosgw/radosgw.<%= node['hostname'] %>
admin socket = /var/run/ceph-radosgw/ceph-client.radosgw.<%= node['hostname'] %>.asok
pid file = /var/run/ceph-radosgw/$name.pid
keyring = /etc/ceph/ceph.client.radosgw.<%= node['hostname'] %>.keyring
log file = /var/log/ceph/radosgw.log
log file = /var/log/radosgw/radosgw.log
<% if (! node['ceph']['config']['rgw'].nil?) -%>
<% node['ceph']['config']['rgw'].sort.each do |k, v| %>
<%= k %> = <%= v %>
Expand Down
2 changes: 1 addition & 1 deletion templates/default/rgw.conf.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% if node['ceph']['radosgw']['rgw_port'] -%>
FastCgiExternalServer <%= node['ceph']['radosgw']['path'] %>/s3gw.fcgi -host 127.0.0.1:<%= node['ceph']['radosgw']['rgw_port'] %>
<% else -%>
FastCgiExternalServer <%= node['ceph']['radosgw']['path'] %>/s3gw.fcgi -socket /var/run/ceph/radosgw.<%= node['hostname'] %>
FastCgiExternalServer <%= node['ceph']['radosgw']['path'] %>/s3gw.fcgi -socket /var/run/ceph-radosgw/radosgw.<%= node['hostname'] %>
<% end -%>

LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\" \"%{Host}i\"" proxy_combined
Expand Down

0 comments on commit 0845115

Please sign in to comment.