oneblackbear-obbistrano 1.0.14 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.textile CHANGED
@@ -1,23 +1,9 @@
1
1
  h1. Automated Server and application deployment
2
2
 
3
- h2. Server-wide setup
3
+ h2. Application Deploy
4
4
 
5
- @cap host:setup -s h=xxxx@
6
- Ensures that there is a setup for each app on the specified server.
7
- Includes setup of a user, group, apache vhost, mysql login for each app.
8
5
 
9
- @cap host:backup -s h=xxxx@
10
- Trigger a backup of each application stored on the specified server.
11
6
 
12
- @cap host:s3backup -s h=xxxx@
13
- Triggers an Amazon S3 backup of the backup folder.
7
+ h2. Server Initialisation and Setup
14
8
 
15
9
 
16
-
17
- h2. Application Level Setup
18
-
19
- @cap app:deploy -s a=xxxx@
20
-
21
-
22
- cap app:
23
-
@@ -63,7 +63,6 @@ Capistrano::Configuration.instance(:must_exist).load do
63
63
 
64
64
  namespace :app do
65
65
 
66
-
67
66
  task :config_check do
68
67
  config_setup
69
68
  databases rescue set(:databases, ["#{application}"])
@@ -81,7 +80,6 @@ Capistrano::Configuration.instance(:must_exist).load do
81
80
  # DEPLOYING APPLICATIONS
82
81
  # =============================================================================
83
82
 
84
- desc "Uses the specified repository to deploy an application. Also checks for correct versions of PHPWax and plugins."
85
83
  task :deploy do
86
84
  config_check
87
85
  deploy_check
@@ -117,7 +115,8 @@ Capistrano::Configuration.instance(:must_exist).load do
117
115
  run "cd plugins/cms && git init"
118
116
  run "cd plugins/cms && git remote add origin git://github.com:phpwax/wildfire.git"
119
117
  end
120
- run "cd plugins/cms && git checkout #{cms}"
118
+ run "cd plugins/cms && git fetch"
119
+ run "cd plugins/cms && git checkout -b #{cms} origin/#{cms}"
121
120
  end
122
121
 
123
122
  task :php_wax_deploy do
@@ -127,10 +126,9 @@ Capistrano::Configuration.instance(:must_exist).load do
127
126
  run "mkdir wax"
128
127
  run "cd wax && git init"
129
128
  run "cd wax && git remote add origin git://github.com/phpwax/phpwax.git"
130
- run "cd wax && git pull origin master"
131
129
  end
132
- run "cd wax && git checkout #{phpwax}"
133
- run "cd wax && git pull origin #{phpwax}"
130
+ run "cd wax && git fetch"
131
+ run "cd wax && git checkout -b #{phpwax} origin/#{phpwax}"
134
132
  end
135
133
 
136
134
  ####### ##############
@@ -157,134 +155,7 @@ Capistrano::Configuration.instance(:must_exist).load do
157
155
  run "rm -f tmp/log/*"
158
156
  end
159
157
 
