]> scripts.mit.edu Git - wizard.git/blob - TODO
Implement 'wizard install', with other improvements.
[wizard.git] / TODO
1 The Git Autoinstaller
2
3 TODO NOW:
4
5 - We have safe, non-braindead
6   version detection with `git describe --tags`.  Switch
7   everything to use it.
8 - wizard.util is pretty braindead at this point.  Fix up
9   the wildly varying conventions in it.
10
11 - Better error message if daemon/scripts-security-upd
12   is not on scripts-security-upd list
13
14 - Add repository flag so that we can specify an
15   arbitrary repository to migrate to
16 - Fix retarded logging mechanism
17
18 - The great initial deploy:
19     - Turn on mediawiki new autoinstaller
20     - Migrate all mediawiki installs
21
22 - Testing:
23     - Need a scriptable autoinstaller, which means we rewrite
24       all of the autoinstall machinery.  This doesn't need
25       to be able to create pre-wizard autoinstalls, since migration
26       is easy to test+revert
27
28 - Build automation for generating config files; this automation
29   will be shared with the migrate script and the installer script
30   (migrate script needs to be able to pull out values from config
31   file, so will we; installer script needs to be able to run
32   the installer to generate config files, so will this)
33
34 - Implement proper deploy log parsing; this basically means we
35   need to be able to introspect Git Log. Consider using git-python
36   for this.
37
38 - This should all be automated:
39     - Wordpress needs to have .scripts dir in all -scripts versions
40       (also make .scripts/.htaccess)
41     - Wordpress needs to have a .scripts/update script written for
42       its latest version (do this after its migration)
43     - Wordpress needs to check for php.ini files (which it almost
44       certianly has) and commit messages
45     - Wordpress needs user config and php.ini links made
46
47 - Summary script should be more machine friendly, and should not
48   output summary charts when I increase specificity
49 - Summary script needs to be updated for new format
50 - Check how many autoinstalls are missing w bits for
51   daemon.scripts (this would need pyafs)
52 - Make scripts AFS patch advertise its existence so we can check for it
53
54 PULLING OUT CONFIGURATION FILES IN AN AUTOMATED MANNER
55
56 advancedpoll: Template file to fill out
57 django: Noodles of template files
58 gallery2: Multistage install process
59 joomla: Template file
60 mediawiki: One-step install process
61 phpbb: Multistage install process
62 phpical: Template file
63 trac: NFC
64 turbogears: NFC
65 wordpress: Multistage install process
66
67 PHILOSOPHY ABOUT LOGGING
68
69 Logging is most useful when performing a mass run.  This
70 includes things such as mass-migration as well as when running
71 summary reports.  An interesting property about mass-migration
72 or mass-upgrade, however, is that if they fail, they are
73 idempotent, so an individual case can be debugged simply running
74 the single-install equivalent with --debug on.  (This, indeed,
75 may be easier to do than sifting through a logfile).
76
77 It is a different story when you are running a summary report:
78 you are primarily bound by your AFS cache and how quickly you can
79 iterate through all of the autoinstalls.  Checking if a file
80 exists on a cold AFS cache may
81 take several minutes to perform; on a hot cache the same report
82 may take a mere 3 seconds.  When you get to more computationally
83 expensive calculations, however, even having a hot AFS cache
84 is not enough to cut down your runtime.
85
86 There are certain calculations that someone may want to be
87 able to perform on manipulated data.  As such, this data should
88 be cached on disk, if the process for extracting this data takes
89 a long time.  Also, for usability sake, Wizard should generate
90 the common case reports.
91
92 Ensuring that machine parseable reports are made, and then making
93 the machinery to reframe this data, increases complexity.  Therefore,
94 the recommendation is to assume that if you need to run iteratively,
95 you'll have a hot AFS cache at your fingerprints, and if that's not
96 fast enough, then cache the data.
97
98 COMMIT MESSAGE FIELDS:
99
100 Installed-by: username@hostname
101 Pre-commit-by: Real Name <username@mit.edu>
102 Upgraded-by: Real Name <username@mit.edu>
103 Migrated-by: Real Name <username@mit.edu>
104 Wizard-revision: abcdef1234567890
105 Wizard-args: /wizard/bin/wizard foo bar baz
106
107 GIT COMMIT FIELDS:
108
109 Committer: Real Name <username@mit.edu>
110 Author: lockername locker <lockername@scripts.mit.edu>
111
112 NOTES:
113
114 - A perfectly formed autoinstall with upgrade paths for all of
115   the intervening versions is not really feasible to implement.
116   As such, we want to migrate everything to -scripts, and then
117   generate a -scripts2 with the correct .scripts directory.
118   We will then nop update some installs, but this will prevent
119   us from having to migrate and update concurrently.  Treat
120   a scripts2 upgrade from migration the same way you would treat
121   a botched scripts upgrade.
122     ADDENDUM: You MUST NOT migrate to a -scripts2 version; the
123     machinery can't actually handle this.
124
125 - Currently all repositories are initialized with --shared, which
126   means they have basically ~no space footprint.  However, it
127   also means that /mit/scripts/wizard/srv MUST NOT lose revs.
128
129 - Full fledged logging options. Namely:
130   x all loggers (delay implementing this until we actually have debug stmts)
131     - default is WARNING
132     - debug     => loglevel = DEBUG
133   x stdout logger
134     - default is WARNING (see below for exception)
135     - verbose   => loglevel = INFO
136   x file logger (only allowed for serial processing)
137     - default is OFF
138     - log-file   => loglevel = INFO
139   x database logger (necessary for parallel processing, not implemented)
140     - default is OFF
141     - log-db    => loglevel = INFO
142
143 - More on the database logger: it will be very simple with one
144   table named `logs` in SQLite, with columns: `job`, `level`,
145   `message`.  Job identifies the subprocess/thread that emitted
146   the log, so things can be correlated together.  We will then
147   have `wizard dump` which takes a database like this and dumps
148   it into a file logger type file.  The database may also store
149   a queue like structure which can be used to coordinate jobs.
150
151 OVERALL PLAN:
152
153 * Some parts of the infrastructure will not be touched, although I plan
154   on documenting them.  Specifically, we will be keeping:
155
156     - parallel-find.pl, and the resulting
157       /mit/scripts/.htaccess/scripts/sec-tools/store/scriptslist
158
159 * The new procedure for generating an update is as follows:
160   (check out the mass-migration instructions for something in this spirit,
161   although uglier in some ways)
162
163     0. ssh into not-backward, temporarily give the daemon.scripts-security-upd
164        bits by blanching it on system:scripts-security-upd, and run parallel-find.pl
165
166 A   1. Have the Git repository and working copy for the project on hand.
167
168 A   2. Checkout the pristine branch
169
170 A   3. Remove all files from the working copy.  Use `wipe-working-dir`
171
172 A   4. Download the new tarball
173
174 A   5. Extract the tarball over the working copy (`cp -R a/. b` works well,
175        remember that the working copy is empty; this needs some intelligent
176        input)
177
178 A   6. Check for empty directories and add stub files as necessary.
179        Use `preserve-empty-dir`
180
181 A   7. Git add it all, and then commit as a new pristine version (v1.2.3)
182
183 A   8. Checkout the master branch
184
185     9. [FOR EXISTING REPOSITORIES]
186        Merge the pristine branch in. Resolve any conflicts that our
187        patches have with new changes. Do NOT let Git auto-commit it
188        with --no-commit (otherwise, you want to git commit --amend
189        to keep our history clean
190
191        [FOR NEW REPOSITORIES]
192        See if any patches are needed to make this run smoothly on
193        scripts.
194
195     [FOR NEW REPOSITORIES]
196 A       mkdir .scripts
197 A       echo "Deny from all" > .scripts/.htaccess
198         touch .scripts/update
199         chmod a+x .scripts/update
200
201    10. Check if there are any special update procedures, and update/create the
202        .scripts/update shell script as necessary (this means that any
203        application specific update logic will be kept with the actual
204        source code.  The language of this update script will vary
205        depending on context.)
206
207    11. Commit your changes, and tag as v1.2.3-scripts (or scripts2, if
208        you are amending an install without an upstream changes)
209
210       NOTE: These steps should be run on a scripts server
211
212    12. Test the new update procedure using
213        `wizard upgrade --with=/path/to/repo /your/autoinstall` (this will
214        read out master as your "latest" version).
215        Use git commit --amend to fix any bugs (alternatively, squash them
216        together later).
217
218    13. You can also do a "mass" version of this using:
219        `wizard -d testbed.txt massupgrade --with=/path/to/repo app`
220        You'll need perms for any testbed stuff you want. (not implemented)
221
222       GET APPROVAL BEFORE PROCEEDING ANY FURTHER
223
224       NOTE: The following commands are to be run on not-backward.mit.edu.
225       You'll need to add daemon.scripts-security-upd to
226       scripts-security-upd to get bits to do this.  Make sure you remove
227       these bits when you're done.
228
229    14. Run `wizard research appname`
230        which uses Git commands to check how many
231        working copies apply the change cleanly, and writes out a logfile
232        with the working copies that don't apply cleanly.  It also tells
233        us about "corrupt" working copies, i.e. working copies that
234        have over a certain threshold of changes.
235
236    15. Run `wizard massupgrade appname`, which applies the update to all working
237        copies possible, and sends mail to users to whom the working copy
238        did not apply cleanly.
239
240    16. Run parallel-find.pl to update our inventory
241
242 * For mass importing into the repository, the steps are:
243   (this probably won't ever be automated, becuase there are fiddly bits)
244
245 [TO SET IT UP]
246 # let app-1.2.3 be the scripts folder originally in deploydev
247 # let this folder be srv/
248 # you can also do a git clone
249     mkdir app
250     cd app
251     git init
252     cd ..
253 unfurl app-1.2.3 app  # [FIDDLY BIT]
254 # NOTE: contents of application are now in app directory
255 cd app
256 git add .
257 git commit -s -m "App 1.2.3"
258 git tag v1.2.3
259 git branch pristine
260 # NOTE: you're still on master branch
261 # WARNING: the following operation might require -p1
262 patch -p0 < ../app-1.2.3/app-1.2.3.patch  # [FIDDLY BIT]
263 # NOTE: please sanity check the patch!
264 git add .
265 # NOTE: -a flag is to handle if the patch deleted something
266 git commit -as -m "App 1.2.3-scripts"
267 git tag v1.2.3-scripts
268
269 [TO ADD AN UPDATE]
270 # let this folder be srv/app.git
271 git checkout pristine
272 # NOTE: this preserves your .git folder, but removes everything
273 wipe-working-dir .
274 cd ..
275 unfurl app-1.2.3 app  # [FIDDLY BIT]
276 cd app
277 # NOTE: please sanity check app directory
278 git add .
279 # NOTE: -a is to take care of deletions
280 git commit -as -m "App 1.2.3"
281 git tag v1.2.3
282 [FIDDLE AROUND. FIDDLE AROUND]
283 [IF THE PATCH HAS CHANGED]
284     # You are on the pristine branch
285     # NOTE: Now, the tricky part (this is different from a real update)
286     git symbolic-ref HEAD refs/heads/master
287     # NOTE: Now, we think we're on the master branch, but we have
288     # pristine copy checked out
289     # NOTE: -p0 might need to be twiddled
290     patch -p0 < ../app-1.2.3/app-1.2.3.patch
291     git add .
292     # COMMENT: used to git checkout .scripts here
293     # then check if the directory needs an updated update script
294     # NOTE: Fake the merge
295     git rev-parse pristine > .git/MERGE_HEAD
296 [IF THE PATCH HASN'T CHANGED]
297     git checkout master
298     git merge --no-commit pristine
299 git commit -as -m "App 1.2.3-scripts"
300 git tag v1.2.3-scripts
301
302 * The repository for a given application will contain the following files:
303
304     - The actual application's files, as from the official tarball
305
306     - A .scripts directory, which contains the following information:
307
308         * .scripts/update shell script (with the +x bit set appropriately),
309           which performs the commands necessary to update a script.  This can
310           be in any language.
311
312         * .scripts/.htaccess to prevent this directory from being accessed
313           from the web.
314
315         * .scripts/database (generated) contains the database the
316           user installed the script to, so scripts-remove can clean it
317
318             XXX: Could cause problems if a user copies the autoinstall,
319             fiddles with the DB credentials, and then scripts-remove's
320             the autoinstall.  Possible fix is to add the original
321             directory as a sanity check.  Additionally, we could have
322             the application read out of this file.
323
324         * .scripts/old-version (optional) the old value of .scripts-version
325
326         * .scripts/version something like "app-1.2.3-scripts"
327
328         * .scripts/install (eventually) interactively installs the
329           application from command line.  (This might go into wizard.app
330           Python module)
331
332         * .scripts/lock which locks the autoinstall during an upgrade
333
334 * Make 'wizard summary' generate nice pretty graphs of installs by date
335   (more histograms, will need to check actual .scripts-version files.)
336