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