Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Commit ef00f32

Browse files
committed
Merge pull request #37 from linc01n/stash_version/3.3.0
Upgrade to Stash 3.3.0
2 parents 05d3ce3 + ce6a4ed commit ef00f32

File tree

5 files changed

+240
-6
lines changed

5 files changed

+240
-6
lines changed

attributes/default.rb

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
default['stash']['service_type'] = 'init'
77
default['stash']['url_base'] = 'http://www.atlassian.com/software/stash/downloads/binary/atlassian-stash'
88
default['stash']['user'] = 'stash'
9-
default['stash']['version'] = '3.1.1'
9+
default['stash']['version'] = '3.3.0'
1010

1111
default['stash']['url'] = "#{node['stash']['url_base']}-#{node['stash']['version']}.tar.gz"
1212
default['stash']['checksum'] =
@@ -70,8 +70,14 @@
7070
when '3.0.1' then '53312a7d26e68b50eb778b8847e04162074b645c2d4014bc404eba59ff90f624'
7171
when '3.0.4' then '2dc4db2a0fd306bad39d46b9e6a58d7c9d82c73711e002a93103f19e8133aa6a'
7272
when '3.0.5' then 'f06b4d545d0e7acae6255f3f4d8c9a02bbdfebf16da793eaef8e1b8eef9303b2'
73+
when '3.0.6' then '2b5cc70cba6e63aecd7591f02a1ed290825bf3916ffd867cc78b0fabb5badb48'
7374
when '3.1.0' then '9eb7ba9eec7b67cf14a3ae450c8ec3d8e9289a120672825ec8ba6a290b48c6a6'
7475
when '3.1.1' then '14710e220ca4258cd81c0bd205e5df668abd7b0ed56be9fd6e74e82a394f53b9'
76+
when '3.1.3' then 'b203d8d58bf95414077cac948066f5c84d600db258bb6168cc482b948f63529e'
77+
when '3.2.0' then '4e8c38b9450e718020d6f74df891987abe491529c66b3df19eff9a325856417e'
78+
when '3.2.2' then 'a4e4b299c08432d4852872d6f8b754636ae640d434e5d1544637a54e5f1a3d39'
79+
when '3.2.4' then 'd52b1b8ca50351bf9056d11bf584d6ca1e3ca70eddd936cb799543b487a6ba01'
80+
when '3.3.0' then '4cb441824c08f28550d5ee2f883016461a356f626e5f38c0a29d345f174d34fd'
7581
end
7682

7783
default['stash']['apache2']['access_log'] = ''
@@ -98,11 +104,24 @@
98104
default['stash']['backup_client']['baseurl'] = "https://#{node['fqdn']}/"
99105
default['stash']['backup_client']['install_path'] = node['stash']['install_path']
100106
default['stash']['backup_client']['password'] = 'changeit'
101-
default['stash']['backup_client']['url_base'] = 'http://downloads.atlassian.com/software/stash/downloads/stash-backup-client'
102107
default['stash']['backup_client']['user'] = 'admin'
103-
default['stash']['backup_client']['version'] = '1.2.1'
108+
default['stash']['backup_client']['version'] = '1.4.0'
109+
stash_backup_client_version = Chef::Version.new(node['stash']['backup_client']['version'])
110+
111+
default['stash']['backup_client']['url_base'] =
112+
if stash_backup_client_version <= Chef::Version.new('1.2.1')
113+
'http://downloads.atlassian.com/software/stash/downloads/stash-backup-client'
114+
else
115+
'https://maven.atlassian.com/public/com/atlassian/stash/backup/stash-backup-distribution/'
116+
end
117+
118+
default['stash']['backup_client']['url'] =
119+
if stash_backup_client_version <= Chef::Version.new('1.2.1')
120+
"#{node['stash']['backup_client']['url_base']}-#{node['stash']['backup_client']['version']}.zip"
121+
else
122+
"#{node['stash']['backup_client']['url_base']}/#{node['stash']['backup_client']['version']}/stash-backup-distribution-#{node['stash']['backup_client']['version']}.zip"
123+
end
104124

105-
default['stash']['backup_client']['url'] = "#{node['stash']['backup_client']['url_base']}-#{node['stash']['backup_client']['version']}.zip"
106125
default['stash']['backup_client']['checksum'] =
107126
case node['stash']['backup_client']['version']
108127
when '1.0.0-beta-11' then 'b1ec42ef96db0cbb3f5678c75da119019d8894c3b09ee886ced075c694bbafb2'
@@ -111,6 +130,9 @@
111130
when '1.1.0' then 'd2276df535e0f8e909cd0c1c9700ca275be378145451f9d62a5980b62fdfab74'
112131
when '1.2.0' then '5dee33dfdf78605caa0bee33caf5cff633613604ec3a30e93dead81c4401f9b9'
113132
when '1.2.1' then 'eb680d58838b6218cbcb32f4bbf8e9be46adf1df43801e5e83e420ae58bc0d07'
133+
when '1.3.0' then 'b9674f3235d4937d39186417594efdb3213b564d783aa09618a8086cc57f5170'
134+
when '1.3.1' then '625af0a8402e85d62768f99a409ce4e140ef3afc961514b549fb9f98877c39db'
135+
when '1.4.0' then 'c57a5fafb8aaaccea0bd57aae0bce24472ee6d172c0a558c11759b26b6c0196c'
114136
end
115137

