capistrano-psw 1.0.0.pre31 → 1.0.0.pre32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -0
- data/lib/capistrano/psw/peppr_app_deploy_file_utils.rb +24 -4
- data/lib/capistrano/psw/version.rb +1 -1
- data/resources/lib/capistrano/tasks/psw-javaee.cap +33 -0
- data/resources/lib/capistrano/tasks/psw-peppr-app-deploy.cap +41 -4
- data/spec/psw-javaee_spec.rb +20 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d01081943f864d84807135605d48b146cd5c2b45
|
4
|
+
data.tar.gz: ea7389d436a56f1303dc9ac45d1b109365296adc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fd791a3ddfd38e29adcf83ee113baf39a8cd79f5f1ab949e2f59eadb9738cecc628d14d3e6820a140d6649bcd603de5673c4a0c6bd85e5593dd27d9f7711b94
|
7
|
+
data.tar.gz: 6e45dd4eea06315d013629b44e7b99d32700b4dd042cadd05f9ea4d35462b8aad690264a309ef0892b0995319acfb9ae7f36d3b812401b51217afc04ee27f53f
|
data/README.md
CHANGED
@@ -232,6 +232,20 @@ by peppr. Note: This should only be used if peppr is deploying the
|
|
232
232
|
application. However, if the environment files do not exist, they
|
233
233
|
will not be uploaded.
|
234
234
|
|
235
|
+
### psw_peppr_app_deploy:upload_artifacts
|
236
|
+
This task will upload your application's associated artifacts to the correct folder
|
237
|
+
on the remote machine.
|
238
|
+
|
239
|
+
### psw_peppr_app_deploy:remove_existing_source_repo
|
240
|
+
This task will remove existing Capistrano source repo on the remote machine.
|
241
|
+
|
242
|
+
### psw_peppr_app_deploy:set_deploy_revision
|
243
|
+
This task will update Capistrano branch environment to point to the Peppr branch.
|
244
|
+
|
245
|
+
### psw_peppr_app_deploy:link_artifacts
|
246
|
+
This task will create a symbolic link from the remote artifacts directory to the current
|
247
|
+
release directory as "/artifacts"
|
248
|
+
|
235
249
|
```ruby
|
236
250
|
#set psw app deploy prefs
|
237
251
|
before 'psw_peppr_app_deploy:default', :set_app_deploy_options do
|
@@ -282,6 +296,15 @@ before :'psw_apache2:deploy_ssl_certs', :set_apache2_options do
|
|
282
296
|
set :psw_apache2_shared_cert_dir, ""
|
283
297
|
end
|
284
298
|
```
|
299
|
+
## Java EE-related Tasks
|
300
|
+
These tasks are needed to facilitate Java EE deployments.
|
301
|
+
|
302
|
+
|
303
|
+
### psw_javaee:explode_war_file
|
304
|
+
This task will explode a WAR file into a specified directory.
|
305
|
+
Parameters:
|
306
|
+
*explode_directory [String] - The directory to which the exploded contents will be written
|
307
|
+
*war_file_location [String] - The absolute path of the WAR file.
|
285
308
|
|
286
309
|
## License
|
287
310
|
|
@@ -16,6 +16,7 @@ module PepprAppDeployFileUtils
|
|
16
16
|
PEPPR_RELATIVE_TMP_DIR = "/tmp"
|
17
17
|
PEPPR_RELATIVE_ENVIRONMENTS_DIR = "/environments"
|
18
18
|
PEPPR_RELATIVE_SHARED_FILE_DIR = "/shared_files"
|
19
|
+
PEPPR_RELATIVE_ARTIFACTS_DIR = "/artifacts"
|
19
20
|
|
20
21
|
module Local
|
21
22
|
# Method for verifying that Peppr's application deployment file structure exists on the
|
@@ -32,6 +33,7 @@ module PepprAppDeployFileUtils
|
|
32
33
|
execute :mkdir, '-p', PepprAppDeployFileUtils::Local::get_deployment_tmp_dir
|
33
34
|
execute :mkdir, '-p', PepprAppDeployFileUtils::Local::get_deployment_environments_dir
|
34
35
|
execute :mkdir, '-p', PepprAppDeployFileUtils::Local::get_deployment_shared_files_dir
|
36
|
+
execute :mkdir, '-p', PepprAppDeployFileUtils::Local::get_deployment_artifacts_dir
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
@@ -89,9 +91,19 @@ module PepprAppDeployFileUtils
|
|
89
91
|
PepprAppDeployFileUtils::Local::get_deployment_dir(PEPPR_RELATIVE_ENVIRONMENTS_DIR)
|
90
92
|
end
|
91
93
|
|
94
|
+
# Method for retrieving the Peppr application deployment shared files directory
|
95
|
+
#
|
96
|
+
# @return [String] the fully-qualified local shared files directory
|
92
97
|
def self.get_deployment_shared_files_dir
|
93
98
|
"#{PepprAppDeployFileUtils::Local::get_deployment_environments_dir()}/#{fetch(:stage)}#{PEPPR_RELATIVE_SHARED_FILE_DIR}"
|
94
|
-
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# Method for retrieving the Peppr application deployment artifacts directory
|
102
|
+
#
|
103
|
+
# @return [String] the fully-qualified local artifacts directory
|
104
|
+
def self.get_deployment_artifacts_dir
|
105
|
+
PepprAppDeployFileUtils::Local::get_deployment_dir(PEPPR_RELATIVE_ARTIFACTS_DIR)
|
106
|
+
end
|
95
107
|
end
|
96
108
|
|
97
109
|
module Remote
|
@@ -109,7 +121,8 @@ module PepprAppDeployFileUtils
|
|
109
121
|
execute :mkdir, '-p', PepprAppDeployFileUtils::Remote::get_deployment_scripts_dir
|
110
122
|
execute :mkdir, '-p', PepprAppDeployFileUtils::Remote::get_deployment_tmp_dir
|
111
123
|
execute :mkdir, '-p', PepprAppDeployFileUtils::Remote::get_deployment_environments_dir
|
112
|
-
execute :mkdir, '-p', PepprAppDeployFileUtils::Remote::get_deployment_shared_files_dir
|
124
|
+
execute :mkdir, '-p', PepprAppDeployFileUtils::Remote::get_deployment_shared_files_dir
|
125
|
+
execute :mkdir, '-p', PepprAppDeployFileUtils::Remote::get_deployment_artifacts_dir
|
113
126
|
end
|
114
127
|
end
|
115
128
|
|
@@ -167,12 +180,19 @@ module PepprAppDeployFileUtils
|
|
167
180
|
PepprAppDeployFileUtils::Remote::get_deployment_dir(PEPPR_RELATIVE_ENVIRONMENTS_DIR)
|
168
181
|
end
|
169
182
|
|
170
|
-
# Method for retrieving the Peppr application deployment
|
183
|
+
# Method for retrieving the Peppr application deployment shared files directory
|
171
184
|
#
|
172
185
|
# @return [String] the fully-qualified remote shared files directory
|
173
186
|
def self.get_deployment_shared_files_dir
|
174
187
|
"#{PepprAppDeployFileUtils::Remote::get_deployment_environments_dir()}/#{fetch(:stage)}#{PEPPR_RELATIVE_SHARED_FILE_DIR}"
|
175
|
-
end
|
188
|
+
end
|
189
|
+
|
190
|
+
# Method for retrieving the Peppr application deployment artifacts directory
|
191
|
+
#
|
192
|
+
# @return [String] the fully-qualified remote artifacts directory
|
193
|
+
def self.get_deployment_artifacts_dir
|
194
|
+
PepprAppDeployFileUtils::Remote::get_deployment_dir(PEPPR_RELATIVE_ARTIFACTS_DIR)
|
195
|
+
end
|
176
196
|
end
|
177
197
|
|
178
198
|
# Method to compress, upload, and extract a local directory using the following procedure:
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# == psw-javaee.cap
|
2
|
+
#
|
3
|
+
# Contains the capistrano tasks needed to facilitate Java EE deployments.
|
4
|
+
#
|
5
|
+
# == Configuration
|
6
|
+
#
|
7
|
+
# == Tasks
|
8
|
+
#
|
9
|
+
# === psw_javaee:explode_war_file
|
10
|
+
# This task will explode a WAR file into a specified directory.
|
11
|
+
# Parameters:
|
12
|
+
# *explode_directory [String] - The directory to which the exploded contents will be written
|
13
|
+
# *war_file_location [String] - The absolute path of the WAR file.
|
14
|
+
#
|
15
|
+
# == Contact
|
16
|
+
#
|
17
|
+
# Author:: Lexmark International Technology S.A.
|
18
|
+
# Copyright:: 2014 Lexmark International Technology S.A. All rights reserved.
|
19
|
+
# License:: 3-Clause BSD
|
20
|
+
#
|
21
|
+
require 'capistrano/psw/peppr_app_deploy_file_utils'
|
22
|
+
|
23
|
+
namespace :psw_javaee do
|
24
|
+
|
25
|
+
desc 'Explodes a WAR file into a specified directory'
|
26
|
+
task :explode_war_file, :explode_directory, :war_file_location do |t, args|
|
27
|
+
on roles(:app) do |host|
|
28
|
+
puts "Exploding WAR file #{args[:war_file_location]} to #{args[:explode_directory]}..."
|
29
|
+
execute :mkdir, '-p', args[:explode_directory]
|
30
|
+
execute("cd #{args[:explode_directory]} ; /usr/bin/jar xf #{args[:war_file_location]}")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -29,6 +29,17 @@
|
|
29
29
|
# application. However, if the environment files do not exist, they
|
30
30
|
# will not be uploaded.
|
31
31
|
#
|
32
|
+
# === psw_peppr_app_deploy:upload_artifacts
|
33
|
+
# This task will upload your application's associated artifacts to the correct folder
|
34
|
+
# on the remote machine.
|
35
|
+
#
|
36
|
+
# === psw_peppr_app_deploy:set_deploy_revision
|
37
|
+
# This task will update Capistrano branch environment to point to the Peppr branch.
|
38
|
+
#
|
39
|
+
# === psw_peppr_app_deploy:link_artifacts
|
40
|
+
# This task will create a symbolic link from the remote artifacts directory to the current
|
41
|
+
# release directory as "/artifacts"
|
42
|
+
#
|
32
43
|
# == Contact
|
33
44
|
#
|
34
45
|
# Author:: Lexmark International Technology S.A.
|
@@ -116,7 +127,18 @@ namespace :psw_peppr_app_deploy do
|
|
116
127
|
info "The shared files path, #{local_shared_files_path} does not exist."
|
117
128
|
end
|
118
129
|
end
|
119
|
-
end
|
130
|
+
end
|
131
|
+
|
132
|
+
desc 'Upload application source repository to remote server'
|
133
|
+
task :upload_artifacts do
|
134
|
+
on roles(:all) do |host|
|
135
|
+
local_dir = PepprAppDeployFileUtils::Local::get_deployment_artifacts_dir
|
136
|
+
remote_dir = PepprAppDeployFileUtils::Remote::get_deployment_artifacts_dir
|
137
|
+
|
138
|
+
info "Uploading #{local_dir} (local) to #{remote_dir} on remote server #{host}..."
|
139
|
+
PepprAppDeployFileUtils::upload_compressed_local_dir(local_dir, remote_dir)
|
140
|
+
end
|
141
|
+
end
|
120
142
|
|
121
143
|
desc 'Remove existing Capistrano source repo'
|
122
144
|
task :remove_existing_source_repo do
|
@@ -126,6 +148,7 @@ namespace :psw_peppr_app_deploy do
|
|
126
148
|
end
|
127
149
|
end
|
128
150
|
|
151
|
+
desc 'Update Capistrano branch environment to point to the Peppr branch'
|
129
152
|
task :set_deploy_revision do
|
130
153
|
on roles(:all) do
|
131
154
|
unless ENV['branch'].nil?
|
@@ -137,7 +160,21 @@ namespace :psw_peppr_app_deploy do
|
|
137
160
|
end
|
138
161
|
end
|
139
162
|
|
140
|
-
desc "Deploy
|
141
|
-
task default: [:'set_deploy_revision', :'create_deployment_directories', :'upload_app_source_repo', :'upload_environment_files', :'remove_existing_source_repo'] do
|
163
|
+
desc "Deploy a Peppr application to the remote server(s)"
|
164
|
+
task default: [:'set_deploy_revision', :'create_deployment_directories', :'upload_app_source_repo', :'upload_environment_files', :'upload_artifacts', :'remove_existing_source_repo'] do
|
165
|
+
end
|
166
|
+
|
167
|
+
desc 'Task to create a symlink from the artifacts directory to the release directory'
|
168
|
+
task :link_artifacts do
|
169
|
+
on roles(:all) do |host|
|
170
|
+
remote_dir = PepprAppDeployFileUtils::Remote::get_deployment_artifacts_dir
|
171
|
+
|
172
|
+
info "Creating a symlink from the artifacts directory (#{remote_dir}) in the current release directory #{fetch(:release_path)}/artifacts on remote server #{host}..."
|
173
|
+
sudo :ln, '-s', "#{remote_dir}", "#{fetch(:release_path)}/artifacts"
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
desc "Optional steps to execute a Peppr deployment after a Capistrano deploy has finished"
|
178
|
+
task post_deploy_steps: [:'link_artifacts'] do
|
142
179
|
end
|
143
|
-
end
|
180
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "rake"
|
2
|
+
require File.expand_path('../spec_helper.rb', __FILE__)
|
3
|
+
|
4
|
+
|
5
|
+
describe "psw_javaee:" do
|
6
|
+
describe "explode_war_file" do
|
7
|
+
let(:rake) { Rake::Application.new }
|
8
|
+
subject { rake["psw_javaee:explode_war_file"] }
|
9
|
+
|
10
|
+
before do
|
11
|
+
Rake.application = rake
|
12
|
+
Rake.application.add_import("./resources/lib/capistrano/tasks/psw-javaee.cap")
|
13
|
+
Rake.application.load_imports()
|
14
|
+
end
|
15
|
+
|
16
|
+
it "has 'no prerequisites" do
|
17
|
+
subject.prerequisites.should be_empty
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-psw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.pre32
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lexmark International Technology S.A
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- lib/capistrano/psw/version.rb
|
90
90
|
- resources/lib/capistrano/tasks/psw-apache2.cap
|
91
91
|
- resources/lib/capistrano/tasks/psw-clockwork.cap
|
92
|
+
- resources/lib/capistrano/tasks/psw-javaee.cap
|
92
93
|
- resources/lib/capistrano/tasks/psw-nginx.cap
|
93
94
|
- resources/lib/capistrano/tasks/psw-peppr-app-deploy.cap
|
94
95
|
- resources/lib/capistrano/tasks/psw-peppr.cap
|
@@ -96,6 +97,7 @@ files:
|
|
96
97
|
- resources/lib/capistrano/tasks/psw-sidekiq.cap
|
97
98
|
- spec/psw-apache2_spec.rb
|
98
99
|
- spec/psw-clockwork_spec.rb
|
100
|
+
- spec/psw-javaee_spec.rb
|
99
101
|
- spec/psw-nginx_spec.rb
|
100
102
|
- spec/psw-peppr-app-deploy_spec.rb
|
101
103
|
- spec/psw-peppr_spec.rb
|
@@ -132,6 +134,7 @@ summary: Contains Capistrano v3 Deployment Tasks
|
|
132
134
|
test_files:
|
133
135
|
- spec/psw-apache2_spec.rb
|
134
136
|
- spec/psw-clockwork_spec.rb
|
137
|
+
- spec/psw-javaee_spec.rb
|
135
138
|
- spec/psw-nginx_spec.rb
|
136
139
|
- spec/psw-peppr-app-deploy_spec.rb
|
137
140
|
- spec/psw-peppr_spec.rb
|