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