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