whiskey_disk 0.0.6 → 0.0.7

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.
Files changed (4) hide show
  1. data/README +113 -1
  2. data/VERSION +1 -1
  3. data/lib/whiskey_disk.rb +0 -1
  4. metadata +1 -1
data/README CHANGED
@@ -89,14 +89,126 @@ Whiskey Disk -- embarrassingly fast deployments.
89
89
  - rake deploy:setup to=<environment> (e.g., "staging", "production", etc.)
90
90
  - rake deploy:now to=<environment>
91
91
 
92
+
93
+ Configuration Repository
94
+
95
+ What's all this about a second repository for configuration stuff?
96
+
97
+ Well, we're going to make it optional probably in another release, but we really
98
+ are digging this, so maybe you should try it. Basically it goes like this...
99
+
100
+ We have a number of web applications that we manage. Usually there's a customer,
101
+ there might be third-party developers, or the customer might have access to the git
102
+ repo, or their designer might, etc. We also tend to run a few instances of any given
103
+ app, for any given customer. So, we'll run a "production" site, which is the public-
104
+ facing, world-accessible main site. We'll usually also run a "staging" site, which is
105
+ roughly the same code, maybe the same data, running on a different URL, which the customer
106
+ can look at to see if the functionality there is suitable for deploying out to production.
107
+ We sometimes run a "development" site which is even less likely to be the same code as
108
+ production, etc., but gives visibility into what might end up in production one day soon.
109
+
110
+ So we'll store the code for all of these versions of a site in the same git repo, typically
111
+ using a different remote branch for each environment ("production", "staging", "development").
112
+
113
+ One thing that comes up pretty quickly is that there are various files associated with
114
+ the application which have more to do with configuration of a running instance than they
115
+ have to do with the application in general. In the rails world these files are probably
116
+ in config, or config/initializers/. Think database connection information, search engine
117
+ settings, exception notification plugin data, email configuration, Amazon S3 credentials,
118
+ e-commerce back-end configuration, etc.
119
+
120
+ We don't want the production site using the same database as the development site. We don't
121
+ want staging using (and re-indexing, re-starting, etc.) production's search engine server.
122
+ We don't want any site other than production to send account reset emails, or to push orders
123
+ out to fulfillment, etc.
124
+
125
+ For some reason, the answer to this with cap and/or vlad has been to have recipes which
126
+ reference various files up in a shared area on the server, do copying or symlinking, etc.
127
+ Where did those files come from? How did they get there? How are they managed over time?
128
+ If they got there via a configuration tool, why (a) are they not in the right place, or
129
+ (b) do we have to do work to get them into the right place?
130
+
131
+ So, we decided that we'd change how we deal with the issue. Instead of moving files around
132
+ or symlinking every time we deploy, we will manage the configuration data just like we
133
+ manage other files required by our projects -- with git.
134
+
135
+ So, each project we deploy is associated with a config repo in our git repository. Usually
136
+ many projects are in the same repo, because we're the only people to see the data and
137
+ there's no confidentiality issue. But, if a customer has access to their git information
138
+ then we'll make a separate config repo for all that customers' projects. (This is easier
139
+ to manage than it sounds if you're using gitosis, btw.)
140
+
141
+ Anyway, a config repo is just a git repo. In it are directories for every project
142
+ whose configuration information is managed in that repo. For example, there's a "larry"
143
+ directory in our main config repo, because we're deploying the larry project
144
+ (http://github.com/rick/larry) to manage our high-level configuration data.
145
+
146
+ Note, if you set the 'project' setting in deploy.yml, that determines the name of the
147
+ top-level project directory whiskey_disk will hunt for in your config repo. If you don't
148
+ it uses the 'repository' setting (i.e., the git URL) to try to guess what the project
149
+ name might be. So if the URL ends in foo/bar.git, or foo:bar.git, or /bar, or :bar,
150
+ whiskey_disk is going to guess "bar". If it's all bitched up, just set 'project' manually
151
+ in deploy.yml.
152
+
153
+ Inside the project directory is a directory named for each environment we might
154
+ deploy to. Frankly, we've been using "production", "staging", "development", and "local"
155
+ on just about everything.
156
+
157
+ Inside the environment directory is a tree of files. So, e.g., there's config/, which
158
+ has initializers/ and database.yml in it.
159
+
160
+ Long story short, load up whatever configuration files you're using into the repo
161
+ as described, and come deployment time exactly those files will be overlaid on top of
162
+ the most recent checkout of the project. Snap.
163
+
164
+ project-config/
165
+ |
166
+ +---larry/
167
+ |
168
+ +---production/
169
+ | |
170
+ | +---config/
171
+ | |
172
+ | +---initializers/
173
+ | |
174
+ | +---database.yml
175
+ |
176
+ +---staging/
177
+ | |
178
+ | |
179
+ | +---config/
180
+ | |
181
+ | ....
182
+ |
183
+ +---development/
184
+ | |
185
+ | +---config/
186
+ | |
187
+ | ....
188
+ |
189
+ +---local/
190
+ |
191
+ +---config/
192
+ |
193
+ ....
194
+
195
+
196
+
92
197
  More Examples:
93
198
 
94
199
  - We are using this to manage larry. See:
95
200
 
96
201
  http://github.com/rick/larry/blob/master/config/deploy.yml
97
- http://github.com/rick/larry/blob/master/config/deploy-local.yml.example
98
202
  http://github.com/rick/larry/blob/master/lib/tasks/deploy.rake
99
203
 
204
+ Note that you can also provide per-environment config settings,
205
+ outside of deploy.yml. This is most useful for handling per-developer
206
+ local deployments, though you could use it to override some settings
207
+ if that makes sense in some context. Here's a simple example of that:
208
+
209
+ http://github.com/rick/larry/blob/master/config/deploy-local.yml.example
210
+
211
+
100
212
  - We are using it on a private project with lots of config files, but here's
101
213
  a gist showing a bit more interesting deploy.rake file for post_setup and
102
214
  post_deploy work:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.7
data/lib/whiskey_disk.rb CHANGED
@@ -1,4 +1,3 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), 'tasks', 'deploy'))
2
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'whiskey_disk', 'config'))
3
2
 
4
3
  class WhiskeyDisk
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.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Bradley