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