116138
default['stash']['backup_client']['cron']['day'] = '*'

recipes/configuration.rb

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
settings = Stash.settings(node)
2+
stash_version = Chef::Version.new(node['stash']['version'])
23

3-
template "#{node['stash']['home_path']}/stash-config.properties" do
4+
# Config path changed to shared/ from 3.2.0
5+
# https://confluence.atlassian.com/display/STASHKB/Upgrading+your+Stash+home+directory+for+Stash+3.2+manually
6+
if stash_version >= Chef::Version.new('3.2.0')
7+
config_path = 'shared/'
8+
directory("#{node['stash']['home_path']}/#{config_path}") do
9+
owner node['stash']['user']
10+
group node['stash']['user']
11+
mode '0755'
12+
action :create
13+
recursive true
14+
end
15+
else
16+
config_path = '/'
17+
end
18+
19+
template "#{node['stash']['home_path']}/#{config_path}stash-config.properties" do
420
source 'stash-config.properties.erb'
521
owner node['stash']['user']
622
mode '0644'

recipes/tomcat_configuration.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
template "#{node['stash']['install_path']}/stash/conf/server.xml" do
1212
if stash_version.major == 1
1313
source 'server.xml.erb'
14+
elsif stash_version >= Chef::Version.new('3.3.0')
15+
source 'server-tomcat8.xml.erb'
1416
else
1517
source 'server-tomcat7.xml.erb'
1618
end
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<!--
3+
Dynamically generated by Chef on <%= node["fqdn"] %>
4+
Local modifications will be overwritten by Chef.
5+
-->
6+
<!--
7+
Licensed to the Apache Software Foundation (ASF) under one or more
8+
contributor license agreements. See the NOTICE file distributed with
9+
this work for additional information regarding copyright ownership.
10+
The ASF licenses this file to You under the Apache License, Version 2.0
11+
(the "License"); you may not use this file except in compliance with
12+
the License. You may obtain a copy of the License at
13+
14+
http://www.apache.org/licenses/LICENSE-2.0
15+
16+
Unless required by applicable law or agreed to in writing, software
17+
distributed under the License is distributed on an "AS IS" BASIS,
18+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19+
See the License for the specific language governing permissions and
20+
limitations under the License.
21+
-->
22+
<!-- Note: A "Server" is not itself a "Container", so you may not
23+
define subcomponents such as "Valves" at this level.
24+
Documentation at /docs/config/server.html
25+
-->
26+
<Server port="8006" shutdown="SHUTDOWN">
27+
<!-- Security listener. Documentation at /docs/config/listeners.html
28+
<Listener className="org.apache.catalina.security.SecurityListener" />
29+
-->
30+
<!--APR library loader. Documentation at /docs/apr.html -->
31+
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
32+
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
33+
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
34+
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
35+
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
36+
37+
<!-- Global JNDI resources
38+
Documentation at /docs/jndi-resources-howto.html
39+
-->
40+
<GlobalNamingResources>
41+
<!-- Editable user database that can also be used by
42+
UserDatabaseRealm to authenticate users
43+
-->
44+
<Resource name="UserDatabase" auth="Container"
45+
type="org.apache.catalina.UserDatabase"
46+
description="User database that can be updated and saved"
47+
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
48+
pathname="conf/tomcat-users.xml" />
49+
</GlobalNamingResources>
50+
51+
<!-- A "Service" is a collection of one or more "Connectors" that share
52+
a single "Container" Note: A "Service" is not itself a "Container",
53+
so you may not define subcomponents such as "Valves" at this level.
54+
Documentation at /docs/config/service.html
55+
-->
56+
<Service name="Catalina">
57+
58+
<!--The connectors can use a shared executor, you can define one or more named thread pools-->
59+
<!--
60+
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
61+
maxThreads="150" minSpareThreads="4"/>
62+
-->
63+
64+
65+
<!-- A "Connector" represents an endpoint by which requests are received
66+
and responses are returned. Documentation at :
67+
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
68+
Java AJP Connector: /docs/config/ajp.html
69+
APR (HTTP/AJP) Connector: /docs/apr.html
70+
Define a non-SSL HTTP/1.1 Connector on port 7990
71+
72+
If you change this port, you have to update scripts.cfg as well
73+
to have the same port configuration.
74+
-->
75+
<Connector port="<%= node['stash']['tomcat']['port'] %>" protocol="HTTP/1.1"
76+
connectionTimeout="20000"
77+
useBodyEncodingForURI="true"
78+
compression="on"
79+
compressableMimeType="text/html,text/xml,text/plain,text/css,application/json,application/javascript,application/x-javascript"
80+
<% if node['stash']['apache2'] -%>
81+
redirectPort="<%= node['stash']['apache2']['ssl']['port'] %>"
82+
secure="true"
83+
scheme="https"
84+
proxyName="<%= node['stash']['apache2']['virtual_host_alias'] %>"
85+
proxyPort="<%= node['stash']['apache2']['ssl']['port'] %>"
86+
<% else -%>
87+
redirectPort="<%= node['stash']['tomcat']['ssl_port'] %>"
88+
<% end -%>
89+
/>
90+
91+
<!-- A "Connector" using the shared thread pool-->
92+
<!--
93+
<Connector executor="tomcatThreadPool"
94+
port="7990" protocol="HTTP/1.1"
95+
connectionTimeout="20000"
96+
redirectPort="8443" />
97+
-->
98+
<!-- Define a SSL HTTP/1.1 Connector on port 8443
99+
This connector uses the JSSE configuration, when using APR, the
100+
connector should be using the OpenSSL style configuration
101+
described in the APR documentation -->
102+
<Connector port="<%= node['stash']['tomcat']['ssl_port'] %>"
103+
maxHttpHeaderSize="8192"
104+
SSLEnabled="true"
105+
maxThreads="150"
106+
minSpareThreads="25"
107+
maxSpareThreads="75"
108+
enableLookups="false"
109+
disableUploadTimeout="true"
110+
useBodyEncodingForURI="true"
111+
acceptCount="100"
112+
scheme="https"
113+
secure="true"
114+
clientAuth="false"
115+
sslProtocol="TLS"
116+
<%- if @tomcat %>
117+
<%= "keyAlias=\"#{@tomcat['keyAlias']}\"" if @tomcat['keyAlias'] %>
118+
<%= "keystoreFile=\"#{@tomcat['keystoreFile']}\"" if @tomcat['keystoreFile'] %>
119+
<%= "keystorePass=\"#{@tomcat['keystorePass']}\"" if @tomcat['keystorePass'] %>
120+
<%- end %>
121+
/>
122+
<!--
123+
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
124+
maxThreads="150" scheme="https" secure="true"
125+
clientAuth="false" sslProtocol="TLS" />
126+
-->
127+
128+
129+
<!-- An Engine represents the entry point (within Catalina) that processes
130+
every request. The Engine implementation for Tomcat stand alone
131+
analyzes the HTTP headers included with the request, and passes them
132+
on to the appropriate Host (virtual host).
133+
Documentation at /docs/config/engine.html -->
134+
135+
<!-- You should set jvmRoute to support load-balancing via AJP ie :
136+
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
137+
-->
138+
<Engine name="Catalina" defaultHost="localhost">
139+
140+
<!-- For clustering, please take a look at documentation at:
141+
/docs/cluster-howto.html (simple how to)
142+
/docs/config/cluster.html (reference documentation) -->
143+
<!--
144+
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
145+
-->
146+
147+
<!-- Use the LockOutRealm to prevent attempts to guess user passwords
148+
via a brute-force attack -->
149+
<Realm className="org.apache.catalina.realm.LockOutRealm">
150+
<!-- This Realm uses the UserDatabase configured in the global JNDI
151+
resources under the key "UserDatabase". Any edits
152+
that are performed against this UserDatabase are immediately
153+
available for use by the Realm. -->
154+
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
155+
resourceName="UserDatabase"/>
156+
</Realm>
157+
158+
159+
<Host name="localhost" appBase="webapps"
160+
unpackWARs="true" autoDeploy="true"
161+
xmlValidation="false" xmlNamespaceAware="false">
162+
163+
164+
<!-- Before changing the context path for Stash, please read our documentation:
165+
https://confluence.atlassian.com/x/5oCNEQ
166+
167+
You will have to update scripts.cfg AND
168+
rename webapps/ROOT directory.
169+
170+
-->
171+
172+
<Context docBase="${catalina.home}/atlassian-stash"
173+
path=""
174+
reloadable="false"
175+
useHttpOnly="true"/>
176+
177+
<!-- SingleSignOn valve, share authentication between web applications
178+
Documentation at: /docs/config/valve.html -->
179+
<!--
180+
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
181+
-->
182+
183+
<!-- Access log processes all example.
184+
Documentation at: /docs/config/valve.html
185+
Note: The pattern used is equivalent to using pattern="common" -->
186+
<!--
187+
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
188+
prefix="localhost_access_log." suffix=".txt"
189+
pattern="%h %l %u %t &quot;%r&quot; %s %b" />
190+
-->
191+
</Host>
192+
</Engine>
193+
</Service>
194+
</Server>

templates/default/server.xml.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
This connector uses the JSSE configuration, when using APR, the
9696
connector should be using the OpenSSL style configuration
9797
described in the APR documentation -->
98-
98+
9999
<Connector port="<%= node['stash']['tomcat']['ssl_port'] %>"
100100
maxHttpHeaderSize="8192"
101101
SSLEnabled="true"

0 commit comments

Comments
 (0)