whiskey_disk 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README +70 -8
- data/TODO.txt +15 -1
- data/VERSION +1 -1
- data/lib/whiskey_disk.rb +2 -2
- data/spec/whiskey_disk_spec.rb +10 -0
- metadata +3 -2
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009, Flawed Logic, OG Consulting, Rick Bradley.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
CHANGED
@@ -1,5 +1,75 @@
|
|
1
1
|
Whiskey Disk -- embarrassingly fast deployments.
|
2
2
|
|
3
|
+
A very opinionated deployment tool, designed to be as fast as technologically
|
4
|
+
possible.
|
5
|
+
|
6
|
+
Should work with any project which is git hosted, not just Ruby / Ruby on Rails projects.
|
7
|
+
Allows for local deploys as well as remote.
|
8
|
+
|
9
|
+
Dependencies: rake, ssh, git, rsync on the deployment target server (affectionately
|
10
|
+
referred to as the "g-node" by vinbarnes), bash-ish shell on deployment
|
11
|
+
server.
|
12
|
+
|
13
|
+
Assumptions:
|
14
|
+
|
15
|
+
- you have a Rakefile in the top directory of your project's checkout
|
16
|
+
- you are deploying over ssh
|
17
|
+
- your project is managed via git
|
18
|
+
- you have a second git repository for per-application/per-environment configuration files
|
19
|
+
- you are comfortable defining post-setup and post-deployment actions with rake
|
20
|
+
|
21
|
+
Installation:
|
22
|
+
|
23
|
+
As a gem:
|
24
|
+
|
25
|
+
% gem install whiskey_disk
|
26
|
+
|
27
|
+
As a rails plugin:
|
28
|
+
|
29
|
+
% script/plugin install git://github.com/flogic/whiskey_disk.git
|
30
|
+
|
31
|
+
Configuration:
|
32
|
+
|
33
|
+
- look in the examples/ directory for sample configuration files
|
34
|
+
- main configuration is in <app_root>/config/deploy.yml
|
35
|
+
- per-environment configurations can be stored in <app_root>/config/deploy-<environment>.yml
|
36
|
+
- config files are YAML, with a section for each environment.
|
37
|
+
|
38
|
+
Known config file settings (if you're familiar with capistrano and vlad these
|
39
|
+
should seem eerily familiar)::
|
40
|
+
|
41
|
+
- domain: host on which to deploy (this is an ssh connect string)
|
42
|
+
- deploy_to: path to which to deploy main application
|
43
|
+
- repository: git repo path for main application
|
44
|
+
- branch: git branch to deploy from main application git repo
|
45
|
+
- deploy_config_to: where to deploy the configuration repository
|
46
|
+
- config_repository: git repository for configuration files
|
47
|
+
- project: project name (used to compute path in configuration checkout)
|
48
|
+
|
49
|
+
- defining a deploy:<environment>:post_setup rake task (e.g., in lib/tasks/ or in
|
50
|
+
your project's Rakefile) will cause that task to be run at the end of deploy:setup
|
51
|
+
|
52
|
+
- defining a deploy:<environment>:post_deploy rake task (e.g., in lib/tasks/ or in
|
53
|
+
your project's Rakefile) will cause that task to be run at the end of deploy:now
|
54
|
+
|
55
|
+
Running:
|
56
|
+
|
57
|
+
- rake deploy:setup to=<environment> (e.g., "staging", "production", etc.)
|
58
|
+
- rake deploy:now to=<environment>
|
59
|
+
|
60
|
+
|
61
|
+
Resources:
|
62
|
+
- http://github.com/blog/470-deployment-script-spring-cleaning
|
63
|
+
- http://github.com/mislav/git-deploy
|
64
|
+
- http://toroid.org/ams/git-website-howto
|
65
|
+
|
66
|
+
-----
|
67
|
+
|
68
|
+
|
69
|
+
NOTES (aka the original README):
|
70
|
+
|
71
|
+
|
72
|
+
|
3
73
|
The idea here is inspired by github's cleaned up deployment scripts, and mislav's git-deploy project. Only, we gave up on capistrano a long time ago, and after a few years of doing deployments on a few dozen projects, we realized that we really have very little variation on how we do things. That is, we can afford to have a very opinionated tool to do our deployments.
|
4
74
|
|
5
75
|
Here are the features/constraints we're envisioning:
|
@@ -41,11 +111,3 @@ Here are the features/constraints we're envisioning:
|
|
41
111
|
- build this spec-first (whenever possible) so that there's a useful test suite.
|
42
112
|
|
43
113
|
- M$ windows hasn't been a priority for me for over a decade, not starting now.
|
44
|
-
|
45
|
-
---
|
46
|
-
|
47
|
-
Resources:
|
48
|
-
- http://github.com/blog/470-deployment-script-spring-cleaning
|
49
|
-
- http://github.com/mislav/git-deploy
|
50
|
-
- http://toroid.org/ams/git-website-howto
|
51
|
-
|
data/TODO.txt
CHANGED
@@ -1,2 +1,16 @@
|
|
1
|
-
-
|
1
|
+
- common post-deploy tasks (including db:migrate, server bounce)
|
2
|
+
- some sort of simple API for hooks to check which files have changed (either via git rev differences or rsync output), so then the rake task would just do something like:
|
3
|
+
|
4
|
+
require 'whiskey_disk/rake'
|
5
|
+
|
6
|
+
namespace :deploy do
|
7
|
+
task :post_deploy do
|
8
|
+
if changed_in?('db/migrate') or changed?('config/database.yml')
|
9
|
+
Rake::Task['db:migrate'].invoke
|
10
|
+
end
|
11
|
+
# etc. ...
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
2
15
|
- install hooks (look at maybe git-deploy for good examples)
|
16
|
+
- make sure the config repo stuff is optional
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/lib/whiskey_disk.rb
CHANGED
@@ -106,13 +106,13 @@ class WhiskeyDisk
|
|
106
106
|
def run_post_setup_hooks
|
107
107
|
needs(:deploy_to)
|
108
108
|
enqueue "cd #{self[:deploy_to]}"
|
109
|
-
enqueue "rake --trace deploy:post_setup"
|
109
|
+
enqueue "rake --trace deploy:post_setup to=#{self[:environment]}"
|
110
110
|
end
|
111
111
|
|
112
112
|
def run_post_deploy_hooks
|
113
113
|
needs(:deploy_to)
|
114
114
|
enqueue "cd #{self[:deploy_to]}"
|
115
|
-
enqueue "rake --trace deploy:post_deploy"
|
115
|
+
enqueue "rake --trace deploy:post_deploy to=#{self[:environment]}"
|
116
116
|
end
|
117
117
|
end
|
118
118
|
end
|
data/spec/whiskey_disk_spec.rb
CHANGED
@@ -272,6 +272,11 @@ describe 'WhiskeyDisk' do
|
|
272
272
|
WhiskeyDisk.run_post_setup_hooks
|
273
273
|
WhiskeyDisk.buffer.join(' ').should.match(%r{rake.*deploy:post_setup})
|
274
274
|
end
|
275
|
+
|
276
|
+
it 'should use the same environment when running the rake tasks' do
|
277
|
+
WhiskeyDisk.run_post_setup_hooks
|
278
|
+
WhiskeyDisk.buffer.join(' ').should.match(%r{to=#{@env}})
|
279
|
+
end
|
275
280
|
end
|
276
281
|
|
277
282
|
describe 'running post deployment hooks' do
|
@@ -296,6 +301,11 @@ describe 'WhiskeyDisk' do
|
|
296
301
|
WhiskeyDisk.run_post_deploy_hooks
|
297
302
|
WhiskeyDisk.buffer.join(' ').should.match(%r{rake.*deploy:post_deploy})
|
298
303
|
end
|
304
|
+
|
305
|
+
it 'should use the same environment when running the rake tasks' do
|
306
|
+
WhiskeyDisk.run_post_deploy_hooks
|
307
|
+
WhiskeyDisk.buffer.join(' ').should.match(%r{to=#{@env}})
|
308
|
+
end
|
299
309
|
end
|
300
310
|
|
301
311
|
describe 'flushing changes' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whiskey_disk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rick Bradley
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-31 00:00:00 +05:30
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -32,6 +32,7 @@ extra_rdoc_files:
|
|
32
32
|
- README
|
33
33
|
files:
|
34
34
|
- .gitignore
|
35
|
+
- MIT-LICENSE
|
35
36
|
- README
|
36
37
|
- Rakefile
|
37
38
|
- TODO.txt
|