]> scripts.mit.edu Git - wizard.git/blob - TODO
Drastically improved TODO docs and bin.
[wizard.git] / TODO
1 The Git Autoinstaller
2
3 TODO NOW:
4
5 - Fix mediawiki repository (has lots of stale files and a weird
6   history. This also means that the ichuang wiki will need to be
7   remigrated; frob .scripts-version to make it acceptable, but
8   otherwise should be fairly trivial).  When I say "fix", I mean
9   "redo". Thorough documentation would be good too.  Some bits
10   can be automated and/or have tools to assist it
11 - Whiteboard the flow for performing an upgrade on a single
12   install. How assisted does it need to be?
13 - Conduct migration tool testing
14 - Create mass-migration tool (should be able to limit on mediawiki)
15 - Run parallel-find.pl
16 - Migrate all mediawikis
17
18 OVERALL PLAN:
19
20 * Some parts of the infrastructure will not be touched, although I plan
21   on documenting them.  Specifically, we will be keeping:
22
23     - parallel-find.pl, and the resulting
24 /mit/scripts/sec-tools/store/scriptslist
25
26     - The current install scripts will be kept in place, sans changes
27       necessary to make them use Git install of copying the script over.
28       Porting these scripts to Python and making them modular would be
29       nice, but is priority.  For the long term, seeing this scripts
30       be packaged with rest of our code would be optimal.
31
32 * The new procedure for generating an update is as follows (this is
33   also similar to procedure for creating these repositories):
34
35     1. Have the Git repository and working copy for the project on hand.
36
37     2. Checkout the pristine branch
38
39     3. Remove all files from the working copy (rm -Rf *, and then delete
40        any dot stragglers.  A script to do this would be handy)
41
42     4. Download the new tarball
43
44     5. Extract the tarball over the working copy (`cp -R a/. b` works well,
45        remember that the working copy is empty)
46
47     6. Check for empty directories and add stub files as necessary
48        (use preserve-empty-dir)
49
50     7. Git add it all, and then commit as a new pristine version (v1.2.3)
51
52     8. Checkout the master branch
53
54     9. [FOR EXISTING REPOSITORIES]
55        Merge the pristine branch in. Resolve any conflicts that our
56        patches have with new changes. Do NOT let Git auto-commit it
57        with --no-commit (otherwise, you want to git commit --amend
58        to keep our history clean
59
60        [FOR THE FIRST TIME]
61        Apply the scripts patch that was used for that version here
62        (usually patch -p1 < patch)
63
64    10. Check if there are any special update procedures, and update the
65        .scripts/update shell script as necessary (this means that any
66        application specific update logic will be kept with the actual
67        source code.  The language of this update script will vary
68        depending on context.)
69
70    11. Commit your changes, and tag as v1.2.3-scripts
71
72    If you're setting up a repository from scratch, stop here, and
73    repeat as necessary
74
75        XXX: Should we force people to push to the real repository at
76        this point, or just make the repository that the script pulls
77        stuff out of configurable? (Twiddling origin can get you a
78        devel setup with no code changes)
79
80    12. Run the "dry-run script", which uses Git commands to check how many
81        working copies apply the change cleanly, and writes out a logfile
82        with the working copies that don't apply cleanly.
83
84    13. Run the "limited run" script, which applies the update to our
85        test-bed, and lets us check the basic functionality of the update.
86        This can include a script that lets us update a single directory
87        with verbose output.
88
89    14. Run the "deploy" script, which applies the update to all working
90        copies possible, and sends mail to users to whom the working copy
91        did not apply cleanly. It also frobs .scripts/version for successful
92        upgrades.
93
94    15. Run parallel-find.pl
95
96 * For mass importing into the repository, the steps are:
97
98 [TO SET IT UP]
99 # let app-1.2.3 be the scripts folder originally in deploydev
100 # let this folder be srv/
101 mkdir app
102 cd app
103 git init
104 cd ..
105 unfurl app-1.2.3 app
106 # NOTE: contents of application are now in app directory
107 cd app
108 git add .
109 git commit -s -m "App 1.2.3"
110 git tag v1.2.3
111 git branch pristine
112 # NOTE: you're still on master branch
113 mkdir .scripts
114 echo "Deny from all" > .scripts/.htaccess
115 touch .scripts/update
116 chmod a+x .scripts/update
117 # OPERATION: create the update script
118 # WARNING: the following operation might require -p1
119 patch -p0 < ../app-1.2.3/app-1.2.3.patch
120 # NOTE: please sanity check the patch!
121 git add .
122 # NOTE: -a flag is to handle if the patch deleted something
123 git commit -as -m "App 1.2.3-scripts"
124 git tag v1.2.3-scripts
125
126 [TO ADD AN UPDATE]
127 # let this folder be srv/app.git
128 git checkout pristine
129 # NOTE: this preserves your .git folder, but removes everything
130 wipe-working-dir .
131 cd ..
132 unfurl app-1.2.3 app
133 cd app
134 # NOTE: please sanity check app directory
135 git add .
136 # NOTE: -a is to take care of deletions
137 git commit -as -m "App 1.2.3"
138 git tag v1.2.3
139 [IF THE PATCH HAS CHANGED]
140     # NOTE: Now, the tricky part (this is different from a real update)
141     git symbolic-ref HEAD refs/heads/master
142     # NOTE: Now, we think we're on the master branch, but we have
143     # pristine copy checked out
144     # NOTE: -p0 might need to be twiddled
145     patch -p0 < ../app-1.2.3/app-1.2.3.patch
146     git add .
147     # NOTE: DON'T FORGET THIS STEP!!! Otherwise fixing this is going
148     # to be painful later down the line
149     git checkout .scripts
150     # OPERATION: Check if the directory needs an updated update script
151     # NOTE: Fake the merge
152     git rev-parse pristine > .git/MERGE_HEAD
153 [IF THE PATCH HASN'T CHANGED]
154     git checkout master
155     git merge --no-commit pristine
156 git commit -as -m "App 1.2.3-scripts"
157 git tag v1.2.3-scripts
158
159
160 * The repository for a given application will contain the following files:
161
162     - The actual application's files, as from the official tarball
163
164     - A .scripts directory, which contains the following information:
165
166         * .scripts/update shell script (with the +x bit set appropriately),
167           which performs the commands necessary to update a script.  This can
168           be in any language.
169
170         * .scripts/.htaccess to prevent this directory from being accessed
171           from the web.
172
173         * .scripts/database (generated) contains the database the
174           user installed the script to, so scripts-remove can clean it
175
176             XXX: Could cause problems if a user copies the autoinstall,
177             fiddles with the DB credentials, and then scripts-remove's
178             the autoinstall.  Possible fix is to add the original
179             directory as a sanity check.  Additionally, we could have
180             the application read out of this file.
181
182         * .scripts/version (generated) which contains the version
183           last autoinstalled (as distinct from the actual version
184           the script is) (This is the same as .scripts-version right
185           now; probably want to keep that for now)
186
187             XXX: It's unclear if we want to move to this wholesale, or
188             delay this indefinitely.
189
190 * The migration process has been implemented, see 'wizard migrate'.
191
192     XXX: We have not decided what migration should do to .scripts-version;
193     if it does move it to .scripts, repositories should have a .gitignore
194     in those directories
195
196 * The autoupgrade shall be the process of:
197
198     # Make the directory not accessible by the outside world (htaccess, but be careful!)
199     git add -u .
200     git commit -m 'automatically generated backup'
201     git pull origin master
202     if [ $? ne 0 ]; then git reset --hard; echo 'conflicts during upgrade'; fi
203     ./.scripts/update
204     # Make it accessible
205
206   (with some more robust error checking)
207
208 * Make 'wizard summary' generate nice pretty graphs of installs by date
209   (more histograms, will need to check actual .scripts-version files.)