kstrano 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/kumafy +21 -36
- data/lib/helpers/kuma_helper.rb +2 -2
- data/lib/kstrano.rb +60 -227
- metadata +19 -54
data/bin/kumafy
CHANGED
@@ -51,31 +51,14 @@ def update_deploy_config(ui, base, context, force)
|
|
51
51
|
|
52
52
|
deploy = File.join(base, "app", "config", "deploy.rb")
|
53
53
|
write_deploy = true
|
54
|
-
#if File.exists?(deploy)
|
55
|
-
#overwrite = ui.ask("The file #{deploy} already exists, do you want to override it? ") { |q| q.default = 'n' }
|
56
|
-
#if !overwrite.match(/^y/)
|
57
|
-
# write_deploy = false
|
58
|
-
#end
|
59
|
-
#end
|
60
54
|
|
61
55
|
if write_deploy
|
62
56
|
dirname = File.basename(Dir.getwd)
|
63
57
|
deploy_gist = get_plain_secure(DEPLOY_GIST).body
|
64
|
-
app_name
|
58
|
+
context["app_name"] ||= ui.ask("What's the name of the application?")
|
59
|
+
app_name = context["app_name"]
|
65
60
|
deploy_gist.gsub!(/(:application,\s)(\"\")/, '\1' + "\"#{app_name}\"")
|
66
61
|
deploy_gist.gsub!(/(:admin_runner,\s)(\"\")/, '\1' + "\"#{app_name}\"")
|
67
|
-
|
68
|
-
campfire_room = ui.ask("What's the name of the campfire room for this project?")
|
69
|
-
if !campfire_room.nil? && !campfire_room.empty?
|
70
|
-
deploy_gist.gsub!(/(:campfire_room,\s)(nil)/, '\1' + "\"#{campfire_room}\"")
|
71
|
-
context["campfire_room"] = campfire_room
|
72
|
-
end
|
73
|
-
|
74
|
-
airbrake_api_key = ui.ask("What's the api key of this project for airbrake?")
|
75
|
-
if !airbrake_api_key.nil? && !airbrake_api_key.empty?
|
76
|
-
deploy_gist.gsub!(/(:airbrake_api_key,\s)(nil)/, '\1' + "\"#{airbrake_api_key}\"")
|
77
|
-
context["airbrake_api_key"] = airbrake_api_key
|
78
|
-
end
|
79
62
|
|
80
63
|
File.open(deploy, "w") do |f|
|
81
64
|
deploy_gist.each_line do |line|
|
@@ -93,21 +76,21 @@ def update_deploy_config(ui, base, context, force)
|
|
93
76
|
}.each do |env, gist|
|
94
77
|
file = File.join(deploy_dir, "#{env}.rb")
|
95
78
|
write = true
|
96
|
-
|
79
|
+
|
97
80
|
if File.exists?(file)
|
98
81
|
overwrite = ui.ask("The file #{file} already exists, do you want to override it? ") { |q| q.default = 'n' }
|
99
82
|
if !overwrite.match(/^y/)
|
100
83
|
write = false
|
101
84
|
end
|
102
85
|
end
|
103
|
-
|
86
|
+
|
104
87
|
if write
|
105
88
|
gist_body = get_plain_secure(gist).body
|
106
89
|
server = ui.ask("On which server is the #{env} environment deployed?")
|
107
90
|
if !server.match(/^.*\.kunstmaan\.be$/)
|
108
91
|
server = "#{server}.kunstmaan.be"
|
109
92
|
end
|
110
|
-
|
93
|
+
|
111
94
|
gist_body.gsub!(/(:domain,\s)(\"\")/, '\1' + "\"#{server}\"")
|
112
95
|
|
113
96
|
File.open(file, "w") do |f|
|
@@ -197,21 +180,23 @@ end
|
|
197
180
|
|
198
181
|
def update_vendors(base)
|
199
182
|
vendors = File.join(base, "bin", "vendors")
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
183
|
+
if File.directory?(vendors)
|
184
|
+
fcontent = ""
|
185
|
+
File.open(vendors, "r") do |f|
|
186
|
+
f.each do |line|
|
187
|
+
fcontent << line
|
188
|
+
end
|
204
189
|
end
|
205
|
-
end
|
206
190
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
191
|
+
File.open(vendors, "w") do |f|
|
192
|
+
fcontent.each_line do |line|
|
193
|
+
f.print line
|
194
|
+
if line.include? "git clone %s %s"
|
195
|
+
f.print " system(sprintf('cd %s && git config core.filemode false', escapeshellarg($installDir)));" + "\r\n"
|
196
|
+
end
|
212
197
|
end
|
213
198
|
end
|
214
|
-
end
|
199
|
+
end
|
215
200
|
end
|
216
201
|
|
217
202
|
force = false
|
@@ -261,9 +246,9 @@ ui = HighLine.new
|
|
261
246
|
base = ARGV.shift
|
262
247
|
context = Hash.new
|
263
248
|
|
264
|
-
puts "[start]
|
265
|
-
%x(
|
266
|
-
puts "[end]
|
249
|
+
puts "[start] capifony"
|
250
|
+
%x(capifony .)
|
251
|
+
puts "[end] capifony"
|
267
252
|
|
268
253
|
update_capfile base, context, force
|
269
254
|
update_deploy_config ui, base, context, force
|
data/lib/helpers/kuma_helper.rb
CHANGED
@@ -11,11 +11,11 @@ module Kumastrano
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def say(text)
|
14
|
-
Capistrano::CLI.ui.say("
|
14
|
+
Capistrano::CLI.ui.say("--> #{text}")
|
15
15
|
end
|
16
16
|
|
17
17
|
def ask(question, default='n')
|
18
|
-
agree = Capistrano::CLI.ui.agree("
|
18
|
+
agree = Capistrano::CLI.ui.agree("--> #{question} ") do |q|
|
19
19
|
q.default = default
|
20
20
|
end
|
21
21
|
|
data/lib/kstrano.rb
CHANGED
@@ -1,25 +1,11 @@
|
|
1
|
-
set :jenkins_base_uri, ""
|
2
|
-
set :jenkins_base_job_name, "Default"
|
3
|
-
set :jenkins_poll_timeout, 300
|
4
|
-
set :jenkins_poll_interval, 2
|
5
|
-
set :jenkins_enabled, false
|
6
|
-
|
7
|
-
set :campfire_room, nil
|
8
|
-
set :campfire_token, "" ## kbot
|
9
|
-
set :campfire_account, "Kunstmaan"
|
10
|
-
|
11
|
-
set :airbrake_api_key, nil
|
12
|
-
|
13
1
|
# PHP binary to execute
|
14
|
-
set :php_bin,
|
2
|
+
set :php_bin, "php"
|
15
3
|
# Symfony console bin
|
16
|
-
set :symfony_console,
|
4
|
+
set :symfony_console, app_path + "/console"
|
17
5
|
|
6
|
+
set :force_schema, false
|
18
7
|
|
19
8
|
require "#{File.dirname(__FILE__)}/helpers/git_helper.rb"
|
20
|
-
require "#{File.dirname(__FILE__)}/helpers/jenkins_helper.rb"
|
21
|
-
require "#{File.dirname(__FILE__)}/helpers/airbrake_helper.rb"
|
22
|
-
require "#{File.dirname(__FILE__)}/helpers/campfire_helper.rb"
|
23
9
|
require "#{File.dirname(__FILE__)}/helpers/kuma_helper.rb"
|
24
10
|
require 'rexml/document'
|
25
11
|
require 'etc'
|
@@ -36,109 +22,21 @@ namespace :kuma do
|
|
36
22
|
sudo "sh -c 'if [ -f /opt/kDeploy/tools/fixperms.py ] ; then cd /opt/kDeploy/tools/; python fixperms.py #{application}; fi'"
|
37
23
|
end
|
38
24
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
desc "Register a deploy with airbrake.io"
|
44
|
-
task :notify do
|
45
|
-
if !airbrake_api_key.nil?
|
46
|
-
revision = Kumastrano::GitHelper::commit_hash
|
47
|
-
repository = Kumastrano::GitHelper::origin_url
|
48
|
-
env ||= "production"
|
49
|
-
success = Kumastrano::AirbrakeHelper.notify airbrake_api_key, revision, repository, env
|
50
|
-
Kumastrano.say "Failed notifying airbrake of the new deploy" unless success
|
51
|
-
end
|
25
|
+
desc "Make the SSH Authentication socket reachable for project user"
|
26
|
+
task :fix_ssh_socket do
|
27
|
+
sudo "chmod 777 -R `dirname $SSH_AUTH_SOCK`"
|
52
28
|
end
|
53
29
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
desc "Say something on campfire"
|
59
|
-
task:say do
|
60
|
-
if !campfire_room.nil?
|
61
|
-
message = ARGV.join(' ').gsub('campfire:say', '')
|
62
|
-
Kumastrano::CampfireHelper.speak campfire_account, campfire_token, campfire_room, message
|
63
|
-
exit
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
|
69
|
-
namespace :jenkins do
|
70
|
-
|
71
|
-
desc "create a job for the current branch and application on Jenkins"
|
72
|
-
task:create_job do
|
73
|
-
## 1. locate the job in jenkins
|
74
|
-
current_branch = Kumastrano::GitHelper.branch_name
|
75
|
-
job_name = Kumastrano::JenkinsHelper.make_safe_job_name(application, current_branch)
|
76
|
-
current_job_url = Kumastrano::JenkinsHelper.job_url_for_name(jenkins_base_uri, job_name)
|
77
|
-
|
78
|
-
## 2. if no job was found, first create a job for this branch
|
79
|
-
if current_job_url.nil?
|
80
|
-
Kumastrano.say "no job found for branch #{current_branch} on #{application}, we'll create one now"
|
81
|
-
default_job_url = Kumastrano::JenkinsHelper.job_url_for_name(jenkins_base_uri, jenkins_base_job_name)
|
82
|
-
if !default_job_url.nil?
|
83
|
-
current_refspec = Kumastrano::GitHelper.origin_refspec
|
84
|
-
current_url = Kumastrano::GitHelper.origin_url
|
85
|
-
|
86
|
-
default_job_config = Kumastrano::JenkinsHelper.retrieve_config_xml default_job_url
|
87
|
-
document = REXML::Document.new default_job_config
|
88
|
-
root = document.root
|
89
|
-
|
90
|
-
## change the description
|
91
|
-
root.elements['description'].text = "This job will be used for testing the branch #{current_branch}"
|
92
|
-
|
93
|
-
## change the git config
|
94
|
-
git_element = root.elements["scm[@class='hudson.plugins.git.GitSCM']"]
|
95
|
-
git_element.elements["userRemoteConfigs/hudson.plugins.git.UserRemoteConfig/refspec"].text = current_refspec
|
96
|
-
git_element.elements["userRemoteConfigs/hudson.plugins.git.UserRemoteConfig/url"].text = current_url
|
97
|
-
git_element.elements["branches/hudson.plugins.git.BranchSpec/name"].text = current_branch
|
98
|
-
|
99
|
-
## create the new job based on the modified git config
|
100
|
-
Kumastrano::JenkinsHelper.create_new_job(jenkins_base_uri, job_name, document.to_s)
|
101
|
-
current_job_url = Kumastrano::JenkinsHelper.job_url_for_name(jenkins_base_uri, job_name)
|
102
|
-
end
|
103
|
-
else
|
104
|
-
Kumastrano.say "there was already a job available on Jenkins for branch #{current_branch} on #{application}"
|
105
|
-
end
|
106
|
-
|
107
|
-
current_job_url
|
108
|
-
end
|
109
|
-
|
110
|
-
desc "Try to build the current branch on Jenkins"
|
111
|
-
task:build do
|
112
|
-
current_job_url = jenkins::create_job
|
113
|
-
current_branch = Kumastrano::GitHelper.branch_name
|
114
|
-
|
115
|
-
if !current_job_url.nil?
|
116
|
-
job_name = Kumastrano::JenkinsHelper.make_safe_job_name(application, current_branch)
|
117
|
-
prev_build = Kumastrano::JenkinsHelper.last_build_number current_job_url
|
118
|
-
Kumastrano.say "start building build ##{(prev_build + 1)} on job #{job_name}, this can take a while"
|
119
|
-
|
120
|
-
result, last_build_info = Kumastrano::JenkinsHelper.build_and_wait current_job_url, jenkins_poll_timeout, jenkins_poll_interval
|
121
|
-
|
122
|
-
message = ""
|
123
|
-
if result
|
124
|
-
Kumastrano.say "the build was succesful"
|
125
|
-
message = "was a success"
|
126
|
-
else
|
127
|
-
Kumastrano.say "the build failed"
|
128
|
-
message = "failed"
|
129
|
-
end
|
130
|
-
|
131
|
-
Kumastrano::CampfireHelper.speak campfire_account, campfire_token, campfire_room, "#{Etc.getlogin.capitalize} just builded a new version of #{current_branch} on #{application} and it #{message}. You can view the results here #{current_job_url}/lastBuild."
|
132
|
-
else
|
133
|
-
Kumastrano.say "no job found for #{job_name}, cannot build"
|
134
|
-
end
|
30
|
+
desc "Make the SSH Authentication socket reachable for project user"
|
31
|
+
task :unfix_ssh_socket do
|
32
|
+
sudo "chmod 775 -R `dirname $SSH_AUTH_SOCK`"
|
135
33
|
end
|
136
34
|
|
137
35
|
end
|
138
36
|
|
139
37
|
namespace :deploy do
|
140
38
|
|
141
|
-
task :
|
39
|
+
task :create_symlink, :except => { :no_release => true } do
|
142
40
|
on_rollback do
|
143
41
|
if previous_release
|
144
42
|
try_sudo "ln -sf #{previous_release} #{current_path}; true"
|
@@ -146,128 +44,62 @@ namespace :deploy do
|
|
146
44
|
logger.important "no previous release to rollback to, rollback of symlink skipped"
|
147
45
|
end
|
148
46
|
end
|
149
|
-
|
150
47
|
try_sudo "ln -sfT #{latest_release} #{current_path}"
|
151
48
|
end
|
152
49
|
|
153
50
|
end
|
154
51
|
|
155
|
-
|
52
|
+
namespace :symfony do
|
156
53
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
current_branch = Kumastrano::GitHelper.branch_name
|
165
|
-
current_hash = Kumastrano::GitHelper.commit_hash
|
166
|
-
|
167
|
-
if Kumastrano::JenkinsHelper.available? jenkins_base_uri
|
168
|
-
## Allways fetch the latest information from git
|
169
|
-
Kumastrano::GitHelper.fetch
|
170
|
-
|
171
|
-
job_name = Kumastrano::JenkinsHelper.make_safe_job_name(application, current_branch)
|
172
|
-
current_job_url = Kumastrano::JenkinsHelper.job_url_for_name(jenkins_base_uri, job_name)
|
173
|
-
|
174
|
-
if current_job_url.nil?
|
175
|
-
## No job exists for the current branch, we'll create a job.
|
176
|
-
if Kumastrano.ask "no job found for the current branch, do you want to create a job for #{current_branch} on #{application}?", 'y'
|
177
|
-
current_job_url = jenkins::create_job
|
178
|
-
end
|
179
|
-
end
|
54
|
+
desc "Copy vendors from previous release"
|
55
|
+
task :copy_vendors, :except => { :no_release => true } do
|
56
|
+
pretty_print "--> Copying vendors from previous release"
|
57
|
+
try_sudo "mkdir #{release_path}/vendor"
|
58
|
+
try_sudo "sh -c 'if [ -d #{previous_release}/vendor ] ; then cp -a #{previous_release}/vendor/* #{release_path}/vendor/; fi'"
|
59
|
+
puts_ok
|
60
|
+
end
|
180
61
|
|
181
|
-
|
182
|
-
|
183
|
-
last_build_info = Kumastrano::JenkinsHelper.build_info current_job_url
|
184
|
-
result = last_build_info['result'] ## SUCCESS or FAILURE
|
185
|
-
build_hash = Kumastrano::JenkinsHelper.fetch_build_hash_from_build_info(last_build_info, current_branch)
|
62
|
+
namespace :doctrine do
|
63
|
+
namespace :schema do
|
186
64
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
can_deploy = true
|
192
|
-
else
|
193
|
-
## The hash of the last build is the same as the current hash, but the build failed.
|
194
|
-
if Kumastrano.ask "the last build for the branch #{current_branch} for commit #{current_hash} failed, do you want to build again?", 'y'
|
195
|
-
prev_build = Kumastrano::JenkinsHelper.last_build_number current_job_url
|
196
|
-
Kumastrano.say "start building build ##{(prev_build + 1)} on job #{job_name}, this can take a while"
|
197
|
-
result, last_build_info = Kumastrano::JenkinsHelper.build_and_wait current_job_url, jenkins_poll_timeout, jenkins_poll_interval
|
198
|
-
new_build_hash = Kumastrano::JenkinsHelper.fetch_build_hash_from_build_info(last_build_info, current_branch)
|
199
|
-
if !result.nil? && result && !new_build_hash.nil? && new_build_hash = current_hash
|
200
|
-
can_deploy = true
|
201
|
-
else
|
202
|
-
Kumastrano.say "there is still something wrong with #{current_branch} on #{application}, please check manually and try deploying again afterwards!"
|
203
|
-
end
|
204
|
-
end
|
205
|
-
end
|
206
|
-
else
|
207
|
-
merge_base = Kumastrano::GitHelper.merge_base(build_hash, current_hash)
|
208
|
-
if merge_base == build_hash
|
209
|
-
## The build commit is an ancestor of HEAD
|
210
|
-
if Kumastrano.ask "the last build for the branch #{current_branch} is from an older commit do you want to build again? (jenkins=#{build_hash}, local=#{current_hash})", 'y'
|
211
|
-
prev_build = Kumastrano::JenkinsHelper.last_build_number current_job_url
|
212
|
-
Kumastrano.say "start building build ##{(prev_build + 1)} on job #{job_name}, this can take a while"
|
213
|
-
result, last_build_info = Kumastrano::JenkinsHelper.build_and_wait current_job_url, jenkins_poll_timeout, jenkins_poll_interval
|
214
|
-
new_build_hash = Kumastrano::JenkinsHelper.fetch_build_hash_from_build_info(last_build_info, current_branch)
|
215
|
-
if !result.nil? && result && !new_build_hash.nil? && new_build_hash = current_hash
|
216
|
-
can_deploy = true
|
217
|
-
else
|
218
|
-
Kumastrano.say "there is still something wrong with #{current_branch} on #{application}, please check manually and try deploying again afterwards!"
|
219
|
-
end
|
220
|
-
end
|
221
|
-
elsif merge_base == current_hash
|
222
|
-
## The current HEAD is an ancestor of the build hash
|
223
|
-
Kumastrano.say "the latest build is of a newer commit, someone else is probably working on the same branch, try updating your local repository first. (jenkins=#{build_hash}, local=#{current_hash})"
|
224
|
-
else
|
225
|
-
## Something is wrong, we don't know what try building again
|
226
|
-
if Kumastrano.ask "the latest build isn't a valid build, do you want to try building again? (jenkins=#{build_hash}, local=#{current_hash})", 'y'
|
227
|
-
prev_build = Kumastrano::JenkinsHelper.last_build_number current_job_url
|
228
|
-
Kumastrano.say "start building build ##{(prev_build + 1)} on job #{job_name}, this can take a while"
|
229
|
-
result, last_build_info = Kumastrano::JenkinsHelper.build_and_wait current_job_url, jenkins_poll_timeout, jenkins_poll_interval
|
230
|
-
new_build_hash = Kumastrano::JenkinsHelper.fetch_build_hash_from_build_info(last_build_info, current_branch)
|
231
|
-
if !result.nil? && result && !new_build_hash.nil? && new_build_hash = current_hash
|
232
|
-
can_deploy = true
|
233
|
-
else
|
234
|
-
Kumastrano.say "there is still something wrong with #{current_branch} on #{application}, please check manually and try deploying again afterwards!"
|
235
|
-
end
|
236
|
-
end
|
237
|
-
end
|
238
|
-
end
|
239
|
-
else
|
240
|
-
## No build found, try building it
|
241
|
-
if Kumastrano.ask "no build found, do you want to try building it?", 'y'
|
242
|
-
prev_build = Kumastrano::JenkinsHelper.last_build_number current_job_url
|
243
|
-
Kumastrano.say "start building build ##{(prev_build + 1)} on job #{job_name}, this can take a while"
|
244
|
-
result, last_build_info = Kumastrano::JenkinsHelper.build_and_wait current_job_url, jenkins_poll_timeout, jenkins_poll_interval
|
245
|
-
new_build_hash = Kumastrano::JenkinsHelper.fetch_build_hash_from_build_info(last_build_info, current_branch)
|
246
|
-
if !result.nil? && result && !new_build_hash.nil? && new_build_hash = current_hash
|
247
|
-
can_deploy = true
|
248
|
-
else
|
249
|
-
Kumastrano.say "there is still something wrong with #{current_branch} on #{application}, please check manually and try deploying again afterwards!"
|
250
|
-
end
|
251
|
-
end
|
65
|
+
desc "Update the database schema."
|
66
|
+
task :update do
|
67
|
+
if force_schema
|
68
|
+
try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:update --env=#{symfony_env_prod} --force'", :once => true
|
252
69
|
end
|
253
70
|
end
|
254
|
-
end
|
255
71
|
|
256
|
-
if !can_deploy
|
257
|
-
if Kumastrano.ask "no valid build found for #{current_hash} on branch #{current_branch}, do you still want to deploy?"
|
258
|
-
Kumastrano::CampfireHelper.speak campfire_account, campfire_token, campfire_room, "#{Etc.getlogin.capitalize} ignored the fact there was something wrong with #{current_branch} on #{application} and still went on with deploying it!!"
|
259
|
-
else
|
260
|
-
Kumastrano::CampfireHelper.speak campfire_account, campfire_token, campfire_room, "#{Etc.getlogin.capitalize} wanted to deploy #{current_branch} on #{application} but there is something wrong with the code, so he cancelled it!"
|
261
|
-
exit
|
262
|
-
end
|
263
|
-
else
|
264
|
-
Kumastrano::CampfireHelper.speak campfire_account, campfire_token, campfire_room, "#{Etc.getlogin.capitalize} is deploying #{current_branch} for #{application}"
|
265
72
|
end
|
266
|
-
else
|
267
|
-
Kumastrano.say "jenkins on demand is disabled, skipping..."
|
268
73
|
end
|
74
|
+
|
269
75
|
end
|
270
76
|
|
77
|
+
before "symfony:vendors:install", "symfony:copy_vendors" # Symfony2 2.0.x
|
78
|
+
before "symfony:composer:install", "symfony:copy_vendors" # Symfony2 2.1
|
79
|
+
before "symfony:composer:update", "symfony:copy_vendors" # Symfony2 2.1
|
80
|
+
|
81
|
+
# Fix the SSH socket so that it's reachable for the project user, this is needed to pass your local ssh keys to github
|
82
|
+
before "symfony:vendors:install", "kuma:fix_ssh_socket"
|
83
|
+
before "symfony:vendors:reinstall", "kuma:fix_ssh_socket"
|
84
|
+
before "symfony:vendors:upgrade", "kuma:fix_ssh_socket"
|
85
|
+
before "symfony:composer:update", "kuma:fix_ssh_socket"
|
86
|
+
before "symfony:composer:install", "kuma:fix_ssh_socket"
|
87
|
+
after "symfony:vendors:install", "kuma:unfix_ssh_socket"
|
88
|
+
after "symfony:vendors:reinstall", "kuma:unfix_ssh_socket"
|
89
|
+
after "symfony:vendors:upgrade", "kuma:unfix_ssh_socket"
|
90
|
+
after "symfony:composer:update", "kuma:unfix_ssh_socket"
|
91
|
+
after "symfony:composer:install", "kuma:unfix_ssh_socket"
|
92
|
+
|
93
|
+
# ask to update the schema
|
94
|
+
after "symfony:vendors:install", "symfony:doctrine:schema:update"
|
95
|
+
after "symfony:vendors:reinstall", "symfony:doctrine:schema:update"
|
96
|
+
after "symfony:vendors:upgrade", "symfony:doctrine:schema:update"
|
97
|
+
after "symfony:composer:update", "symfony:doctrine:schema:update"
|
98
|
+
after "symfony:composer:install", "symfony:doctrine:schema:update"
|
99
|
+
|
100
|
+
# clear the cache before the warmup
|
101
|
+
before "symfony:cache:warmup", "symfony:cache:clear"
|
102
|
+
|
271
103
|
# Before update_code:
|
272
104
|
## Make the cached_copy readable for the current user
|
273
105
|
before "deploy:update_code" do
|
@@ -278,6 +110,7 @@ end
|
|
278
110
|
# After update_code:
|
279
111
|
## Fix the permissions of the cached_copy so that it's readable for the project user
|
280
112
|
after "deploy:update_code" do
|
113
|
+
on_rollback { sudo "rm -rf #{release_path}; true" } # by default capistrano will use the run command, but everything has project user rights in our server setup, so use try_sudo in stead of run.
|
281
114
|
sudo "sh -c 'if [ -d #{shared_path}/cached-copy ] ; then chown -R #{application}:#{application} #{shared_path}/cached-copy; fi'" if deploy_via == :rsync_with_remote_cache || deploy_via == :remote_cache
|
282
115
|
end
|
283
116
|
|
@@ -285,12 +118,19 @@ end
|
|
285
118
|
## Create the parameters.ini if it's a symfony project
|
286
119
|
## Fix the permissions of the latest release, so that it's readable for the project user
|
287
120
|
before "deploy:finalize_update" do
|
121
|
+
on_rollback { sudo "rm -rf #{release_path}; true" } # by default capistrano will use the run command, but everything has project user rights in our server setup, so use try_sudo in stead of run.
|
288
122
|
sudo "sh -c 'if [ -d #{shared_path}/cached-copy ] ; then chmod -R ug+rx #{latest_release}/paramDecode; fi'"
|
289
|
-
sudo "sh -c 'if [ -f #{
|
123
|
+
sudo "sh -c 'if [ -f #{release_path}/paramDecode ] ; then cd #{release_path} && ./paramDecode; fi'" # Symfony specific: will generate the parameters.ini
|
290
124
|
sudo "chown -R #{application}:#{application} #{latest_release}"
|
291
125
|
sudo "setfacl -R -m group:admin:rwx #{latest_release}"
|
292
126
|
end
|
293
127
|
|
128
|
+
after "deploy:finalize_update" do
|
129
|
+
sudo "/etc/init.d/php5-fpm reload"
|
130
|
+
serverproject = domain.split('.')[0]
|
131
|
+
sudo "sh -c 'curl https://raw.github.com/gist/2868838/ > /home/projects/#{serverproject}/site/apcclear.php'"
|
132
|
+
end
|
133
|
+
|
294
134
|
before :deploy do
|
295
135
|
Kumastrano.say "executing ssh-add"
|
296
136
|
%x(ssh-add)
|
@@ -300,13 +140,6 @@ end
|
|
300
140
|
## Notify the people on campfire of this deploy
|
301
141
|
## Notify airbrake to add a new deploy to the deploy history
|
302
142
|
after :deploy do
|
303
|
-
current_branch = Kumastrano::GitHelper.branch_name
|
304
|
-
Kumastrano::CampfireHelper.speak campfire_account, campfire_token, campfire_room, "#{Etc.getlogin.capitalize} successfuly deployed #{current_branch} for #{application}"
|
305
|
-
sudo "/etc/init.d/php5-fpm reload"
|
306
|
-
serverproject = domain.split('.')[0]
|
307
|
-
sudo "sh -c 'curl https://raw.github.com/gist/2868838/ > /home/projects/#{serverproject}/site/apcclear.php'"
|
308
|
-
sudo "chmod 777 /home/projects/#{serverproject}/site/apcclear.php"
|
309
|
-
sudo "curl http://#{domain}/apcclear.php"
|
310
143
|
kuma::fixcron
|
311
144
|
deploy::cleanup ## cleanup old releases
|
312
145
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kstrano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.18
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-21 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70358125577500 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,15 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.12.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 2.12.0
|
24
|
+
version_requirements: *70358125577500
|
30
25
|
- !ruby/object:Gem::Dependency
|
31
26
|
name: capistrano-ext
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
27
|
+
requirement: &70358125576980 !ruby/object:Gem::Requirement
|
33
28
|
none: false
|
34
29
|
requirements:
|
35
30
|
- - ! '>='
|
@@ -37,15 +32,10 @@ dependencies:
|
|
37
32
|
version: 1.2.1
|
38
33
|
type: :runtime
|
39
34
|
prerelease: false
|
40
|
-
version_requirements:
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 1.2.1
|
35
|
+
version_requirements: *70358125576980
|
46
36
|
- !ruby/object:Gem::Dependency
|
47
37
|
name: capistrano_colors
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirement: &70358125576460 !ruby/object:Gem::Requirement
|
49
39
|
none: false
|
50
40
|
requirements:
|
51
41
|
- - ! '>='
|
@@ -53,31 +43,21 @@ dependencies:
|
|
53
43
|
version: 0.5.5
|
54
44
|
type: :runtime
|
55
45
|
prerelease: false
|
56
|
-
version_requirements:
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.5.5
|
46
|
+
version_requirements: *70358125576460
|
62
47
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
48
|
+
name: capifony
|
49
|
+
requirement: &70358125575960 !ruby/object:Gem::Requirement
|
65
50
|
none: false
|
66
51
|
requirements:
|
67
52
|
- - ! '>='
|
68
53
|
- !ruby/object:Gem::Version
|
69
|
-
version: 2.1.
|
54
|
+
version: 2.1.13
|
70
55
|
type: :runtime
|
71
56
|
prerelease: false
|
72
|
-
version_requirements:
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ! '>='
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: 2.1.3
|
57
|
+
version_requirements: *70358125575960
|
78
58
|
- !ruby/object:Gem::Dependency
|
79
59
|
name: json
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirement: &70358125575480 !ruby/object:Gem::Requirement
|
81
61
|
none: false
|
82
62
|
requirements:
|
83
63
|
- - ! '>='
|
@@ -85,15 +65,10 @@ dependencies:
|
|
85
65
|
version: 1.6.6
|
86
66
|
type: :runtime
|
87
67
|
prerelease: false
|
88
|
-
version_requirements:
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: 1.6.6
|
68
|
+
version_requirements: *70358125575480
|
94
69
|
- !ruby/object:Gem::Dependency
|
95
70
|
name: broach
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirement: &70358125574980 !ruby/object:Gem::Requirement
|
97
72
|
none: false
|
98
73
|
requirements:
|
99
74
|
- - ! '>='
|
@@ -101,15 +76,10 @@ dependencies:
|
|
101
76
|
version: 0.2.1
|
102
77
|
type: :runtime
|
103
78
|
prerelease: false
|
104
|
-
version_requirements:
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ! '>='
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: 0.2.1
|
79
|
+
version_requirements: *70358125574980
|
110
80
|
- !ruby/object:Gem::Dependency
|
111
81
|
name: highline
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
82
|
+
requirement: &70358125568260 !ruby/object:Gem::Requirement
|
113
83
|
none: false
|
114
84
|
requirements:
|
115
85
|
- - ! '>='
|
@@ -117,12 +87,7 @@ dependencies:
|
|
117
87
|
version: 1.6.11
|
118
88
|
type: :runtime
|
119
89
|
prerelease: false
|
120
|
-
version_requirements:
|
121
|
-
none: false
|
122
|
-
requirements:
|
123
|
-
- - ! '>='
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: 1.6.11
|
90
|
+
version_requirements: *70358125568260
|
126
91
|
description: Deploying applications with Capistrano, Jenkins and GIT.
|
127
92
|
email: support@kunstmaan.be
|
128
93
|
executables:
|
@@ -157,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
122
|
version: '0'
|
158
123
|
requirements: []
|
159
124
|
rubyforge_project:
|
160
|
-
rubygems_version: 1.8.
|
125
|
+
rubygems_version: 1.8.10
|
161
126
|
signing_key:
|
162
127
|
specification_version: 3
|
163
128
|
summary: Deploying applications with Capistrano, Jenkins and GIT.
|