ucb_deployer 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.svnignore +3 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +1 -2
- data/README.md +27 -27
- data/lib/ucb_deployer/deployer.rb +0 -1
- data/lib/ucb_deployer/jira_deployer.rb +63 -71
- data/lib/ucb_deployer/version.rb +1 -1
- metadata +11 -11
data/.svnignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -9,8 +9,11 @@ Overview
|
|
9
9
|
|
10
10
|
Deployments done with UCB Deployer will follow the following structure.
|
11
11
|
|
12
|
-
The user performing the deployment
|
13
|
-
|
12
|
+
The user performing the deployment should manually stop tomcat
|
13
|
+
|
14
|
+
sudo service tomcat6-jira stop
|
15
|
+
|
16
|
+
and then excecute the ucb_deploy command:
|
14
17
|
|
15
18
|
ucb_deploy APP=<jira|confluence> VERSION=<version>
|
16
19
|
|
@@ -22,11 +25,14 @@ The *ucb_deploy* command will then do the following:
|
|
22
25
|
4. Build the application which results in a war file.
|
23
26
|
5. Deploy the war file to tomcat.
|
24
27
|
|
25
|
-
The user doing the deployment will then have to manually start tomcat
|
26
|
-
|
27
|
-
|
28
|
+
The user doing the deployment will then have to manually start tomcat
|
29
|
+
|
30
|
+
sudo service tomcat6-jira start
|
28
31
|
|
29
|
-
|
32
|
+
and confirm tomcat started. Once they have confirmed things are ok,
|
33
|
+
they can then remove the maintenance file via the command:
|
34
|
+
|
35
|
+
ucb_deploy enable_web APP=<jira|confluence>
|
30
36
|
|
31
37
|
Woot!
|
32
38
|
|
@@ -69,23 +75,19 @@ General Configuration
|
|
69
75
|
The following directories and file need to be setup in the **app_relmgt** user's home
|
70
76
|
directory:
|
71
77
|
|
72
|
-
$HOME/config/
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
$HOME/build/
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|-- deploy.yml
|
86
|
-
|-- confluence/
|
87
|
-
+
|
88
|
-
|-- deploy.yml
|
78
|
+
$HOME/.ucb_deployer/config/
|
79
|
+
+
|
80
|
+
|-- jira/
|
81
|
+
+
|
82
|
+
|-- deploy.yml
|
83
|
+
|-- confluence/
|
84
|
+
+
|
85
|
+
|-- deploy.yml
|
86
|
+
|
87
|
+
$HOME/.ucb_deployer/build/
|
88
|
+
+
|
89
|
+
|-- jira/
|
90
|
+
|-- confluence/
|
89
91
|
|
90
92
|
|
91
93
|
#### Configuration Options ####
|
@@ -96,7 +98,6 @@ directory:
|
|
96
98
|
* **cas_server_url** : *url of CAS Server*
|
97
99
|
* **cas_service_url** : *url to redirect to after CAS auth succeeds*
|
98
100
|
* **data_dir** : *directory to be used by confluecne or jira for storing local data*
|
99
|
-
* **svn_username** : *username to be used to connect to svn*
|
100
101
|
* **svn_project_url** : *location of confluence/jira release in svn*
|
101
102
|
* **maintenance_file_dir** : *location where maintenance file should be written to*
|
102
103
|
|
@@ -105,14 +106,13 @@ directory:
|
|
105
106
|
Assuming we had the above directories setup in ($HOME=/home/app_relmgt), the
|
106
107
|
deploy.yml file for jira would look like so:
|
107
108
|
|
108
|
-
build_dir: /home/app_relmgt/build
|
109
|
+
build_dir: /home/app_relmgt/.ucb_deployer/build
|
109
110
|
deploy_dir: /home/app_jira/tomcat6/webapps
|
110
111
|
war_name: ROOT
|
111
112
|
cas_server_url: http://cas-server.berkeley.edu
|
112
113
|
cas_service_url: https://wikihub.berkeley.edu
|
113
114
|
data_dir: /home/app_jira/app_data
|
114
|
-
|
115
|
-
svn_project_url: svn.berkeley.edu/svn/ist-svn/berkeley/projects/ist/as/webapps/jira_archives/tags
|
115
|
+
svn_project_url: svn+ssh://svn@code.berkeley.edu/istas/jira_archives/tags
|
116
116
|
maintenance_file_dir: /var/www/html/jira/
|
117
117
|
|
118
118
|
|
@@ -2,66 +2,64 @@
|
|
2
2
|
module UcbDeployer
|
3
3
|
class JiraDeployer < Deployer
|
4
4
|
|
5
|
-
def initialize(config_file = "#{ENV['HOME']}/config/jira/deploy.yml")
|
6
|
-
debug("Using config file: #{config_file}")
|
7
|
-
|
8
|
-
load_config(config_file)
|
5
|
+
def initialize(config_file = "#{ENV['HOME']}/.ucb_deployer/config/jira/deploy.yml")
|
6
|
+
self.debug("Using config file: #{config_file}")
|
7
|
+
self.load_config(config_file)
|
9
8
|
end
|
10
9
|
|
11
10
|
def export()
|
12
|
-
info("Exporting from: #{svn_project_url}/jira-#{version}")
|
11
|
+
self.info("Exporting from: #{self.svn_project_url()}/jira-#{self.version()}")
|
13
12
|
|
14
|
-
Dir.chdir("#{build_dir}") do
|
15
|
-
FileUtils.rm_rf("#{build_dir}/src")
|
16
|
-
`svn export #{svn_project_url}/jira-#{version}`
|
17
|
-
FileUtils.mv("jira-#{version}", "src")
|
13
|
+
Dir.chdir("#{self.build_dir()}") do
|
14
|
+
FileUtils.rm_rf("#{self.build_dir()}/src")
|
15
|
+
`svn export #{self.svn_project_url()}/jira-#{self.version()}`
|
16
|
+
FileUtils.mv("jira-#{self.version()}", "src")
|
18
17
|
end
|
19
18
|
end
|
20
19
|
|
21
20
|
def configure()
|
22
|
-
info("Configuring application.")
|
23
|
-
config_web_xml()
|
24
|
-
config_seraph_config_xml()
|
25
|
-
config_entityengine_xml()
|
26
|
-
config_jira_application_properties()
|
27
|
-
config_ist_banner()
|
28
|
-
reshuffle_jars()
|
21
|
+
self.info("Configuring application.")
|
22
|
+
self.config_web_xml()
|
23
|
+
self.config_seraph_config_xml()
|
24
|
+
self.config_entityengine_xml()
|
25
|
+
self.config_jira_application_properties()
|
26
|
+
self.config_ist_banner()
|
27
|
+
self.reshuffle_jars()
|
29
28
|
end
|
30
29
|
|
31
30
|
def build()
|
32
|
-
info("Building application.")
|
33
|
-
|
34
|
-
Dir.chdir("#{build_dir}/src") do
|
35
|
-
`sh #{build_dir}/src/build.sh`
|
36
|
-
end
|
31
|
+
self.info("Building application.")
|
32
|
+
Dir.chdir("#{self.build_dir()}/src") { `sh #{self.build_dir()}/src/build.sh` }
|
37
33
|
end
|
38
34
|
|
39
35
|
def deploy()
|
40
|
-
info("Deploying application.")
|
36
|
+
self.info("Deploying application.")
|
41
37
|
|
42
|
-
if File.exists?("#{deploy_dir}/#{war_name}")
|
43
|
-
FileUtils.rm_rf(Dir["#{deploy_dir}/#{war_name}"])
|
38
|
+
if File.exists?("#{self.deploy_dir()}/#{self.war_name()}")
|
39
|
+
FileUtils.rm_rf(Dir["#{self.deploy_dir()}/#{self.war_name()}"])
|
44
40
|
end
|
45
41
|
|
46
|
-
FileUtils.mkdir("#{deploy_dir}/#{war_name}")
|
47
|
-
`mv #{build_dir}/src/dist-tomcat/atlassian-jira-*.war #{deploy_dir}/#{war_name}/#{war_name}.war`
|
48
|
-
`cd #{deploy_dir}/#{war_name}/ && jar -xvf #{war_name}.war`
|
49
|
-
`rm #{deploy_dir}/#{war_name}/#{war_name}.war`
|
42
|
+
FileUtils.mkdir("#{self.deploy_dir()}/#{self.war_name()}")
|
43
|
+
`mv #{self.build_dir()}/src/dist-tomcat/atlassian-jira-*.war #{self.deploy_dir()}/#{self.war_name()}/#{self.war_name()}.war`
|
44
|
+
`cd #{self.deploy_dir()}/#{self.war_name()}/ && jar -xvf #{self.war_name()}.war`
|
45
|
+
`rm #{self.deploy_dir()}/#{self.war_name()}/#{self.war_name()}.war`
|
50
46
|
end
|
51
47
|
|
52
48
|
def rollback()
|
53
49
|
end
|
54
50
|
|
51
|
+
|
52
|
+
protected
|
53
|
+
|
55
54
|
def cas_logout_url()
|
56
55
|
"/casLogout.action"
|
57
56
|
end
|
58
|
-
|
59
|
-
|
57
|
+
|
60
58
|
##
|
61
59
|
# Shortcut to jira web.xml file
|
62
60
|
#
|
63
61
|
def web_xml()
|
64
|
-
"#{build_dir}/src/webapp/WEB-INF/web.xml"
|
62
|
+
"#{self.build_dir()}/src/webapp/WEB-INF/web.xml"
|
65
63
|
end
|
66
64
|
|
67
65
|
def web_xml_token()
|
@@ -73,18 +71,16 @@ module UcbDeployer
|
|
73
71
|
# authentication configuration
|
74
72
|
#
|
75
73
|
def config_web_xml()
|
76
|
-
web_xml = File.readlines(self.web_xml)
|
77
|
-
|
78
|
-
web_xml = web_xml.map do |line|
|
74
|
+
web_xml = File.readlines(self.web_xml()).map do |line|
|
79
75
|
if line =~ /#{web_xml_token}/
|
80
|
-
template = File.open("#{DEPLOYER_HOME}/resources/jira_cas_web.xml") { |f| f.read }
|
76
|
+
template = File.open("#{DEPLOYER_HOME}/resources/jira_cas_web.xml") { |f| f.read() }
|
81
77
|
line + ERB.new(template).result(self.send(:binding))
|
82
78
|
else
|
83
79
|
line
|
84
80
|
end
|
85
81
|
end
|
86
82
|
|
87
|
-
File.open(self.web_xml, "w") do |io|
|
83
|
+
File.open(self.web_xml(), "w") do |io|
|
88
84
|
web_xml.each { |line| io.puts(line) }
|
89
85
|
end
|
90
86
|
end
|
@@ -93,7 +89,7 @@ module UcbDeployer
|
|
93
89
|
# Shortcut to jira entityengine.xml file
|
94
90
|
#
|
95
91
|
def entityengine_xml()
|
96
|
-
"#{build_dir}/src/edit-webapp/WEB-INF/classes/entityengine.xml"
|
92
|
+
"#{self.build_dir()}/src/edit-webapp/WEB-INF/classes/entityengine.xml"
|
97
93
|
end
|
98
94
|
|
99
95
|
def entityengine_xml_db_token()
|
@@ -116,25 +112,23 @@ module UcbDeployer
|
|
116
112
|
# Updates the jira entityengine.xml file with the correct database configs
|
117
113
|
#
|
118
114
|
def config_entityengine_xml()
|
119
|
-
ee_xml = File.readlines(self.entityengine_xml)
|
120
|
-
|
121
|
-
|
122
|
-
if m = /(#{Regexp.quote(entityengine_xml_db_token)})/.match(line)
|
123
|
-
debug(m[0])
|
115
|
+
ee_xml = File.readlines(self.entityengine_xml()).map do |line|
|
116
|
+
if m = /(#{Regexp.quote(self.entityengine_xml_db_token())})/.match(line)
|
117
|
+
self.debug(m[0])
|
124
118
|
new_str = "#{m.pre_match}#{entityengine_db}#{m.post_match}"
|
125
|
-
debug(new_str)
|
119
|
+
self.debug(new_str)
|
126
120
|
new_str
|
127
|
-
elsif m = /(#{Regexp.quote(entityengine_xml_schema_token)})/.match(line)
|
128
|
-
debug(m[0])
|
129
|
-
new_str = "#{m.pre_match}#{entityengine_schema}#{m.post_match}"
|
130
|
-
debug(new_str)
|
121
|
+
elsif m = /(#{Regexp.quote(self.entityengine_xml_schema_token())})/.match(line)
|
122
|
+
self.debug(m[0])
|
123
|
+
new_str = "#{m.pre_match}#{self.entityengine_schema()}#{m.post_match}"
|
124
|
+
self.debug(new_str)
|
131
125
|
new_str
|
132
126
|
else
|
133
127
|
line
|
134
128
|
end
|
135
129
|
end
|
136
130
|
|
137
|
-
File.open(self.entityengine_xml, "w") do |io|
|
131
|
+
File.open(self.entityengine_xml(), "w") do |io|
|
138
132
|
ee_xml.each { |line| io.puts(line) }
|
139
133
|
end
|
140
134
|
end
|
@@ -143,7 +137,7 @@ module UcbDeployer
|
|
143
137
|
# Shortcut to jira seraph-config.xml file
|
144
138
|
#
|
145
139
|
def seraph_config_xml()
|
146
|
-
"#{build_dir}/src/webapp/WEB-INF/classes/seraph-config.xml"
|
140
|
+
"#{self.build_dir()}/src/webapp/WEB-INF/classes/seraph-config.xml"
|
147
141
|
end
|
148
142
|
|
149
143
|
def seraph_config_xml_auth_class_token()
|
@@ -163,25 +157,23 @@ module UcbDeployer
|
|
163
157
|
# authenticator.
|
164
158
|
#
|
165
159
|
def config_seraph_config_xml()
|
166
|
-
seraph_xml = File.readlines(self.seraph_config_xml)
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
debug(
|
171
|
-
new_str = "#{m.pre_match}#{cas_authenticator_class}#{m.post_match}"
|
172
|
-
debug(new_str)
|
160
|
+
seraph_xml = File.readlines(self.seraph_config_xml()).map do |line|
|
161
|
+
if m = /(#{Regexp.quote(self.seraph_config_xml_auth_class_token())})/.match(line)
|
162
|
+
self.debug(m[0])
|
163
|
+
new_str = "#{m.pre_match}#{self.cas_authenticator_class()}#{m.post_match}"
|
164
|
+
self.debug(new_str)
|
173
165
|
new_str
|
174
|
-
elsif m = /(#{Regexp.quote(seraph_config_xml_logout_url_token)})/.match(line)
|
175
|
-
debug(m[0])
|
176
|
-
new_str = "#{m.pre_match}#{cas_server_url}/logout#{m.post_match}"
|
177
|
-
debug(new_str)
|
166
|
+
elsif m = /(#{Regexp.quote(self.seraph_config_xml_logout_url_token())})/.match(line)
|
167
|
+
self.debug(m[0])
|
168
|
+
new_str = "#{m.pre_match}#{self.cas_server_url()}/logout#{m.post_match}"
|
169
|
+
self.debug(new_str)
|
178
170
|
new_str
|
179
171
|
else
|
180
172
|
line
|
181
173
|
end
|
182
174
|
end
|
183
175
|
|
184
|
-
File.open(self.seraph_config_xml, "w") do |io|
|
176
|
+
File.open(self.seraph_config_xml(), "w") do |io|
|
185
177
|
seraph_xml.each { |line| io.puts(line) }
|
186
178
|
end
|
187
179
|
end
|
@@ -190,7 +182,7 @@ module UcbDeployer
|
|
190
182
|
# Shortcut to jira-application.properties file
|
191
183
|
#
|
192
184
|
def jira_application_properties()
|
193
|
-
"#{build_dir}/src/edit-webapp/WEB-INF/classes/jira-application.properties"
|
185
|
+
"#{self.build_dir()}/src/edit-webapp/WEB-INF/classes/jira-application.properties"
|
194
186
|
end
|
195
187
|
|
196
188
|
def jira_home_token()
|
@@ -201,18 +193,18 @@ module UcbDeployer
|
|
201
193
|
# Sets the jira.home property in the file: jira-application.properties.
|
202
194
|
#
|
203
195
|
def config_jira_application_properties()
|
204
|
-
jira_props = File.readlines(self.jira_application_properties).map do |line|
|
196
|
+
jira_props = File.readlines(self.jira_application_properties()).map do |line|
|
205
197
|
if m = /(#{Regexp.quote(jira_home_token)})/.match(line)
|
206
|
-
debug(m[0])
|
207
|
-
new_str = "#{jira_home_token} #{data_dir}"
|
208
|
-
debug(new_str)
|
198
|
+
self.debug(m[0])
|
199
|
+
new_str = "#{self.jira_home_token()} #{self.data_dir()}"
|
200
|
+
self.debug(new_str)
|
209
201
|
new_str
|
210
202
|
else
|
211
203
|
line
|
212
204
|
end
|
213
205
|
end
|
214
206
|
|
215
|
-
File.open(self.jira_application_properties, "w") do |io|
|
207
|
+
File.open(self.jira_application_properties(), "w") do |io|
|
216
208
|
jira_props.each { |line| io.puts(line) }
|
217
209
|
end
|
218
210
|
end
|
@@ -222,7 +214,7 @@ module UcbDeployer
|
|
222
214
|
#
|
223
215
|
def config_ist_banner()
|
224
216
|
FileUtils.cp("#{UcbDeployer::RESOURCES_DIR}/ist_banner.jpg",
|
225
|
-
"#{build_dir}/src/webapp/images/")
|
217
|
+
"#{self.build_dir()}/src/webapp/images/")
|
226
218
|
end
|
227
219
|
|
228
220
|
##
|
@@ -230,12 +222,12 @@ module UcbDeployer
|
|
230
222
|
# level to avoid conflicts.
|
231
223
|
#
|
232
224
|
def reshuffle_jars()
|
233
|
-
FileUtils.mkdir_p("#{build_dir}/src/edit-webapp/WEB-INF/lib/")
|
225
|
+
FileUtils.mkdir_p("#{self.build_dir()}/src/edit-webapp/WEB-INF/lib/")
|
234
226
|
FileUtils.cp(Dir["#{UcbDeployer::RESOURCES_DIR}/soulwing-casclient-*"],
|
235
|
-
"#{build_dir}/src/edit-webapp/WEB-INF/lib/")
|
227
|
+
"#{self.build_dir()}/src/edit-webapp/WEB-INF/lib/")
|
236
228
|
# These have been placed in $CATALINA_HOME/lib
|
237
229
|
["mail", "activation", "javamail", "commons-logging", "log4j"].each do |jar|
|
238
|
-
FileUtils.rm_rf(Dir["#{build_dir}/src/webapp/WEB-INF/lib/#{jar}-*"])
|
230
|
+
FileUtils.rm_rf(Dir["#{self.build_dir()}/src/webapp/WEB-INF/lib/#{jar}-*"])
|
239
231
|
end
|
240
232
|
end
|
241
233
|
|
data/lib/ucb_deployer/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ucb_deployer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 5
|
10
|
+
version: 0.4.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Steven Hansen
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-11-30 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rake
|
@@ -175,18 +175,18 @@ signing_key:
|
|
175
175
|
specification_version: 3
|
176
176
|
summary: Tool for deploying Confluence and JIRA war files to tomcat
|
177
177
|
test_files:
|
178
|
+
- spec/fixtures/confluence/web.xml
|
178
179
|
- spec/fixtures/confluence/bad_deploy.yml
|
179
|
-
- spec/fixtures/confluence/confluence-init.properties
|
180
180
|
- spec/fixtures/confluence/deploy.yml
|
181
181
|
- spec/fixtures/confluence/seraph-config.xml
|
182
|
-
- spec/fixtures/confluence/
|
182
|
+
- spec/fixtures/confluence/confluence-init.properties
|
183
|
+
- spec/fixtures/jira/web.xml
|
183
184
|
- spec/fixtures/jira/bad_deploy.yml
|
184
185
|
- spec/fixtures/jira/deploy.yml
|
185
|
-
- spec/fixtures/jira/entityengine.xml
|
186
186
|
- spec/fixtures/jira/jira-application.properties
|
187
187
|
- spec/fixtures/jira/seraph-config.xml
|
188
|
-
- spec/fixtures/jira/
|
189
|
-
- spec/spec_helper.rb
|
190
|
-
- spec/ucb_deployer/confluence_deployer_spec.rb
|
191
|
-
- spec/ucb_deployer/jira_deployer_spec.rb
|
188
|
+
- spec/fixtures/jira/entityengine.xml
|
192
189
|
- spec/ucb_deployer/ucb_deployer_spec.rb
|
190
|
+
- spec/ucb_deployer/jira_deployer_spec.rb
|
191
|
+
- spec/ucb_deployer/confluence_deployer_spec.rb
|
192
|
+
- spec/spec_helper.rb
|