5 - Check how many autoinstalls are missing w bits for
6 daemon.scripts (this would need pyafs)
8 - Migrate all mediawikis
9 - Wordpress needs to have a .scripts/update script written for
14 - A perfectly formed autoinstall with upgrade paths for all of
15 the intervening versions is not really feasible to implement.
16 As such, we want to migrate everything to -scripts, and then
17 generate a -scripts2 with the correct .scripts directory.
18 We will then nop update some installs, but this will prevent
19 us from having to migrate and update concurrently. Treat
20 a scripts2 upgrade from migration the same way you would treat
21 a botched scripts upgrade.
23 - summary and info are still not using loggers. Maybe they should,
24 maybe they shouldn't. Using loggers means we lose interactivity
27 - Currently all repositories are initialized with --shared, which
28 means they have basically ~no space footprint. However, it
29 also means that /mit/scripts/wizard/srv MUST NOT lose revs.
31 - Full fledged logging options. Namely:
32 x all loggers (delay implementing this until we actually have debug stmts)
34 - debug => loglevel = DEBUG
36 - default is WARNING (see below for exception)
37 - verbose => loglevel = INFO
38 x file logger (only allowed for serial processing)
40 - log-file => loglevel = INFO
41 x database logger (necessary for parallel processing, not implemented)
43 - log-db => loglevel = INFO
45 - More on the database logger: it will be very simple with one
46 table named `logs` in SQLite, with columns: `job`, `level`,
47 `message`. Job identifies the subprocess/thread that emitted
48 the log, so things can be correlated together. We will then
49 have `wizard dump` which takes a database like this and dumps
50 it into a file logger type file. The database may also store
51 a queue like structure which can be used to coordinate jobs.
55 * Some parts of the infrastructure will not be touched, although I plan
56 on documenting them. Specifically, we will be keeping:
58 - parallel-find.pl, and the resulting
59 /mit/scripts/sec-tools/store/scriptslist
60 This script might need to be adapted if we decide to nuke
61 .scripts-version files.
63 - The current install scripts will be kept in place, sans changes
64 necessary to make them use Git install of copying the script over.
65 Porting these scripts to Python and making them modular would be
66 nice, but is priority. For the long term, seeing this scripts
67 be packaged with rest of our code would be optimal.
69 * The new procedure for generating an update is as follows:
70 (check out the mass-migration instructions for something in this spirit,
71 although uglier in some ways)
73 0. ssh into not-backward, temporarily give the daemon.scripts-security-upd
74 bits by blanching it on system:scripts-security-upd, and run parallel-find.pl
76 1. Have the Git repository and working copy for the project on hand.
78 2. Checkout the pristine branch
80 3. Remove all files from the working copy. Use `wipe-working-dir`
82 4. Download the new tarball
84 5. Extract the tarball over the working copy (`cp -R a/. b` works well,
85 remember that the working copy is empty)
87 6. Check for empty directories and add stub files as necessary.
88 Use `preserve-empty-dir`
90 7. Git add it all, and then commit as a new pristine version (v1.2.3)
92 8. Checkout the master branch
94 9. [FOR EXISTING REPOSITORIES]
95 Merge the pristine branch in. Resolve any conflicts that our
96 patches have with new changes. Do NOT let Git auto-commit it
97 with --no-commit (otherwise, you want to git commit --amend
98 to keep our history clean
100 [FOR NEW REPOSITORIES]
101 See if any patches are needed to make this run smoothly on
104 [FOR NEW REPOSITORIES]
106 echo "Deny from all" > .scripts/.htaccess
107 touch .scripts/update
108 chmod a+x .scripts/update
110 10. Check if there are any special update procedures, and update/create the
111 .scripts/update shell script as necessary (this means that any
112 application specific update logic will be kept with the actual
113 source code. The language of this update script will vary
114 depending on context.)
116 11. Commit your changes, and tag as v1.2.3-scripts (or scripts2, if
117 you are amending an install without an upstream changes)
119 12. Test the new update procedure using
120 `wizard upgrade --with=/path/to/repo /your/autoinstall` (this will
121 read out master as your "latest" version).
122 Use git commit --amend to fix any bugs (alternatively, squash them
125 13. You can also do a "mass" version of this using:
126 `wizard -d testbed.txt massupgrade --with=/path/to/repo app`
127 You'll need perms for any testbed stuff you want.
129 GET APPROVAL BEFORE PROCEEDING ANY FURTHER
131 NOTE: The following commands are to be run on not-backward.mit.edu.
132 You'll need to add daemon.scripts-security-upd to
133 scripts-security-upd to get bits to do this. Make sure you remove
134 these bits when you're done.
136 14. Run `wizard research appname`
137 which uses Git commands to check how many
138 working copies apply the change cleanly, and writes out a logfile
139 with the working copies that don't apply cleanly. It also tells
140 us about "corrupt" working copies.
142 15. Run `wizard massupgrade appname`, which applies the update to all working
143 copies possible, and sends mail to users to whom the working copy
144 did not apply cleanly. It also frobs .scripts-version for successful
145 upgrades (maybe not, depending on our plans).
147 16. Run parallel-find.pl to update our inventory
149 * For mass importing into the repository, the steps are:
150 (this probably won't ever be automated, becuase there are fiddly bits)
153 # let app-1.2.3 be the scripts folder originally in deploydev
154 # let this folder be srv/
155 # you can also do a git clone
160 unfurl app-1.2.3 app # [FIDDLY BIT]
161 # NOTE: contents of application are now in app directory
164 git commit -s -m "App 1.2.3"
167 # NOTE: you're still on master branch
168 # WARNING: the following operation might require -p1
169 patch -p0 < ../app-1.2.3/app-1.2.3.patch # [FIDDLY BIT]
170 # NOTE: please sanity check the patch!
172 # NOTE: -a flag is to handle if the patch deleted something
173 git commit -as -m "App 1.2.3-scripts"
174 git tag v1.2.3-scripts
177 # let this folder be srv/app.git
178 git checkout pristine
179 # NOTE: this preserves your .git folder, but removes everything
182 unfurl app-1.2.3 app # [FIDDLY BIT]
184 # NOTE: please sanity check app directory
186 # NOTE: -a is to take care of deletions
187 git commit -as -m "App 1.2.3"
189 [FIDDLE AROUND. FIDDLE AROUND]
190 [IF THE PATCH HAS CHANGED]
191 # You are on the pristine branch
192 # NOTE: Now, the tricky part (this is different from a real update)
193 git symbolic-ref HEAD refs/heads/master
194 # NOTE: Now, we think we're on the master branch, but we have
195 # pristine copy checked out
196 # NOTE: -p0 might need to be twiddled
197 patch -p0 < ../app-1.2.3/app-1.2.3.patch
199 # COMMENT: used to git checkout .scripts here
200 # then check if the directory needs an updated update script
201 # NOTE: Fake the merge
202 git rev-parse pristine > .git/MERGE_HEAD
203 [IF THE PATCH HASN'T CHANGED]
205 git merge --no-commit pristine
206 git commit -as -m "App 1.2.3-scripts"
207 git tag v1.2.3-scripts
210 * The repository for a given application will contain the following files:
212 - The actual application's files, as from the official tarball
214 - A .scripts directory, which contains the following information:
216 * .scripts/update shell script (with the +x bit set appropriately),
217 which performs the commands necessary to update a script. This can
220 * .scripts/.htaccess to prevent this directory from being accessed
223 * .scripts/database (generated) contains the database the
224 user installed the script to, so scripts-remove can clean it
226 XXX: Could cause problems if a user copies the autoinstall,
227 fiddles with the DB credentials, and then scripts-remove's
228 the autoinstall. Possible fix is to add the original
229 directory as a sanity check. Additionally, we could have
230 the application read out of this file.
232 * .scripts/version (generated) which contains the version
233 last autoinstalled (as distinct from the actual version
234 the script is) (This is the same as .scripts-version right
235 now; probably want to keep that for now)
237 XXX: It's unclear if we want to move to this wholesale, or
238 delay this indefinitely. quentin thinks that the Git
239 repository itself is a sufficient record.
241 * The migration process has been implemented, see 'wizard migrate'.
243 XXX: We have not decided what migration should do to .scripts-version;
244 if it does move it to .scripts, repositories should have a .gitignore
247 * The autoupgrade shall be the process of:
249 # Make the directory not accessible by the outside world (htaccess, but be careful!)
251 git commit -m 'automatically generated backup'
252 git pull origin master
253 if [ $? ne 0 ]; then git reset --hard; echo 'conflicts during upgrade'; fi
257 (with some more robust error checking, a proper dry run mechanism to, and
260 * All code that operates on an untrusted Git repository, or runs
261 executable code, should be done on NOT-BACKWARD.mit.edu. Pending
262 accounts confirmation, it will also get a principal
263 daemon.scripts-security-upd, which is what we'll actually put
264 in the scripts-security-upd group. parallel-find.pl should also
265 be run on not-backward, by virtue of its fat pipe to the AFS servers.
267 * Make 'wizard summary' generate nice pretty graphs of installs by date
268 (more histograms, will need to check actual .scripts-version files.)