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