default.rb
2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
if node['platform'] == 'centos'
cookbook_file '/etc/yum.repos.d/noosfero.repo' do
owner 'root'
mode 0644
end
end
package 'noosfero'
template '/etc/noosfero/database.yml' do
owner 'noosfero'
group 'noosfero'
mode '0600'
notifies :restart, 'service[noosfero]'
end
# create DB schema
execute 'noosfero:schema' do
command "RAILS_ENV=production bundle exec rake db:schema:load && RAILS_ENV=production NOOSFERO_DOMAIN=#{node['config']['external_hostname']} bundle exec rake db:data:minimal"
cwd '/usr/lib/noosfero'
user 'noosfero'
not_if "psql -h database -U noosfero --no-align --tuples-only -q -c 'select count(*) from profiles'", :user => 'noosfero'
notifies :restart, 'service[noosfero]'
end
package 'noosfero-spb'
plugins = [
'breadcrumbs',
'container_block',
'display_content',
'people_block',
'recent_content',
'remote_user',
'software_communities', # from noosfero-spb
'statistics',
'sub_organizations',
'video',
]
execute 'plugins:enable' do
command '/usr/lib/noosfero/script/noosfero-plugins enable ' + plugins.join(' ')
end
execute 'plugins:activate' do
plugins.each do |plugin|
plugin_name = plugin.split("_").collect(&:capitalize).join() + 'Plugin'
rails_command = "rails runner Environment.default.enable_plugin "
command "#{rails_command} #{plugin_name}"
end
end
execute 'theme:enable' do
command 'psql -h database -U noosfero --no-align --tuples-only -q -c "update environments set theme=\'noosfero-spb-theme\' where id=1;"'
end
template '/etc/noosfero/thin.yml' do
owner 'root'; group 'root'; mode 0644
notifies :restart, 'service[noosfero]'
end
cookbook_file '/etc/default/noosfero' do
owner 'root'; group 'root'; mode 0644
source 'noosfero-default'
notifies :restart, 'service[noosfero]'
end
service 'noosfero' do
action [:enable, :start]
end
template '/etc/nginx/conf.d/noosfero.conf' do
owner 'root'; group 'root'; mode 0644
source 'nginx.conf.erb'
notifies :restart, 'service[nginx]'
end
###############################################
# SELinux: permission to access static files noosfero
################################################
cookbook_file '/etc/selinux/local/noosfero.te' do
notifies :run, 'execute[selinux-noosfero]'
end
execute 'selinux-noosfero' do
command 'selinux-install-module /etc/selinux/local/noosfero.te'
action :nothing
end