]> scripts.mit.edu Git - wizard.git/blob - TODO
Revamp 'wizard summary', and start writing tutorial docs.
[wizard.git] / TODO
1 The Git Autoinstaller
2
3 TODO NOW:
4
5 - Make wizard install accept appname-head (so that you can do a test with
6   head, and do things without tags).  Also make it accept commit hashes.
7   In fact, let it accept any committish.  Figure out what to do if we
8   do a test script with x.y.z when we REALLY mean x.y.z-scripts. XXX!!!
9 - Do early validation of inputs for configuration
10 - Let 'wizard configure' be interactive
11 - Parse output HTML for class="error" and give those errors back to the user,
12   then boot them back into configure
13 - Get rid of our custom sizing code and use dialog's built-in sizing (i.e. width=0, height=0).
14   Maybe our sizing code is superior, maybe not.
15
16 - Replace gaierror with a more descriptive name (this is a DNS error)
17
18 - Pre-emptively check if daemon/scripts-security-upd
19   is not on scripts-security-upd list (/mit/moira/bin/blanche)
20
21 - Redo Wordpress conversion, with an eye for automating everything
22   possible (such as downloading the tarball and unpacking)
23
24 - Web application for installing autoinstalls has a hard problem
25   with credentials (as well as installations that are not conducted
26   on an Athena machine.)  Possible solutions include asking the user
27   to SSH into an athena machine and run a bunch of commands, or writing
28   a Java applet (possibly in Clojure or Scala) which gets filesystem
29   permissions and then performs the operations.
30
31 - Pay back code debt
32     - Genericize callAsUser and drop_priviledges in shell
33     - Summary script should be more machine friendly, and should not
34       output summary charts when I increase specificity
35     - Summary script should do something intelligent when distinguishing
36       between old-style and new-style installs
37     - Report code in wizard/command/__init__.py is ugly as sin.  Also,
38       the Report object should operate at a higher level of abstraction
39       so we don't have to manually increment fails. (in fact, that should
40       probably be called something different).  The by-percent errors should
41       also be automated.
42     - Move resolutions in mediawiki.py to a text file? (the parsing overhead
43       may not be worth it)
44     - If a process is C-ced, it can result in a upgrade that has
45       an updated filesystem but not updated database. Make this more
46       resilient
47     - PHP end of file allows omitted semicolon, can result in parse error
48       if merge resolutions aren't careful.  `php -l` can be a quick stopgap
49
50 - Other stuff
51     - Make single user mass-migrate work when not logged in as root
52     - Don't use the scripts heuristics unless we're on scripts with the
53       AFS patch.  Check with `fs sysname`
54     - Make 'wizard summary' generate nice pretty graphs of installs by date
55       (more histograms, will need to check actual .scripts-version files.)
56     - It should be able to handle installs like Django where there's a component
57       that gets installed in web_scripts and another directory that gets installed
58       in Scripts.
59     - ACLs is a starting point for sending mail to users, but it has
60       several failure modes:
61         - Old maintainers who don't care who are still on the ACL
62         - Private AFS groups that aren't mailing lists and that we
63           can't get to
64       A question is whether or not sending mail actually helps us:
65       many users will probably have to come back to us for help; many
66       other users won't care.
67
68 PULLING OUT CONFIGURATION FILES IN AN AUTOMATED MANNER
69
70 advancedpoll: Template file to fill out
71 django: Noodles of template files
72 gallery2: Multistage install process
73 joomla: Template file
74 mediawiki: One-step install process
75 phpbb: Multistage install process
76 phpical: Template file
77 trac: NFC
78 turbogears: NFC
79 wordpress: Multistage install process
80
81 COMMIT MESSAGE FIELDS:
82
83 Installed-by: username@hostname
84 Pre-commit-by: Real Name <username@mit.edu>
85 Upgraded-by: Real Name <username@mit.edu>
86 Migrated-by: Real Name <username@mit.edu>
87 Wizard-revision: abcdef1234567890
88 Wizard-args: /wizard/bin/wizard foo bar baz
89
90 GIT COMMIT FIELDS:
91
92 Committer: Real Name <username@mit.edu>
93 Author: lockername locker <lockername@scripts.mit.edu>
94
95 NOTES:
96
97 - It is not required nor expected for update scripts to exist for all
98   intervening versions that were present pre-migration; only for it
99   to work on the most recent migration.
100
101 - Currently all repositories are initialized with --shared, which
102   means they have basically ~no space footprint.  However, it
103   also means that /mit/scripts/wizard/srv MUST NOT lose revs after
104   deployment.
105
106 OVERALL PLAN:
107
108 * Some parts of the infrastructure will not be touched, although I plan
109   on documenting them.  Specifically, we will be keeping:
110
111     - parallel-find.pl, and the resulting
112       /mit/scripts/.htaccess/scripts/sec-tools/store/scriptslist
113
114 * The new procedure for generating an update is as follows:
115   (check out the mass-migration instructions for something in this spirit,
116   although uglier in some ways; A indicates the step /should/ be automated)
117
118     0. ssh into not-backward, temporarily give the daemon.scripts-security-upd
119        bits by blanching it on system:scripts-security-upd, and run parallel-find.pl
120
121     1. Have the Git repository and working copy for the project on hand.
122
123     2. Checkout the pristine branch
124
125     3. Run wizard `prepare-pristine APP-VERSION`
126
127     X. Commit, with name "Appname x.y.z"
128
129     X. Tag as appname-x.y.z
130
131     4. Checkout the master branch
132
133     5. Merge the pristine branch in. Resolve any conflicts that our
134        patches have with new changes. Do NOT let Git auto-commit it
135        with --no-commit (otherwise, you want to git commit --amend
136        to keep our history clean
137
138     X. Commit, with name "Appname x.y.z-scripts".  This is going to be
139        amended.
140
141     6. Run 'wizard prepare-config' on a scripts server while in a checkout
142        of this newest version.  This will prepare a new version of the
143        configuration file based on the application's latest installer.
144        Manually merge back in any custom changes we may have made.
145        Check if any of the regular expressions need tweaking by inspecting
146        the configuration files for user-specific gunk, and modify
147        wizard.app.APPNAME accordingly.  Commit with --amend, and
148        propagate back to your local copy (git reset --hard HEAD~; git pull afs).
149
150     [ENTER HERE FROM CREATING A NEW REPO]
151
152     7. Check if there are any special update procedures, and update
153        the wizard.app.APPNAME module accordingly.  If this is the first
154        time you are performing an upgrade, implement upgrade() in your
155        Application class. (XXX: extended instructions here).  Test
156        the new update procedure using our test scripts (preferably
157        on a scripts server).  Check this page for more info on our
158        integration tests:
159
160         http://scripts.mit.edu/wizard/testing.html#acceptance-tests
161
162     8. If you have any further changes, git commit --amend, and finally
163        tag as v1.2.3-scripts (or scripts2, if you are amending an install
164        without an upstream changes)
165
166     9. Push all of your changes in a public place, and encourage others
167        to test, using --srv-path and a full path.
168
169       GET APPROVAL BEFORE PROCEEDING ANY FURTHER;
170       THIS IS PUSHING THE CHANGES TO THE PUBLIC
171
172       NOTE: The following commands are to be run on not-backward.mit.edu.
173       You'll need to add daemon.scripts-security-upd to
174       scripts-security-upd to get bits to do this.  Make sure you remove
175       these bits when you're done.
176
177    10. Run `wizard research appname`
178        which uses Git commands to check how many
179        working copies apply the change cleanly, and writes out a logfile
180        with the working copies that don't apply cleanly.  It also tells
181        us about "corrupt" working copies, i.e. working copies that
182        have over a certain threshold of changes.
183
184    11. Run `wizard mass-upgrade appname`, which applies the update to all working
185        copies possible.
186
187    12. Run parallel-find.pl to update our inventory
188
189 * For mass importing into the repository, there are a few extra things:
190
191     * Many applications had patches associated with them.  Be sure to
192       apply them, so later merges work better.
193
194         # the following operation might require -p1
195         patch -p0 < ../app-1.2.3/app-1.2.3.patch  # [FIDDLY BIT]
196
197     * When running updates, if the patch has changed you will have to
198       do a special procedure for your merge:
199
200         git checkout pristine
201         # NOTE: Now, the tricky part (this is different from a real update)
202         git symbolic-ref HEAD refs/heads/master
203         # NOTE: Now, we think we're on the master branch, but we have
204         # pristine copy checked out
205         # NOTE: -p0 might need to be twiddled
206         patch -p0 < ../app-1.2.3/app-1.2.3.patch
207         git add .
208         # reconstitute .scripts directory
209         git checkout v1.2.2-scripts -- .scripts
210         git add .scripts
211         # NOTE: Fake the merge
212         git rev-parse pristine > .git/MERGE_HEAD
213
214       You could also just try your luck with a manual merge using the patch
215       as your guide.
216
217 * The repository for a given application will contain the following files:
218
219     - The actual application's files, as from the official tarball
220
221     - A .scripts directory, with the intent of holding Scripts specific files
222       if they become necessary.
223
224 * Making the module files for a new application
225
226     1. Create a wizard/app/APPNAME.py file.  Create an object Application
227        inheriting from wizard.app.Application (check existing modules for
228        the boilerplate code).
229
230     2. Implement download().  "wizard prepare-pristine" will use this in order
231        to download the next version of an application.
232
233     3. Create a git repository with `git init`
234
235     4. Use `wizard prepare-pristine APP-VERSION` to download the tarball and
236        extract it into the directory.  If download() doesn't work and you don't
237        want to special case it (for example, you need a /really old version/
238        for record-keeping purposes), replace APP-VERSION with PATH, where PATH
239        is the tarball to extract.
240
241     5. `git commit -asm "APP VERSION"`
242
243     6. Check if any patches are needed to make the application work
244        on Scripts (ideally, it shouldn't.)  Pre-existing patches
245        live in /mit/scripts/deploy/APP-VERSION/ directories.
246
247     7. Run `wizard prepare-new` to setup common filesets for our repositories.
248
249     8. If you are running a PHP script, there is usually a php.ini file
250        that we package.  You can see previous instances of this patch
251        at /mit/scripts/deploy/php.ini/ as well as in the repositories
252        of any already migrated scripts.  We hope to make these changes
253        unnecessary once PHP 5.3 arrives.
254
255     9. Do an initial commit (we're gonna be amending the hell of this)
256        using `git commit -asm "APP VERSION-scripts"
257
258    10. Implement install().  Test using `wizard install APP`; you won't
259        be able to do a version-specific install with `wizard install APP-VERSION`
260        until you generate a tag (which will become out of date once you
261        amend the commit.)  Now might be a good time to create a
262        tests/test-install-APP.sh file (use the other tests as reference) so
263        you don't have to constantly enter the parameters when you're doing
264        an install.
265
266    11. Push your changes to a directory accessible in the production environment.
267        In the case of scripts, this is equivalent to your AFS homedir, and
268        the production environment is a scripts.mit.edu.  We're going to
269        perform a configuration in the production environment to extract
270        out the canonical configuration files.
271
272    12. On the production server, call your wizard to perform an installation;
273        be sure to use the option --no-commit in order to make propagating changes
274        back easier.  Inspect the generated configuration files (you can use `git
275        status` to find unversioned files that the installer created), and
276        implement:
277             - extractors
278             - substitutions
279                 These are dictionaries of functions that perform extraction
280                 and substitution of variables from config files.  You don't
281                 actually have to hand code them; you can app.make_extractors
282                 and app.make_substitutions on a common dictionary.  Check
283                 out wizard/app/__init__.py for more information on this
284                 format, as well as other files for samples.
285                 (XXX: extended instructions here)
286             - parametrized_files
287                 These are any files that contain WIZARD_* variables
288             - checkConfig()
289                 This is a simple, fs based check on whether or not the application
290                 was configured.  Usually checking if some generated config file
291                 is present is sufficient
292             - detectVersion()
293                 You might be able to reuse machinery from extractors (namely, whatever
294                 function you were using to generate regular expressions), or you might
295                 need to code a custom regular expression to parse this out.
296             - deprecated_keys?
297                 Usually you won't need this; use it if there's a configuration variable
298                 that needs to get parametrized, but isn't actually necessary and
299                 gets obsoleted in a later version.  You probably won't know if that's
300                 the case until later.
301
302     13. With these implemented, `wizard prepare-config` should now work if you run
303         it on the installed copy.  The configuration file should now contain only
304         generic WIZARD_* variables, and no user-specific config.  If it is, your
305         script was buggy; try again.
306
307     14. The current changes in the working copy should be merged in.  Add any new
308         files, and then `git commit --amend`.  `git push --force` to stick these
309         changes back in the "public" repository.
310
311     15. In your local copy, you can pull the changes by doing `git reset --hard HEAD~`
312         and then a `git pull` from the relevant source.  Otherwise, Git will complain
313         about a non-fast-forward.
314
315     16. Congratulations!  You've implemented the installation code for a new install.
316         Now goto "ENTER HERE FROM CREATING A NEW REPO" and finish the rest of the
317         instructions.
318