This repository has been archived by the owner on Oct 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
default.rb
197 lines (159 loc) · 6.42 KB
/
default.rb
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# Setting Tomcat version
# Needs to be done before invoking "tomcat::_attributes"
# TODO: - try using node.default or node.set
node.override['tomcat']['base_version'] = 7
# Invoke attribute recipes; if defined as attributes/*.rb files,
# The derived values (ie node['artifacts']['share']['version'] = node['alfresco']['version'])
# would not take the right value, if a calling cookbook changes (ie default['alfresco']['version'])
#
include_recipe 'tomcat::_attributes'
include_recipe 'alfresco::_common-attributes'
include_recipe 'alfresco::_tomcat-attributes'
include_recipe 'alfresco::_activiti-attributes'
include_recipe 'alfresco::_alfrescoproperties-attributes'
include_recipe 'alfresco::_repo-attributes'
include_recipe 'alfresco::_share-attributes'
include_recipe 'alfresco::_solr-attributes'
include_recipe 'alfresco::_googledocs-attributes'
include_recipe 'alfresco::_aos-attributes'
include_recipe 'alfresco::_media-attributes'
include_recipe 'alfresco::_analytics-attributes'
# If there is no media nor analytics, don't install activemq
install_activemq = false
# Install/configure awscli, as it's used by haproxy ec2 discovery
include_recipe 'artifact-deployer::awscli'
# [old implementation]
# Change artifactIds for alfresco and share WARs, if
# we're using an Enterprise version (ends with a digit)
# enterprise = true if Float(node['alfresco']['version'].split('').last) or node['alfresco']['version'].end_with?("SNAPSHOT") rescue false
# [New implementation]
if node['alfresco']['edition'] == 'enterprise'
if alf_version_ge?('5.0')
node.default['artifacts']['share']['artifactId'] = 'share'
node.default['artifacts']['alfresco']['artifactId'] = if alf_version_ge?('5.1')
'alfresco-platform-enterprise'
else
'alfresco-enterprise'
end
else
node.default['artifacts']['share']['artifactId'] = 'share-enterprise'
end
end
# Chef::Log.warn("this is my condition2 #{node['alfresco']['enable.web.xml.nossl.patch'] or node['alfresco']['edition'] == 'enterprise'}")
unless node['alfresco']['enable.web.xml.nossl.patch'] || node['alfresco']['edition'] == 'enterprise'
node.default['artifacts']['alfresco']['classifier'] = 'nossl'
end
if alf_version_gt?('5.0') && node['alfresco']['components'].include?('repo')
node.default['artifacts']['share-services']['enabled'] = true
node.default['artifacts']['ROOT']['artifactId'] = 'alfresco-server-root'
end
include_recipe 'alfresco::package-repositories'
if node['alfresco']['components'].include? 'postgresql'
include_recipe 'alfresco::postgresql-local-server'
elsif node['alfresco']['components'].include? 'mysql'
include_recipe 'alfresco::mysql-local-server'
end
include_recipe 'java::default'
if node['alfresco']['components'].include?('yourkit')
include_recipe 'alfresco::yourkit'
end
if node['alfresco']['components'].include?('tomcat')
include_recipe 'alfresco::tomcat'
end
if node['alfresco']['components'].include?('nginx')
include_recipe 'alfresco-webserver::default'
end
if node['alfresco']['components'].include?('transform')
include_recipe 'alfresco::transformations'
end
include_recipe 'alfresco::aos' if node['alfresco']['components'].include?('aos')
if node['alfresco']['components'].include?('googledocs')
include_recipe 'alfresco::googledocs'
end
include_recipe 'alfresco::rm' if node['alfresco']['components'].include?('rm')
if node['media']['install.content.services']
include_recipe 'alfresco::media-content-services'
install_activemq = true
end
if node['alfresco']['components'].include? 'media'
include_recipe 'alfresco::media-alfresco'
end
if node['alfresco']['components'].include? 'repo'
node.set['alfresco']['apply_amps'] = true
include_recipe 'alfresco::repo'
end
if node['alfresco']['components'].include? 'share'
node.set['alfresco']['apply_amps'] = true
include_recipe 'alfresco::share'
end
if node['alfresco']['components'].include?('solr')
include_recipe 'alfresco::solr'
end
if node['alfresco']['components'].include?('solr6')
include_recipe 'alfresco::solr6'
end
if node['alfresco']['components'].include? 'haproxy'
include_recipe 'alfresco::haproxy'
end
if node['alfresco']['components'].include? 'tomcat'
include_recipe 'alfresco::tomcat-instance-config'
end
if node['alfresco']['components'].include? 'haproxy'
include_recipe 'openssl::default'
include_recipe 'alfresco::haproxy'
end
include_recipe 'artifact-deployer::default'
include_recipe 'alfresco::pdfium' if node['artifacts']['pdfium']['enabled']
if node['alfresco']['components'].include?('solr6')
include_recipe 'alfresco::solr6-config'
end
include_recipe 'alfresco::apply-amps' if node['alfresco']['apply_amps']
# This must go after Alfresco installation
if node['alfresco']['components'].include? 'analytics'
include_recipe 'alfresco::analytics'
install_activemq = true
end
include_recipe 'activemq::default' if install_activemq
if node['alfresco']['components'].include? 'rsyslog'
include_recipe 'rsyslog::default'
end
if node['alfresco']['components'].include? 'logstash-forwarder'
include_recipe 'alfresco::logstash-forwarder'
end
if node['alfresco']['components'].include? 'activiti'
include_recipe 'alfresco::activiti'
end
# TODO: - This should go... as soon as Alfresco Community NOSSL war is shipped
# Patching web.xml to configure Alf-Solr comms to none (instead of https)
#
if node['alfresco']['components'].include?('tomcat') && node['alfresco']['enable.web.xml.nossl.patch']
cookbook_file '/usr/local/bin/nossl-patch.sh' do
source 'nossl-patch.sh'
mode '0755'
end
execute 'run-nossl-patch.sh' do
command '/usr/local/bin/nossl-patch.sh'
user 'root'
end
end
# Restarting services, if enabled
alfresco_start = node['alfresco']['start_service']
restart_services = node['alfresco']['restart_services']
restart_action = node['alfresco']['restart_action']
if alfresco_start && node['alfresco']['components'].include?('tomcat')
restart_services.each do |service_name|
# => Fix file permissions
["/var/cache/#{service_name}", "/var/log/#{service_name}"].each do |service|
directory(service) do
owner 'tomcat'
group 'tomcat'
mode '0750'
recursive true
only_if { service_name.start_with?('tomcat-') }
end
end
service service_name do
action restart_action
end
end
end