3 Why I needed this plugin: I have two web servers available to me
4 for a project. Neither does everything I need, but together they
5 do. (This is a bit like the [Amazon S3
6 scenario](http://kitenet.net/~joey/blog/entry/running_a_wiki_on_Amazon_S3/).)
8 Server (1) is a university web server. It provides plentiful space
9 and bandwidth, easy authentication for people editing the wiki, and
10 a well-known stable URL. The wiki really wants to live here and
11 very easily could except that the server doesn't allow arbitrary
14 Server (2) is provided by a generous alumnus's paid [[tips/DreamHost]]
15 account. Disk and particularly network usage need to be minimized
16 because over some threshold it costs him. CGI, etc. are available.
18 My plan was to host the wiki on server (1) by taking advantage of
19 server (2) to store the repository, source checkout, and generated
20 pages, to host the repository browser, and to handle ikiwiki's CGI
21 operations. In order for this to work, web edits on (2) would need
22 to automatically push any changed pages to (1).
24 As a proof of concept, I added an rsync post-commit hook after
25 ikiwiki's usual. It worked, just not for web edits, which is how
26 the wiki will be used. So I wrote this plugin to finish the job.
27 The wiki now lives on (1), and clicking "edit" just works. --[[schmonz]]
29 > Just out of interest, why use `rsync` and not `git push`. i.e. a
30 > different setup to solve the same problem would be to run a
31 > normal ikiwiki setup on the universities server with its git
32 > repository available over ssh (same security setup your using
33 > for rsync should work for git over ssh). On the cgi-capable server,
34 > when it would rsync, make it git push. It would seem that git
35 > has enough information that it should be able to be more
36 > network efficient. It also means that corruption at one end
37 > wouldn't be propagated to the other end. -- [[Will]]
39 >> Hey, that's a nice solution. (The site was in svn to begin with,
40 >> but it's in git now.) One advantage of my approach in this particular
41 >> case: server (1) doesn't have `git` installed, but does have `rsync`,
42 >> so (1)'s environment can remain completely untweaked other than the
43 >> SSH arrangement. I kind of like that all the sysadmin effort is
44 >> contained on one host.
46 >> This plugin is definitely still useful for projects not able to use
47 >> a DVCS (of which I've got at least one other), and possibly for
48 >> other uses not yet imagined. ;-) --[[schmonz]]
50 >>> I'm now using this plugin for an additional purpose. One of the aforementioned wikis (there are actually two) can only be read by trusted users, the list of which is kept in an `.htaccess` file. I added it to git as `htaccess.txt`, enabled the [[plugins/txt]] plugin, and in my `rsync_command` script, have it copied to the destdir as `.htaccess` before calling `rsync`. Now my users (who aren't tech-savvy, but are trustworthy) can edit the access list directly in the wiki. This idea might also be useful for wikis not using `rsync` at all. --[[schmonz]]
56 * I think it should not throw an error if no command is set. Just don't do anything.
57 * If the rsync fails, it currently errors out, which will probably also leave
58 the wiki in a broken state, since ikiwiki will not get a chance to save
59 its state. This seems fragile; what if the laptop is offline, or the
60 server is down, etc. Maybe it should just warn if the rsync fails?
61 * Is a new hook really needed? The savestate hook runs at a similar time;
62 only issue with it is that it is run even when ikiwiki has not
63 rendered any updated pages. Bah, I think you do need the new hook, how
66 > * Depends whether the plugin would be on by default. If yes, then yes.
67 > If the admin has to enable it, I'd think they'd want the error.
68 > * Changed the other errors to warnings.
69 > * The name might be wrong: there isn't anything rsync-specific about the
70 > plugin, that's just the command I personally need to run. --[[schmonz]]
72 >> One problem with the error is that it prevents dumping a new setup file with
73 >> the plugin enabled, and then editing it to configure. ie:
75 joey@gnu:~>ikiwiki -setup .ikiwiki/joeywiki.setup -plugin rsync -dumpsetup new.setup
76 Must specify rsync_command
78 > rsync seems by far the most likely command, though someone might use something
79 > to push via ftp instead. I think calling it rsync is ok. --[[Joey]]