whiskey_disk 0.6.22 → 0.6.23
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +25 -15
- data/README.integration_specs +24 -36
- data/README.markdown +112 -96
- data/Rakefile +79 -5
- data/VERSION +1 -1
- data/lib/whiskey_disk.rb +297 -294
- data/lib/whiskey_disk/config.rb +99 -168
- data/lib/whiskey_disk/config/abstract_filter.rb +19 -0
- data/lib/whiskey_disk/config/filter.rb +48 -0
- data/lib/whiskey_disk/config/filters/add_environment_name_filter.rb +11 -0
- data/lib/whiskey_disk/config/filters/add_project_name_filter.rb +11 -0
- data/lib/whiskey_disk/config/filters/check_for_duplicate_domains_filter.rb +21 -0
- data/lib/whiskey_disk/config/filters/convert_role_strings_to_list_filter.rb +20 -0
- data/lib/whiskey_disk/config/filters/default_config_target_filter.rb +12 -0
- data/lib/whiskey_disk/config/filters/default_domain_filter.rb +12 -0
- data/lib/whiskey_disk/config/filters/drop_empty_domain_roles_filter.rb +32 -0
- data/lib/whiskey_disk/config/filters/environment_scope_filter.rb +20 -0
- data/lib/whiskey_disk/config/filters/hashify_domain_entries_filter.rb +29 -0
- data/lib/whiskey_disk/config/filters/localize_domains_filter.rb +24 -0
- data/lib/whiskey_disk/config/filters/modules/scope_helper.rb +11 -0
- data/lib/whiskey_disk/config/filters/normalize_ssh_options_filter.rb +29 -0
- data/lib/whiskey_disk/config/filters/project_scope_filter.rb +34 -0
- data/lib/whiskey_disk/config/filters/select_project_and_environment_filter.rb +12 -0
- data/lib/whiskey_disk/config/filters/stringify_hash_keys_filter.rb +25 -0
- data/lib/whiskey_disk/helpers.rb +1 -1
- data/lib/whiskey_disk/rake.rb +25 -22
- data/scenarios/git_repositories/config.git/HEAD +1 -0
- data/scenarios/git_repositories/config.git/config +5 -0
- data/scenarios/git_repositories/config.git/description +1 -0
- data/scenarios/git_repositories/config.git/git-daemon-export-ok +0 -0
- data/scenarios/git_repositories/config.git/hooks/applypatch-msg.sample +15 -0
- data/scenarios/git_repositories/config.git/hooks/commit-msg.sample +24 -0
- data/scenarios/git_repositories/config.git/hooks/post-commit.sample +8 -0
- data/scenarios/git_repositories/config.git/hooks/post-receive.sample +15 -0
- data/scenarios/git_repositories/config.git/hooks/post-update.sample +8 -0
- data/scenarios/git_repositories/config.git/hooks/pre-applypatch.sample +14 -0
- data/scenarios/git_repositories/config.git/hooks/pre-commit.sample +46 -0
- data/scenarios/git_repositories/config.git/hooks/pre-rebase.sample +169 -0
- data/scenarios/git_repositories/config.git/hooks/prepare-commit-msg.sample +36 -0
- data/scenarios/git_repositories/config.git/hooks/update.sample +128 -0
- data/scenarios/git_repositories/config.git/info/exclude +6 -0
- data/scenarios/git_repositories/config.git/objects/0d/b14dd6ddc54017c0a11960dcda82ed802cde69 +0 -0
- data/scenarios/git_repositories/config.git/objects/0e/e781f5ce80d64db32a74a7aae7b5248dafe112 +3 -0
- data/scenarios/git_repositories/config.git/objects/17/6bf54cf17d1d1c24556dc059c4144a5df230e8 +0 -0
- data/scenarios/git_repositories/config.git/objects/20/e9ff3feaa8ede30f707e5f1b4356e3c02bb7ec +0 -0
- data/scenarios/git_repositories/config.git/objects/45/117b1c775f0de415478dbf08ed9d667ab17d13 +0 -0
- data/scenarios/git_repositories/config.git/objects/51/3954c9aca090e6ce40359f0e9fde30ea78eb8c +0 -0
- data/scenarios/git_repositories/config.git/objects/66/947a7a11a6f5d3d561fe95de284ced3010819a +0 -0
- data/scenarios/git_repositories/config.git/objects/6b/bc79311bfac47d3ed724aa82a4814e0dda4c67 +0 -0
- data/scenarios/git_repositories/config.git/objects/71/eb5df52676e8e6efba471050b46978173af110 +1 -0
- data/scenarios/git_repositories/config.git/objects/84/17d2fe3e8fcc0825249c517b29b0f9ea8b8b31 +2 -0
- data/scenarios/git_repositories/config.git/objects/8b/384fcfcf7c0dee7c3c1d5636bee9e645d9cf38 +0 -0
- data/scenarios/git_repositories/config.git/objects/bb/59da633ba74296b0c2f9ff70784ac155ddb599 +0 -0
- data/scenarios/git_repositories/config.git/objects/cc/b86b26189afbf45d8eb9165812ab86dbdfca63 +0 -0
- data/scenarios/git_repositories/config.git/objects/d1/0bcd51fec41f854001e4d61f99d9e282a695d3 +0 -0
- data/scenarios/git_repositories/config.git/objects/d8/a8b0f5b1fd66844efb141d9544965ea0065f2d +0 -0
- data/scenarios/git_repositories/config.git/objects/e6/b02c66ad632e6b8535c4630cb8fe07732a72fc +0 -0
- data/scenarios/git_repositories/config.git/objects/e8/b8bfeeba735c0a1a873082554cb4d7256ac125 +0 -0
- data/scenarios/git_repositories/config.git/objects/f9/0181466a1a60b793ca9cc9abd584c18d4e3887 +0 -0
- data/scenarios/git_repositories/config.git/objects/f9/49d5d8a4f12c91471e34d4e277239c35ebd10d +0 -0
- data/scenarios/git_repositories/config.git/refs/heads/master +1 -0
- data/scenarios/git_repositories/project.git/HEAD +1 -0
- data/scenarios/git_repositories/project.git/config +5 -0
- data/scenarios/git_repositories/project.git/description +1 -0
- data/scenarios/git_repositories/project.git/git-daemon-export-ok +0 -0
- data/scenarios/git_repositories/project.git/hooks/applypatch-msg.sample +15 -0
- data/scenarios/git_repositories/project.git/hooks/commit-msg.sample +24 -0
- data/scenarios/git_repositories/project.git/hooks/post-commit.sample +8 -0
- data/scenarios/git_repositories/project.git/hooks/post-receive.sample +15 -0
- data/scenarios/git_repositories/project.git/hooks/post-update.sample +8 -0
- data/scenarios/git_repositories/project.git/hooks/pre-applypatch.sample +14 -0
- data/scenarios/git_repositories/project.git/hooks/pre-commit.sample +46 -0
- data/scenarios/git_repositories/project.git/hooks/pre-rebase.sample +169 -0
- data/scenarios/git_repositories/project.git/hooks/prepare-commit-msg.sample +36 -0
- data/scenarios/git_repositories/project.git/hooks/update.sample +128 -0
- data/scenarios/git_repositories/project.git/info/exclude +6 -0
- data/scenarios/git_repositories/project.git/objects/04/26e152e66c8cd42974279bdcae09be9839c172 +0 -0
- data/scenarios/git_repositories/project.git/objects/04/f4de85eaf72ef1631dc6d7424045c0a749b757 +1 -0
- data/scenarios/git_repositories/project.git/objects/06/13fe277280cbcdb2856e1eefc70bdaff011b20 +0 -0
- data/scenarios/git_repositories/project.git/objects/06/7aca89b86265eee211387434c3e50f37ccf009 +0 -0
- data/scenarios/git_repositories/project.git/objects/09/445dacc4822722612d60833c9948219ecdd8f5 +0 -0
- data/scenarios/git_repositories/project.git/objects/11/c4ec64326de35462f4e79d0f4229bf8e26e0c5 +0 -0
- data/scenarios/git_repositories/project.git/objects/20/1c7641c2e42b0b904e5c1f793489d8b858e4da +2 -0
- data/scenarios/git_repositories/project.git/objects/23/979639da60d2d31e9744468df1c1221b101e64 +0 -0
- data/scenarios/git_repositories/project.git/objects/27/a3fff2c4c45ab5513a405f694c0a042cb5d417 +1 -0
- data/scenarios/git_repositories/project.git/objects/2c/0c33cfba8e1af15df88522c0db2b10a6a94138 +2 -0
- data/scenarios/git_repositories/project.git/objects/38/b574660305ecb5fec6b2daa7ee1e0dbf1b6003 +0 -0
- data/scenarios/git_repositories/project.git/objects/4a/57abb5e4e426cfc9101b3af22ac83ccbd8e2ad +0 -0
- data/scenarios/git_repositories/project.git/objects/4c/77ebdd985e57afe7988480720c5dc77ec525c9 +0 -0
- data/scenarios/git_repositories/project.git/objects/51/c94da6f1b8aa9d2346088d3d362475b60c7f32 +0 -0
- data/scenarios/git_repositories/project.git/objects/5b/a96acf9cc9b87babe37c032676f53bf1ba9ae7 +2 -0
- data/scenarios/git_repositories/project.git/objects/5d/f555601d60f1c2a84d2364af0ad640612c3ba5 +0 -0
- data/scenarios/git_repositories/project.git/objects/71/03b5ac94940d596c2160a5cfcd55ca4ccac41f +0 -0
- data/scenarios/git_repositories/project.git/objects/73/3fc331098b03523f414f3509b9ae6e637c6866 +0 -0
- data/scenarios/git_repositories/project.git/objects/80/26076649ceccbe96a6292f2432652f08483035 +0 -0
- data/scenarios/git_repositories/project.git/objects/86/d1ef0976be4567de562224e1b51fbf9820c53a +1 -0
- data/scenarios/git_repositories/project.git/objects/87/a9d8b09b3401d21b23d90253332d6b28b47db2 +0 -0
- data/scenarios/git_repositories/project.git/objects/8b/030ba688255c917d189ae3f87d7c5ccd226bc2 +0 -0
- data/scenarios/git_repositories/project.git/objects/95/c9d5ad9b1c90e4c805516783105fc2037dedeb +2 -0
- data/scenarios/git_repositories/project.git/objects/95/d82d043af35a80eabfd56c0d705abfa3488787 +2 -0
- data/scenarios/git_repositories/project.git/objects/96/0bf34bb0b46d0aeb0be87f688f4ef06a4b35e1 +0 -0
- data/scenarios/git_repositories/project.git/objects/a3/860106dc1d148c7831cd45ae38829b4ed47702 +2 -0
- data/scenarios/git_repositories/project.git/objects/a8/506d6439b71784a72ac72d284b2ad53088f573 +0 -0
- data/scenarios/git_repositories/project.git/objects/ad/22ea6c7563777936ecfbe50d8e2cf8120fd525 +0 -0
- data/scenarios/git_repositories/project.git/objects/ae/3900de54aff557c61c81146d00f9d38e55a265 +1 -0
- data/scenarios/git_repositories/project.git/objects/bf/5e3740d52b80abb0378b3f85f93a53b1294521 +1 -0
- data/scenarios/git_repositories/project.git/objects/bf/b59811cdbc069418dee14b171e6e7e979784b7 +0 -0
- data/scenarios/git_repositories/project.git/objects/cc/5ac0afb24e727d5de344cc26a425f4fb7fd17d +3 -0
- data/scenarios/git_repositories/project.git/objects/d1/091aa2dd76885108461110c639e6b33a297fce +0 -0
- data/scenarios/git_repositories/project.git/objects/d8/913f6650eb2b7bf2a633732d8452008ca23dcb +0 -0
- data/scenarios/git_repositories/project.git/objects/db/d1b9667f1b26b13331ac0c321dced8be1aeab0 +3 -0
- data/scenarios/git_repositories/project.git/objects/e4/3b9107e9b1908ce415025e64eb83a493d329b7 +0 -0
- data/scenarios/git_repositories/project.git/objects/ef/2a88894d5421920b9dfe67a9a4d8043830e62e +0 -0
- data/scenarios/git_repositories/project.git/objects/f4/0123a1ff20c65d8dc15a38a83222647908e6f7 +0 -0
- data/scenarios/git_repositories/project.git/objects/f5/0af315b75ca0b12c720dec6d916b76b968c319 +0 -0
- data/scenarios/git_repositories/project.git/objects/f6/0215709b7b23f3738e9cbaf634b1c86bbd376a +0 -0
- data/scenarios/git_repositories/project.git/refs/heads/bad_rakefile +1 -0
- data/scenarios/git_repositories/project.git/refs/heads/hook_with_changed +1 -0
- data/scenarios/git_repositories/project.git/refs/heads/master +1 -0
- data/scenarios/git_repositories/project.git/refs/heads/no_rake_hooks +1 -0
- data/scenarios/git_repositories/project.git/refs/heads/post_rake_tasks +1 -0
- data/scenarios/invalid/deploy.yml +1 -0
- data/scenarios/local/deploy.yml.erb +17 -0
- data/scenarios/remote/deploy.yml +119 -0
- data/scenarios/setup/vagrant/.gitignore +3 -0
- data/scenarios/setup/vagrant/Vagrantfile +10 -0
- data/scenarios/setup/vagrant/manifests/integration.pp +32 -0
- data/scenarios/setup/vagrant/pids/.gitignore +1 -0
- data/spec/init_spec.rb +1 -1
- data/spec/install_spec.rb +4 -4
- data/spec/integration/branch_switching_spec.rb +41 -0
- data/spec/integration/deployment_failures_spec.rb +106 -0
- data/spec/integration/helper_spec.rb +90 -0
- data/spec/integration/invalid_configuration_spec.rb +39 -0
- data/spec/integration/local_deployments_spec.rb +230 -0
- data/spec/integration/post_rake_tasks_spec.rb +226 -0
- data/spec/integration/post_scripts_spec.rb +246 -0
- data/spec/integration/remote_deployments_spec.rb +166 -0
- data/spec/integration/staleness_checks_spec.rb +72 -0
- data/spec/spec_helper.rb +30 -2
- data/spec/wd_command_spec.rb +136 -136
- data/spec/wd_role_command_spec.rb +5 -5
- data/spec/whiskey_disk/config/filter_spec.rb +77 -0
- data/spec/whiskey_disk/config/filters/add_environment_name_filter_spec.rb +20 -0
- data/spec/whiskey_disk/config/filters/add_project_name_filter_spec.rb +19 -0
- data/spec/whiskey_disk/config/filters/check_for_duplicate_domains_filter_spec.rb +29 -0
- data/spec/whiskey_disk/config/filters/convert_role_strings_to_list_filter_spec.rb +48 -0
- data/spec/whiskey_disk/config/filters/default_config_target_filter_spec.rb +19 -0
- data/spec/whiskey_disk/config/filters/default_domain_filter_spec.rb +18 -0
- data/spec/whiskey_disk/config/filters/drop_empty_domain_roles_filter_spec.rb +60 -0
- data/spec/whiskey_disk/config/filters/environment_scope_filter_spec.rb +32 -0
- data/spec/whiskey_disk/config/filters/hashify_domain_entries_filter_spec.rb +41 -0
- data/spec/whiskey_disk/config/filters/localize_domains_filter_spec.rb +30 -0
- data/spec/whiskey_disk/config/filters/normalize_ssh_options_filter_spec.rb +56 -0
- data/spec/whiskey_disk/config/filters/project_scope_filter_spec.rb +75 -0
- data/spec/whiskey_disk/config/filters/select_project_and_environment_filter_spec.rb +30 -0
- data/spec/whiskey_disk/config/filters/stringify_hash_keys_filter_spec.rb +40 -0
- data/spec/whiskey_disk/config_spec.rb +259 -446
- data/spec/whiskey_disk/helpers_spec.rb +51 -51
- data/spec/whiskey_disk/rake_spec.rb +80 -80
- data/spec/whiskey_disk_spec.rb +591 -562
- data/whiskey_disk.gemspec +151 -20
- metadata +151 -18
data/CHANGELOG
CHANGED
@@ -1,11 +1,21 @@
|
|
1
1
|
|
2
|
-
0.6.
|
2
|
+
0.6.23 / 2011-09-29
|
3
|
+
==================
|
4
|
+
|
5
|
+
* Fix incompatibility with latest jeweler (Rakefile error messages) [James Cox (imajes)]
|
6
|
+
* We now use vagrant for integration specs.
|
7
|
+
* Make rsync_changes more robust
|
8
|
+
* Add ERB support to YAML files used in integration specs
|
9
|
+
* add per-domain ssh_options support to config files
|
10
|
+
* Big refactoring of config handling into a filter stream architecture
|
11
|
+
|
12
|
+
0.6.22 / 2011-04-10
|
3
13
|
==================
|
4
14
|
|
5
15
|
* support branch-switching on deployments
|
6
16
|
* added integration spec for "branch switching" behavior
|
7
17
|
|
8
|
-
0.6.21 / 2011-04-06
|
18
|
+
0.6.21 / 2011-04-06
|
9
19
|
==================
|
10
20
|
|
11
21
|
* change rsync changes capturing mechanism to be more portable
|
@@ -14,7 +24,7 @@
|
|
14
24
|
* deploy.yml to test rsync changes w/ config repo
|
15
25
|
* integration spec project and config changes to stored git repos
|
16
26
|
|
17
|
-
0.6.20 / 2011-04-06
|
27
|
+
0.6.20 / 2011-04-06
|
18
28
|
==================
|
19
29
|
|
20
30
|
* Output the entire command before running it when debugging.
|
@@ -48,7 +58,7 @@
|
|
48
58
|
* README updates for #changed? helper functionality
|
49
59
|
|
50
60
|
|
51
|
-
0.6.17 / 2011-03-25
|
61
|
+
0.6.17 / 2011-03-25
|
52
62
|
==================
|
53
63
|
|
54
64
|
* updating contributor info in README
|
@@ -76,7 +86,7 @@
|
|
76
86
|
* Add support section to README
|
77
87
|
|
78
88
|
|
79
|
-
0.6.16 / 2011-03-08
|
89
|
+
0.6.16 / 2011-03-08
|
80
90
|
==================
|
81
91
|
|
82
92
|
* Turning off shallow clones for 'wd setup'
|
@@ -85,7 +95,7 @@
|
|
85
95
|
* adding integration specs to test setup + deploy at once
|
86
96
|
* tweaking a couple of old path specs
|
87
97
|
|
88
|
-
0.6.15 / 2011-03-07
|
98
|
+
0.6.15 / 2011-03-07
|
89
99
|
==================
|
90
100
|
|
91
101
|
* integration specs for "git checkout #{branch}" functionality
|
@@ -93,12 +103,12 @@
|
|
93
103
|
* Adding current_branch integration spec helper method
|
94
104
|
* Ensure specified branch is checked out before applying the refresh
|
95
105
|
|
96
|
-
0.6.14 / 2011-02-23
|
106
|
+
0.6.14 / 2011-02-23
|
97
107
|
==================
|
98
108
|
|
99
109
|
* forcing bash as the execution shell
|
100
110
|
|
101
|
-
0.6.13 / 2011-02-20
|
111
|
+
0.6.13 / 2011-02-20
|
102
112
|
==================
|
103
113
|
|
104
114
|
* pass rake_env settings to post_* scripts
|
@@ -107,7 +117,7 @@
|
|
107
117
|
* basic integration specs for post_* scripts
|
108
118
|
* updating integration spec git repo data
|
109
119
|
|
110
|
-
0.6.12 / 2011-02-20
|
120
|
+
0.6.12 / 2011-02-20
|
111
121
|
==================
|
112
122
|
|
113
123
|
* bad Rakefile should cause deployment to fail
|
@@ -115,13 +125,13 @@
|
|
115
125
|
* new scenarios to use when testing post_* rake hooks
|
116
126
|
* adding a dump_log helper to use when developing integration specs
|
117
127
|
|
118
|
-
0.6.11 / 2011-02-18
|
128
|
+
0.6.11 / 2011-02-18
|
119
129
|
==================
|
120
130
|
|
121
131
|
* Generate an error message when we can't find --to proj/env in a config
|
122
132
|
* Fixing typo in an integration spec's example text
|
123
133
|
|
124
|
-
0.6.10 / 2011-02-08
|
134
|
+
0.6.10 / 2011-02-08
|
125
135
|
==================
|
126
136
|
|
127
137
|
* reorganizing integration specs
|
@@ -143,17 +153,17 @@
|
|
143
153
|
* WhiskeyDisk.remote? now takes a domain argument
|
144
154
|
* can now specify path to deploy.yml info using an URL
|
145
155
|
|
146
|
-
0.6.4 / 2011-01-26
|
156
|
+
0.6.4 / 2011-01-26
|
147
157
|
==================
|
148
158
|
|
149
159
|
* bugfix: cd to deploy_to path before running post_{setup,deploy}_script
|
150
160
|
|
151
|
-
0.6.3 / 2011-01-13
|
161
|
+
0.6.3 / 2011-01-13
|
152
162
|
==================
|
153
163
|
|
154
164
|
* adding support for config_target in deploy.yml
|
155
165
|
|
156
|
-
0.6.2 / 2010-12-23
|
166
|
+
0.6.2 / 2010-12-23
|
157
167
|
==================
|
158
168
|
|
159
169
|
* update multiple deployment example to use roles
|
@@ -168,7 +178,7 @@
|
|
168
178
|
* reordering domain config spec setup data structure for readability
|
169
179
|
|
170
180
|
|
171
|
-
0.6.0 / 2010-12-22
|
181
|
+
0.6.0 / 2010-12-22
|
172
182
|
==================
|
173
183
|
|
174
184
|
* adding a set of multi-domain examples
|
data/README.integration_specs
CHANGED
@@ -1,36 +1,24 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
user% ssh user@wd-app2.example.com ( ditto )
|
26
|
-
^D
|
27
|
-
|
28
|
-
then, as user, git clone whiskey_disk from github or ln -s to an already checked out version
|
29
|
-
(which is what I usually do)
|
30
|
-
|
31
|
-
- run git-daemon:
|
32
|
-
user% cd git/whiskey_disk
|
33
|
-
user% git daemon --base-path=`pwd`/scenarios/git_repositories/ --reuseaddr --verbose &
|
34
|
-
|
35
|
-
user% export INTEGRATION=true
|
36
|
-
user% rake
|
1
|
+
Running Integration Specs
|
2
|
+
-------------------------
|
3
|
+
|
4
|
+
To run the integration spec suite you need to be able to run a Vagrant virtual machine (see: http://vagrantup.com/), which means you will have to have VirtualBox installed. The Vagrant/VirtualBox setup is currently out of the scope of this document. By default, I have been using the lucid32 box as my "base" box.
|
5
|
+
|
6
|
+
Once you are set up to be able to run Vagrant, you can create and start up an integration environment by running the following rake task:
|
7
|
+
|
8
|
+
% rake integration:up
|
9
|
+
|
10
|
+
This will create a vagrant VM, and so may take a few minutes to complete.
|
11
|
+
|
12
|
+
|
13
|
+
To run the integration specs once the integration environment is up:
|
14
|
+
|
15
|
+
% export INTEGRATION=true
|
16
|
+
% rake
|
17
|
+
|
18
|
+
To shut down the integration VM and the integration git-daemon server:
|
19
|
+
|
20
|
+
% rake integration:down
|
21
|
+
|
22
|
+
To completely remove the integration spec VM (which can take up a good bit of space on disk), do:
|
23
|
+
|
24
|
+
% rake integration:destroy
|
data/README.markdown
CHANGED
@@ -5,7 +5,7 @@ A very opinionated deployment tool, designed to be as fast as technologically po
|
|
5
5
|
|
6
6
|
Right-arrow through a short whiskey_disk presentation at [http://wd2010.rickbradley.com/](http://wd2010.rickbradley.com) (slide source available [here](http://github.com/rick/whiskey_disk_presentation).), covering the 0.2.*-era functionality.
|
7
7
|
|
8
|
-
You can also right-arrow through a shorter but more up-to-date whiskey_disk "lightning talk" presentation
|
8
|
+
You can also right-arrow through a shorter but more up-to-date whiskey_disk "lightning talk" presentation
|
9
9
|
(from the 2010 Ruby Hoedown) at [http://wdlightning.rickbradley.com/](http://wdlightning.rickbradley.com) (slide source available [here](http://github.com/rick/whiskey_disk_presentation/tree/lightning).), covering the 0.4.*-era functionality.
|
10
10
|
|
11
11
|
### tl;dr ###
|
@@ -23,7 +23,7 @@ Then make a deploy.yml file (in config/ if you're doing a Rails project):
|
|
23
23
|
repository: "https://github.com/username/project.git"
|
24
24
|
branch: "staging"
|
25
25
|
rake_env:
|
26
|
-
RAILS_ENV: 'production'
|
26
|
+
RAILS_ENV: 'production'
|
27
27
|
|
28
28
|
then:
|
29
29
|
|
@@ -62,9 +62,9 @@ current local checkout.
|
|
62
62
|
- You can do multi-project deployments, specifying deployment data in a single
|
63
63
|
deploy.yml config file, or keep an entire directory of project deployment config files.
|
64
64
|
|
65
|
-
- You can separate per-deployment application configuration information (e.g., passwords,
|
66
|
-
database configs, hoptoad/AWS/email config data, etc.) in separate repositories from
|
67
|
-
the application, and whiskey\_disk will merge the correct data onto the deployed
|
65
|
+
- You can separate per-deployment application configuration information (e.g., passwords,
|
66
|
+
database configs, hoptoad/AWS/email config data, etc.) in separate repositories from
|
67
|
+
the application, and whiskey\_disk will merge the correct data onto the deployed
|
68
68
|
application at deployment time. You can even share sets of configuration files among
|
69
69
|
deployment targets that behave alike.
|
70
70
|
|
@@ -73,9 +73,9 @@ current local checkout.
|
|
73
73
|
specify a config_branch and everyone can have their own local setup that just
|
74
74
|
works.
|
75
75
|
|
76
|
-
- There's no before\_after\_before_after hooks. You can use a well-defined rake hook and/or a
|
76
|
+
- There's no before\_after\_before_after hooks. You can use a well-defined rake hook and/or a
|
77
77
|
bash script to run additional tasks.
|
78
|
-
|
78
|
+
|
79
79
|
- You can enable "staleness checks" so that deployments only happen if
|
80
80
|
either the main repo, or the config repo (if you're using one) has
|
81
81
|
changes that are newer than what is currently deployed.
|
@@ -85,10 +85,10 @@ current local checkout.
|
|
85
85
|
deployment branch of choice!
|
86
86
|
|
87
87
|
- You can deploy to multiple remote targets at once. Currently this is limited
|
88
|
-
to one-after-the-other synchronous deployments, but we're thinking about
|
88
|
+
to one-after-the-other synchronous deployments, but we're thinking about
|
89
89
|
doing them in parallel once we're happy with the stability of this feature.
|
90
90
|
|
91
|
-
- Assign hosts to roles (e.g., "web", "db", "app") and vary the shell or rake
|
91
|
+
- Assign hosts to roles (e.g., "web", "db", "app") and vary the shell or rake
|
92
92
|
post-setup/post-deploy actions you run based on those roles.
|
93
93
|
|
94
94
|
- Limit the actions you run after deployment based on whether files of interest
|
@@ -104,14 +104,14 @@ current local checkout.
|
|
104
104
|
|
105
105
|
### Dependencies ###
|
106
106
|
|
107
|
-
On the server from which the whiskey_disk process will be kicked off:
|
107
|
+
On the server from which the whiskey_disk process will be kicked off:
|
108
108
|
|
109
109
|
- ruby
|
110
110
|
- rake
|
111
111
|
- whiskey\_disk
|
112
|
-
- ssh (if doing a remote deployment).
|
112
|
+
- ssh (if doing a remote deployment).
|
113
113
|
|
114
|
-
On the deployment target server (which may be the same as the first server):
|
114
|
+
On the deployment target server (which may be the same as the first server):
|
115
115
|
|
116
116
|
- a bash-compatible shell
|
117
117
|
- rsync (only if using a configuration repository)
|
@@ -136,7 +136,7 @@ As a rails plugin:
|
|
136
136
|
- config files are YAML, with a section for each target.
|
137
137
|
|
138
138
|
Known config file settings (if you're familiar with capistrano and vlad these should seem eerily familiar):
|
139
|
-
|
139
|
+
|
140
140
|
domain: host or list of hosts on which to deploy (these are ssh connect strings)
|
141
141
|
can also optionally include role information for each host
|
142
142
|
deploy_to: path to which to deploy main application
|
@@ -153,7 +153,7 @@ Known config file settings (if you're familiar with capistrano and vlad these sh
|
|
153
153
|
|
154
154
|
|
155
155
|
A simple config/deploy.yml might look like:
|
156
|
-
|
156
|
+
|
157
157
|
qa:
|
158
158
|
domain: "ogc@qa.ogtastic.com"
|
159
159
|
deploy_to: "/var/www/www.ogtastic.com"
|
@@ -217,6 +217,18 @@ You can even include a local deployment along with remote deployments, simply us
|
|
217
217
|
RAILS_ENV: 'production'
|
218
218
|
|
219
219
|
|
220
|
+
If you need special flags passed to ssh for a given domain, specify an array of `ssh_options` flags:
|
221
|
+
|
222
|
+
qa:
|
223
|
+
domain:
|
224
|
+
- name: "ogc@qa.ogtastic.com"
|
225
|
+
ssh_options:
|
226
|
+
- "-t"
|
227
|
+
- "-vv"
|
228
|
+
- "-p 443"
|
229
|
+
deploy_to: "/var/www/www.ogtastic.com"
|
230
|
+
repository: "git@ogtastic.com:www.ogtastic.com.git"
|
231
|
+
|
220
232
|
### Specifying domains, with or without roles ###
|
221
233
|
|
222
234
|
There are a number of ways to specify domains (the ssh connection strings denoting the hosts
|
@@ -230,7 +242,7 @@ Just a single domain:
|
|
230
242
|
Just a single domain, but specified as a one-item list:
|
231
243
|
|
232
244
|
qa:
|
233
|
-
domain:
|
245
|
+
domain:
|
234
246
|
- "foo@qa.example.com"
|
235
247
|
|
236
248
|
A list of multiple domains:
|
@@ -249,7 +261,7 @@ otherwise it's optional and superfluous):
|
|
249
261
|
- name: "build@ci.example.com"
|
250
262
|
|
251
263
|
It's also possible to assign various "roles" to the domains to which you deploy. Some common usages would be
|
252
|
-
"www", which might need a post\_deploy task which notifies some web server software (apache, nginx, passenger,
|
264
|
+
"www", which might need a post\_deploy task which notifies some web server software (apache, nginx, passenger,
|
253
265
|
unicorn, etc.) that it should refresh the contents being served; or perhaps "db", which might need some set of
|
254
266
|
post-deployment database migrations run (and which shouldn't be run from multiple servers).
|
255
267
|
|
@@ -273,7 +285,7 @@ While multiple roles for a domain must be specified as a list:
|
|
273
285
|
production:
|
274
286
|
domain:
|
275
287
|
- name: "foo@appserver1.example.com"
|
276
|
-
roles:
|
288
|
+
roles:
|
277
289
|
- "web"
|
278
290
|
- "app"
|
279
291
|
- "db"
|
@@ -285,7 +297,7 @@ But domains with roles can be specified alongside simple domains as well:
|
|
285
297
|
- name: "bar@demo.example.com"
|
286
298
|
- "user@otherhost.domain.com"
|
287
299
|
- name: "foo@appserver1.example.com"
|
288
|
-
roles:
|
300
|
+
roles:
|
289
301
|
- "web"
|
290
302
|
- "app"
|
291
303
|
- "db"
|
@@ -296,7 +308,7 @@ And, if you need to assign roles for a local deployment, you can do that as well
|
|
296
308
|
local:
|
297
309
|
domain:
|
298
310
|
- name: "local"
|
299
|
-
roles:
|
311
|
+
roles:
|
300
312
|
- "web"
|
301
313
|
- "app"
|
302
314
|
- "db"
|
@@ -309,22 +321,22 @@ All that said, it's often simpler to refrain from carving up hosts into roles.
|
|
309
321
|
### post\_deploy\_script and post\_setup\_script ###
|
310
322
|
|
311
323
|
Whiskey\_disk provides rake task hooks (deploy:post\_setup and deploy:post\_deploy) to allow running custom
|
312
|
-
code after setup or deployment. There are situations where it is desirable to run some commands prior to
|
324
|
+
code after setup or deployment. There are situations where it is desirable to run some commands prior to
|
313
325
|
running those rake tasks (e.g., if using bundler and needing to do a 'bundle install' before running rake).
|
314
326
|
It may also be the case that the target system doesn't have rake (and/or ruby) installed, but some post-setup
|
315
327
|
or post-deploy operations need to happen. For these reasons, whiskey\_disk allows specifying a (bash-compatible)
|
316
328
|
shell script to run after setup and/or deployment via the post\_deploy\_script and post\_setup\_script settings
|
317
|
-
in the configuration file. These scripts, when specified, are run immediately before running the deploy:post\_setup
|
329
|
+
in the configuration file. These scripts, when specified, are run immediately before running the deploy:post\_setup
|
318
330
|
or deploy:post\_deploy rake tasks, if they are present.
|
319
331
|
|
320
332
|
The paths provided to post\_deploy\_script and post\_setup\_script can be either absolute or relative. A path
|
321
|
-
starting with a '/' is an absolute path, and the script specified should be at that exact location on the
|
333
|
+
starting with a '/' is an absolute path, and the script specified should be at that exact location on the
|
322
334
|
target filesystem. A path which does not start with a '/' is a relative path, and the script specified should
|
323
|
-
be located at the specified path under the deployed application path. This implies that it's possible to
|
335
|
+
be located at the specified path under the deployed application path. This implies that it's possible to
|
324
336
|
manage post\_setup and post\_deploy scripts out of a configuration repository.
|
325
337
|
|
326
338
|
A config/deploy.yml using post\_deploy\_script and post\_setup\_script might look like this:
|
327
|
-
|
339
|
+
|
328
340
|
production:
|
329
341
|
domain: "ogc@www.ogtastic.com"
|
330
342
|
deploy_to: "/var/www/www.ogtastic.com"
|
@@ -335,7 +347,7 @@ A config/deploy.yml using post\_deploy\_script and post\_setup\_script might loo
|
|
335
347
|
rake_env:
|
336
348
|
RAILS_ENV: 'production'
|
337
349
|
|
338
|
-
The post\_deploy\_script will be run from /var/www/www.ogtastic.com/bin/post-deploy.sh on the
|
350
|
+
The post\_deploy\_script will be run from /var/www/www.ogtastic.com/bin/post-deploy.sh on the
|
339
351
|
target system.
|
340
352
|
|
341
353
|
|
@@ -356,10 +368,10 @@ role. For example:
|
|
356
368
|
Dir.chdir(RAILS_ROOT)
|
357
369
|
system("mkdir -p log tmp")
|
358
370
|
end
|
359
|
-
end
|
371
|
+
end
|
360
372
|
|
361
373
|
task :db_migrate_if_necessary do
|
362
|
-
|
374
|
+
Rake::Task['db:migrate'] if role? :db
|
363
375
|
end
|
364
376
|
|
365
377
|
# whytf is this even necessary? Come on. This should be built into ts:restart.
|
@@ -370,17 +382,17 @@ role. For example:
|
|
370
382
|
Rake::Task['ts:start'].invoke
|
371
383
|
end
|
372
384
|
end
|
373
|
-
|
385
|
+
|
374
386
|
task :bounce_passenger do
|
375
387
|
if role? :www
|
376
388
|
puts "restarting Passenger web server"
|
377
389
|
Dir.chdir(RAILS_ROOT)
|
378
|
-
system("touch tmp/restart.txt")
|
390
|
+
system("touch tmp/restart.txt")
|
379
391
|
end
|
380
392
|
end
|
381
393
|
|
382
394
|
# etc...
|
383
|
-
|
395
|
+
|
384
396
|
task :post_setup => [ :create_rails_directories ]
|
385
397
|
task :post_deploy => [ :db_migrate_if_necessary, :thinking_sphinx_restart, :bounce_passenger ]
|
386
398
|
end
|
@@ -399,36 +411,36 @@ are in an environment where the 'app' role is active but the 'web' role is not:
|
|
399
411
|
|
400
412
|
|
401
413
|
$ wd_role web && rock || shocker
|
402
|
-
.-.
|
403
|
-
.-.U|
|
404
|
-
|U| | .-.
|
405
|
-
| | |_|U|
|
406
|
-
| | | | |
|
414
|
+
.-.
|
415
|
+
.-.U|
|
416
|
+
|U| | .-.
|
417
|
+
| | |_|U|
|
418
|
+
| | | | |
|
407
419
|
/| ` |
|
408
|
-
| | |
|
409
|
-
| |
|
410
|
-
\ /
|
411
|
-
| |
|
412
|
-
| |
|
413
|
-
|
420
|
+
| | |
|
421
|
+
| |
|
422
|
+
\ /
|
423
|
+
| |
|
424
|
+
| |
|
425
|
+
|
414
426
|
$ wd_role app && rock || shocker
|
415
|
-
.-.
|
416
|
-
|U|
|
417
|
-
| | .-.
|
418
|
-
| |-._|U|
|
419
|
-
| | | | |
|
420
|
-
/| ` |
|
421
|
-
| | |
|
422
|
-
| |
|
423
|
-
/
|
424
|
-
| |
|
425
|
-
| |
|
426
|
-
|
427
|
+
.-.
|
428
|
+
|U|
|
429
|
+
| | .-.
|
430
|
+
| |-._|U|
|
431
|
+
| | | | |
|
432
|
+
/| ` |
|
433
|
+
| | |
|
434
|
+
| |
|
435
|
+
/
|
436
|
+
| |
|
437
|
+
| |
|
438
|
+
|
427
439
|
|
428
440
|
|
429
441
|
|
430
442
|
### Running whiskey\_disk from the command-line ###
|
431
|
-
|
443
|
+
|
432
444
|
% wd setup --to=<target>
|
433
445
|
% wd setup --to=<project>:<target>
|
434
446
|
% wd setup --to=foo:qa --path=/etc/whiskey_disk/deploy.yml
|
@@ -449,7 +461,7 @@ are in an environment where the 'app' role is active but the 'web' role is not:
|
|
449
461
|
Also, `--debug` can be used to enable verbose output when running `wd setup` or `wd deploy`.
|
450
462
|
|
451
463
|
Note that the wd command (unlike rake, which requires a Rakefile in the current directory) can be run from anywhere, so you can deploy any project, working from any path, and can even specify where to find the deployment YAML configuration file.
|
452
|
-
|
464
|
+
|
453
465
|
The --path argument can take either a file or a directory. When given a file it will use that file as the configuration file. When given a directory it will look in that directory for deploy/<project>/<target>.yml, then deploy/<project>.yml, then deploy/<target>.yml, then <target>.yml, and finally, deploy.yml.
|
454
466
|
|
455
467
|
To make things even better, you can provide an URL as the --path argument and have a central location from which to pull deployment YAML data. This means that you can centrally administer the definitive deployment information for the various projects and targets you manage. This could be as simple as keeping them in a text file hosted on a web server, checking them into git and using github or gitweb to serve up the file contents on HEAD, or it could be a programmatically managed configuration management system returning dynamically-generated results.
|
@@ -480,7 +492,7 @@ The --only setting is used to tell a node what its name is, and to tell it not t
|
|
480
492
|
|
481
493
|
### A note about post\_{setup,deploy} Rake tasks
|
482
494
|
|
483
|
-
If you want actions to run on the deployment target after you do a whiskey\_disk setup or whiskey\_disk deploy,
|
495
|
+
If you want actions to run on the deployment target after you do a whiskey\_disk setup or whiskey\_disk deploy,
|
484
496
|
you will need to make sure that whiskey\_disk is available on the target system (either by gem installation,
|
485
497
|
as a rails plugin in the Rails application to be deployed, or as a vendored library in the application to be
|
486
498
|
deployed). Whiskey\_disk provides the basic deploy:post\_setup and deploy:post\_deploy hooks which get called.
|
@@ -505,7 +517,7 @@ Do you want to run database migrations when no migrations have been added? Why
|
|
505
517
|
end
|
506
518
|
|
507
519
|
task :compress_assets do
|
508
|
-
if changed?('public/stylesheets') or changed?('public/javascripts')
|
520
|
+
if changed?('public/stylesheets') or changed?('public/javascripts')
|
509
521
|
puts "Getting my asset munge on..."
|
510
522
|
# do some expensive asset compression stuff
|
511
523
|
end
|
@@ -578,7 +590,7 @@ environment variable to the string 'true' or 'yes':
|
|
578
590
|
|
579
591
|
#### What's all this about a second repository for configuration stuff? ####
|
580
592
|
|
581
|
-
This is completely optional, but we really are digging this, so maybe
|
593
|
+
This is completely optional, but we really are digging this, so maybe
|
582
594
|
you should try it. Basically it goes like this...
|
583
595
|
|
584
596
|
We have a number of web applications that we manage. Usually there's a
|
@@ -744,44 +756,46 @@ Notice that there are no separate trees for 'uat' and 'qa' targets.
|
|
744
756
|
|
745
757
|
- Here is a sample of a lib/tasks/deploy.rake from a Rails application we deployed once upon a time:
|
746
758
|
|
747
|
-
RAILS_ENV=ENV['RAILS_ENV'] if ENV['RAILS_ENV'] and '' != ENV['RAILS_ENV']
|
748
|
-
Rake::Task['environment'].invoke
|
749
|
-
|
750
|
-
require 'asset_cache_sweeper'
|
751
759
|
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
760
|
+
|
761
|
+
RAILS_ENV=ENV['RAILS_ENV'] if ENV['RAILS_ENV'] and '' != ENV['RAILS_ENV']
|
762
|
+
Rake::Task['environment'].invoke
|
763
|
+
|
764
|
+
require 'asset_cache_sweeper'
|
765
|
+
|
766
|
+
namespace :deploy do
|
767
|
+
task :create_rails_directories do
|
768
|
+
puts "creating log/ and tmp/ directories"
|
769
|
+
Dir.chdir(RAILS_ROOT)
|
770
|
+
system("mkdir -p log tmp")
|
771
|
+
end
|
772
|
+
|
773
|
+
# note that the plpgsql language needs to be installed by the db admin at initial database creation :-/
|
774
|
+
task :setup_postgres_for_thinking_sphinx => [ :environment ] do
|
775
|
+
ThinkingSphinx::PostgreSQLAdapter.new(Product).setup
|
776
|
+
end
|
777
|
+
|
778
|
+
# whytf is this even necessary? Come on. This should be built into ts:restart.
|
779
|
+
task :thinking_sphinx_restart => [:environment] do
|
780
|
+
Rake::Task['ts:stop'].invoke rescue nil
|
781
|
+
Rake::Task['ts:index'].invoke
|
782
|
+
Rake::Task['ts:start'].invoke
|
783
|
+
end
|
784
|
+
|
785
|
+
task :bounce_passenger do
|
786
|
+
puts "restarting Passenger web server"
|
787
|
+
Dir.chdir(RAILS_ROOT)
|
788
|
+
system("touch tmp/restart.txt")
|
789
|
+
end
|
790
|
+
|
791
|
+
task :clear_asset_cache => [:environment] do
|
792
|
+
STDERR.puts "Expiring cached Assets for domains [#{AssetCacheSweeper.domains.join(", ")}]"
|
793
|
+
AssetCacheSweeper.expire
|
794
|
+
end
|
795
|
+
|
796
|
+
task :post_setup => [ :create_rails_directories, :setup_postgres_for_thinking_sphinx ]
|
797
|
+
task :post_deploy => [ 'db:migrate', 'ts:config', :thinking_sphinx_restart, :bounce_passenger, :clear_asset_cache ]
|
798
|
+
end
|
785
799
|
|
786
800
|
### Future Directions ###
|
787
801
|
|
@@ -806,10 +820,12 @@ The IRC channel is #whiskey_disk on freenode.
|
|
806
820
|
### Contributors ###
|
807
821
|
|
808
822
|
- [Rick Bradley](https://github.com/rick): author
|
823
|
+
- [James Cox](https://github.com/imajes): bugfixes, prototyping, design help, code, feedback
|
809
824
|
- [Rein Henrichs](https://github.com/reinh): design help, code
|
810
825
|
- [Jeremy Holland](https://github.com/awebneck): code
|
811
826
|
- [Kevin Barnes](https://github.com/vinbarnes): design help, code
|
812
827
|
- [Alex Sharp](https://github.com/ajsharp): issues, real-world usage cases, design help
|
813
828
|
- [Yossef Mendelssohn](https://github.com/ymendel): design help, proofreading
|
814
829
|
- [Josh Moore](https://github.com/joshsmoore): bug-hunting
|
815
|
-
|
830
|
+
|
831
|
+
- Documentation/feedback: [Cristi Balan](https://github.com/evilchelu), [Hedgehog](http://github.com/hedgehog)
|