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