160
-
161
- # =============================================================================
162
- # BACKING UP APPLICATIONS
163
- # =============================================================================
164
-
165
- desc "Starts the backup process by checking which type to perform then performs the necessary back ups."
166
- task :backup do
167
- config_check
168
- needs_root
169
- backup_check
170
- end
171
-
172
- task :backup_check do
173
- if defined? "#{repository}"
174
- if repository.include? "git"
175
- git_mysql_backup
176
- upload_only_backup
177
- elsif repository.include? "svn"
178
- standard_mysql_backup
179
- upload_only_backup
180
- end
181
- else
182
- standard_mysql_backup
183
- simple_fs_backup
184
- end
185
- end
186
-
187
- task :simple_fs_backup do
188
- with_user("root", "#{root_pass}") do
189
- run "mkdir -p /backup/#{application}"
190
- run "rsync -avzh /home/#{application}/ /backup/#{application}/"
191
- end
192
- end
193
-
194
- task :upload_only_backup do
195
- with_user("root", "#{root_pass}") do
196
- run "mkdir -p /backup/#{application}"
197
- run "rsync -avzh /home/#{application}/public/files/ /backup/#{application}/"
198
- end
199
- end
200
-
201
- task :standard_mysql_backup do
202
- run "mkdir -p public/files"
203
- databases.each do |db|
204
- run "mysqldump #{db} --skip-comments --add-drop-table -u#{user} -p#{password} > public/files/#{db}.sql";
205
- end
206
- upload_only_backup
207
- end
208
-
209
- task :git_mysql_backup do
210
- transaction do
211
- run "mkdir -p tmp/backup"
212
- run "ln -s ../../.git/ tmp/backup/.git"
213
- begin
214
- run "cd tmp/backup && git branch db"
215
- run "cd tmp/backup && git branch -d db"
216
- rescue
217
- end
218
- run "cd tmp/backup && git symbolic-ref HEAD refs/heads/db"
219
- run "cd tmp/backup && mv .git/index .git/index_old"
220
- databases.each do |db|
221
- run "cd tmp/backup && mysqldump #{db} --skip-comments --add-drop-table -u#{user} -p#{password} > #{db}.sql";
222
- end
223
- run "cd tmp/backup && git add ."
224
- run "cd tmp/backup && git commit -m 'database update'" rescue ""
225
- run "cd tmp/backup && git push origin db"
226
- run "rm -Rf ./tmp/backup"
227
- run "mv -f .git/index_old .git/index" rescue ""
228
- run "git symbolic-ref HEAD refs/heads/#{branch}"
229
- on_rollback do
230
- run "rm -Rf ./tmp/backup"
231
- run "mv -f .git/index_old .git/index" rescue ""
232
- run "git symbolic-ref HEAD refs/heads/#{branch}"
233
- end
234
- end
235
- end
236
-
237
- # =============================================================================
238
- # RESTORING BACKED-UP APPLICATIONS
239
- # =============================================================================
240
-
241
- desc "Restores a backed up application, database and other files."
242
- task :restore do
243
- if defined? repository
244
- if repository.include? "git"
245
- upload_only_restore
246
- git_mysql_restore
247
- elsif repository.include? "svn"
248
- upload_only_restore
249
- standard_mysql_restore
250
- end
251
- else
252
- simple_fs_restore
253
- standard_mysql_restore
254
- end
255
- end
256
-
257
- task :upload_only_restore do
258
- with_user("root", "#{root_pass}") do
259
- run "rsync -avzh /backup/#{application}/ /home/#{application}/public/files/"
260
- end
261
- end
262
-
263
- task :git_mysql_restore do
264
- run "mkdir -p tmp/backup"
265
- run "ln -s ../../ tmp/backup/.git"
266
- run "cd tmp/backup && git symbolic-ref HEAD refs/heads/db"
267
- run "cd tmp/backup && mv .git/index .git/index_old"
268
- "#{databases}".each do |db|
269
- run "cd tmp/backup && mysql #{db} -u#{user} -p#{password} < #{db}.sql"
270
- end
271
- run "rm -Rf ./tmp/backup"
272
- run "mv -f .git/index_old .git/index" rescue ""
273
- run "git symbolic-ref HEAD refs/heads/#{branch}"
274
- end
275
-
276
- desc "Just runs rSync back to the home directory"
277
- task :simple_fs_restore do
278
- with_user("root", "#{root_pass}") do
279
- run "rsync -avzh /backup/#{application}/ /home/#{application}/"
280
- end
281
- end
282
-
283
- task :standard_mysql_restore do
284
- "#{databases}".each do |db|
285
- run "cd tmp/backup && mysql #{db} -u#{user} -p#{password} < public/files/#{db}.sql"
286
- end
287
- end
158
+
288
159
 
289
160
  # =============================================================================
290
161
  # USER AND APPLICATION SETUP AND INITIALISATION
@@ -362,21 +233,6 @@ Capistrano::Configuration.instance(:must_exist).load do
362
233
 
363
234
  end
364
235
 
365
- task :crontab_configuration do
366
- # setup crontab file
367
- crontab_file = render :template => <<-EOF
368
- # WARNING: this file has been automatically setup by the Capistrano script
369
-
370
- # this task will run every hour:
371
- # * */1 * * * root ruby #{deploy_to}/current/script/runner -e production 'Class.method(example)'
372
- EOF
373
-
374
- put crontab_file, "#{deploy_to}/crontab_setup"
375
-
376
- # deploy it by copying over one that exists
377
- run "crontab ./crontab_setup"
378
-
379
- end
380
236
 
381
237
 
382
238
  # =============================================================================
@@ -428,6 +284,14 @@ Capistrano::Configuration.instance(:must_exist).load do
428
284
  sessions.values.each { |session| session.close }
429
285
  sessions.clear
430
286
  end
287
+
288
+
289
+ namespace :deploy do
290
+ desc "Uses the specified repository to deploy an application. Also checks for correct versions of PHPWax and plugins."
291
+ task :default do
292
+ app.deploy
293
+ end
294
+ end
431
295
 
432
296
  end
433
297
 
data/obbistrano.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{obbistrano}
5
- s.version = "1.0.14"
5
+ s.version = "1.0.15"
6
6
  s.authors = ["Ross Riley", "One Black Bear"]
7
7
  s.date = Time.now
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oneblackbear-obbistrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.14
4
+ version: 1.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ross Riley
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-04-02 00:00:00 -07:00
13
+ date: 2009-06-17 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency