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