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