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