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