whiskey_disk 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +8 -0
- data/README.markdown +56 -3
- data/VERSION +1 -1
- data/examples/deploy-configs.yml +13 -0
- data/lib/whiskey_disk.rb +1 -1
- data/lib/whiskey_disk/config.rb +8 -3
- data/spec/whiskey_disk/config_spec.rb +12 -0
- data/spec/whiskey_disk_spec.rb +7 -6
- data/whiskey_disk.gemspec +3 -2
- metadata +5 -4
data/CHANGELOG
CHANGED
data/README.markdown
CHANGED
@@ -39,7 +39,8 @@ current local checkout.
|
|
39
39
|
- You can separate per-deployment application configuration information (e.g., passwords,
|
40
40
|
database configs, hoptoad/AWS/email config data, etc.) in separate repositories from
|
41
41
|
the application, and whiskey\_disk will merge the correct data onto the deployed
|
42
|
-
application at deployment time.
|
42
|
+
application at deployment time. You can even share sets of configuration files among
|
43
|
+
deployment targets that behave alike.
|
43
44
|
|
44
45
|
- You can have per-developer configurations for targets (especially
|
45
46
|
useful for "local" or "development" targets). Use .gitignore, or
|
@@ -116,6 +117,7 @@ Known config file settings (if you're familiar with capistrano and vlad these sh
|
|
116
117
|
deploy_config_to: where to deploy the configuration repository
|
117
118
|
config_repository: git repository for configuration files
|
118
119
|
config_branch: git branch to deploy from configuration git repo (default: master)
|
120
|
+
config_target: configuration repository target path to use
|
119
121
|
project: project name (used to compute path in configuration checkout)
|
120
122
|
post_deploy_script: path to a shell script to run after deployment
|
121
123
|
post_setup_script: path to a shell script to run after setup
|
@@ -532,11 +534,62 @@ overlaid on top of the most recent checkout of the project. Snap.
|
|
532
534
|
|
|
533
535
|
....
|
534
536
|
|
535
|
-
|
537
|
+
|
538
|
+
#### Sharing a set of configuration files among multiple targets ####
|
539
|
+
|
540
|
+
Developers on applications with many deployment targets can find that configuration repositories can become a burden to maintain, especially when a number of environments share essentially the same configurations. For example, for an application where deployments for user acceptance testing, QA, staging, and feature branch demoing are all essentially the same (though differing from production configurations and developer configurations), it's probably easiest to store a configuration for development, a configuration for production, a configuration for staging and then use the staging configuration for all the other environments: user acceptance testing, QA, staging, demo1, demo2, etc. Using the config\_target setting, a deploy.yml might look like this:
|
541
|
+
|
542
|
+
|
543
|
+
production:
|
544
|
+
domain: "www.ogtastic.com"
|
545
|
+
deploy_to: "/var/www/www.ogtastic.com"
|
546
|
+
repository: "git@ogtastic.com:www.ogtastic.com.git"
|
547
|
+
branch: "production"
|
548
|
+
config_repository: "git@ogtastic.com:ogc-production-config.git"
|
549
|
+
development:
|
550
|
+
deploy_to: '/var/www/devel.ogtastic.com'
|
551
|
+
repository: "git@ogtastic.com:www.ogtastic.com.git"
|
552
|
+
branch: "develop"
|
553
|
+
config_repository: "git@ogtastic.com:ogc-config.git"
|
554
|
+
staging:
|
555
|
+
[...]
|
556
|
+
config_repository: "git@ogtastic.com:ogc-config.git"
|
557
|
+
uat:
|
558
|
+
[....]
|
559
|
+
config_repository: "git@ogtastic.com:ogc-config.git"
|
560
|
+
config_target: "staging"
|
561
|
+
qa:
|
562
|
+
[....]
|
563
|
+
config_repository: "git@ogtastic.com:ogc-config.git"
|
564
|
+
config_target: "staging"
|
565
|
+
|
566
|
+
|
567
|
+
So here we have the 'staging', 'uat', and 'qa' deployment targets all sharing the 'staging' configuration repo information. The non-production configuration repo can then look like:
|
568
|
+
|
569
|
+
|
570
|
+
project-config/
|
571
|
+
|
|
572
|
+
+---ogtastic/
|
573
|
+
|
|
574
|
+
+---staging/
|
575
|
+
| |
|
576
|
+
| |
|
577
|
+
| +---config/
|
578
|
+
| |
|
579
|
+
| ....
|
580
|
+
|
|
581
|
+
+---development/
|
582
|
+
|
|
583
|
+
+---config/
|
584
|
+
|
|
585
|
+
....
|
586
|
+
|
587
|
+
|
588
|
+
Notice that there are no separate trees for 'uat' and 'qa' targets.
|
536
589
|
|
537
590
|
### More Examples: ###
|
538
591
|
|
539
|
-
- We are using
|
592
|
+
- We are using whiskey\_disk to manage larry. See [https://github.com/flogic/larry/blob/master/config/deploy-local.yml.example](https://github.com/flogic/larry/blob/master/config/deploy-local.yml.example) and [http://github.com/flogic/larry/blob/master/lib/tasks/deploy.rake](http://github.com/flogic/larry/blob/master/lib/tasks/deploy.rake)
|
540
593
|
|
541
594
|
- Here is a sample of a lib/tasks/deploy.rake from a Rails application we deployed once upon a time:
|
542
595
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.3
|
@@ -0,0 +1,13 @@
|
|
1
|
+
production:
|
2
|
+
domain: "ogc@hoenir.websages.com"
|
3
|
+
deploy_to: "/tmp/test-deployment"
|
4
|
+
deploy_config_to: "/tmp/test-config"
|
5
|
+
repository: "git@git.ogtastic.com:whiskey_disk.git"
|
6
|
+
config_repository: "git@git.ogtastic.com:ogc-config.git"
|
7
|
+
staging:
|
8
|
+
domain: "ogc@hoenir.websages.com"
|
9
|
+
deploy_to: "/tmp/test-deployment"
|
10
|
+
deploy_config_to: "/tmp/test-config"
|
11
|
+
repository: "git@git.ogtastic.com:whiskey_disk.git"
|
12
|
+
config_repository: "git@git.ogtastic.com:ogc-config.git"
|
13
|
+
config_target: "local"
|
data/lib/whiskey_disk.rb
CHANGED
@@ -230,7 +230,7 @@ class WhiskeyDisk
|
|
230
230
|
def refresh_configuration
|
231
231
|
needs(:deploy_to, :deploy_config_to)
|
232
232
|
raise "Must specify project name when using a configuration repository." unless project_name_specified?
|
233
|
-
enqueue("rsync -av --progress #{self[:deploy_config_to]}/#{self[:project]}/#{self[:
|
233
|
+
enqueue("rsync -av --progress #{self[:deploy_config_to]}/#{self[:project]}/#{self[:config_target]}/ #{self[:deploy_to]}/")
|
234
234
|
end
|
235
235
|
|
236
236
|
def run_post_setup_hooks
|
data/lib/whiskey_disk/config.rb
CHANGED
@@ -143,11 +143,16 @@ class WhiskeyDisk
|
|
143
143
|
end
|
144
144
|
|
145
145
|
def filter_data(data)
|
146
|
-
|
147
|
-
data[
|
146
|
+
current = data[project_name][environment_name]
|
147
|
+
raise "No configuration file defined data for environment [#{environment_name}]" unless current
|
148
|
+
|
149
|
+
current.merge!({
|
148
150
|
'environment' => environment_name,
|
149
|
-
'project' => project_name
|
151
|
+
'project' => project_name,
|
150
152
|
})
|
153
|
+
|
154
|
+
current['config_target'] ||= environment_name
|
155
|
+
current
|
151
156
|
end
|
152
157
|
|
153
158
|
def fetch
|
@@ -159,6 +159,18 @@ describe WhiskeyDisk::Config do
|
|
159
159
|
write_config_file('production' => { 'repository' => 'b'}, 'staging' => staging)
|
160
160
|
WhiskeyDisk::Config.fetch['project'].should == 'diskey_whisk'
|
161
161
|
end
|
162
|
+
|
163
|
+
it 'should include the environment name as the config_target setting when no config_target is specified' do
|
164
|
+
staging = { 'foo' => 'bar', 'repository' => 'xyzzy', 'project' => 'diskey_whisk' }
|
165
|
+
write_config_file('production' => { 'repository' => 'b'}, 'staging' => staging)
|
166
|
+
WhiskeyDisk::Config.fetch['config_target'].should == 'staging'
|
167
|
+
end
|
168
|
+
|
169
|
+
it 'should include the config_target setting when a config_target is specified' do
|
170
|
+
staging = { 'foo' => 'bar', 'repository' => 'xyzzy', 'project' => 'diskey_whisk', 'config_target' => 'testing' }
|
171
|
+
write_config_file('production' => { 'repository' => 'b'}, 'staging' => staging)
|
172
|
+
WhiskeyDisk::Config.fetch['config_target'].should == 'testing'
|
173
|
+
end
|
162
174
|
end
|
163
175
|
|
164
176
|
describe 'returning configuration data from a configuration file' do
|
data/spec/whiskey_disk_spec.rb
CHANGED
@@ -305,6 +305,7 @@ describe 'WhiskeyDisk' do
|
|
305
305
|
'environment' => 'production',
|
306
306
|
'config_repository' => 'git@git://foo.bar.git',
|
307
307
|
'config_branch' => 'master',
|
308
|
+
'config_target' => 'staging',
|
308
309
|
'project' => 'whiskey_disk' }
|
309
310
|
WhiskeyDisk.configuration = @parameters
|
310
311
|
end
|
@@ -313,23 +314,23 @@ describe 'WhiskeyDisk' do
|
|
313
314
|
WhiskeyDisk.configuration = @parameters.merge('deploy_to' => nil)
|
314
315
|
lambda { WhiskeyDisk.refresh_configuration }.should.raise
|
315
316
|
end
|
316
|
-
|
317
|
+
|
317
318
|
it 'should fail if the configuration deployment path is not specified' do
|
318
319
|
WhiskeyDisk.configuration = @parameters.merge('deploy_config_to' => nil)
|
319
320
|
lambda { WhiskeyDisk.refresh_configuration }.should.raise
|
320
321
|
end
|
321
|
-
|
322
|
+
|
322
323
|
it 'should fail if no project name was specified' do
|
323
324
|
WhiskeyDisk.configuration = @parameters.merge('project' => 'unnamed_project')
|
324
325
|
lambda { WhiskeyDisk.refresh_configuration }.should.raise
|
325
326
|
end
|
326
|
-
|
327
|
-
it 'should use rsync to overlay the configuration checkout for the project in the
|
327
|
+
|
328
|
+
it 'should use rsync to overlay the configuration checkout for the project in the config target onto the main checkout' do
|
328
329
|
WhiskeyDisk.refresh_configuration
|
329
|
-
WhiskeyDisk.buffer.last.should.match(%r{rsync.* /path/to/config/repo/whiskey_disk/
|
330
|
+
WhiskeyDisk.buffer.last.should.match(%r{rsync.* /path/to/config/repo/whiskey_disk/staging/ /path/to/main/repo/})
|
330
331
|
end
|
331
332
|
end
|
332
|
-
|
333
|
+
|
333
334
|
describe 'running post setup hooks' do
|
334
335
|
before do
|
335
336
|
WhiskeyDisk.configuration = { 'deploy_to' => '/path/to/main/repo' }
|
data/whiskey_disk.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{whiskey_disk}
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Rick Bradley"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-01-13}
|
13
13
|
s.description = %q{Opinionated gem for doing fast git-based server deployments.}
|
14
14
|
s.email = %q{rick@rickbradley.com}
|
15
15
|
s.executables = ["wd_role", "wd"]
|
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
"WHY.txt",
|
27
27
|
"bin/wd",
|
28
28
|
"bin/wd_role",
|
29
|
+
"examples/deploy-configs.yml",
|
29
30
|
"examples/deploy-local.yml",
|
30
31
|
"examples/deploy-multiple-remotes.yml",
|
31
32
|
"examples/deploy-staging.yml",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whiskey_disk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 3
|
10
|
+
version: 0.6.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Rick Bradley
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-01-13 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- WHY.txt
|
52
52
|
- bin/wd
|
53
53
|
- bin/wd_role
|
54
|
+
- examples/deploy-configs.yml
|
54
55
|
- examples/deploy-local.yml
|
55
56
|
- examples/deploy-multiple-remotes.yml
|
56
57
|
- examples/deploy-staging.yml
|