]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - doc/tips/Git_repository_and_web_server_on_different_hosts.mdwn
Merge remote-tracking branch 'smcv/pagestats-show'
[git.ikiwiki.info.git] / doc / tips / Git_repository_and_web_server_on_different_hosts.mdwn
1 [[!meta date="2008-10-19 18:33:59 -0400"]]
3 One may want to provide ikiwiki hosting with [[rcs/git]]+ssh access and web
4 server located at different hosts. Here's a description for such
5 a setup, using password-less SSH as a way of communication between
6 these two hosts.
8 [[!img separate-webserver.svg size=490x align=right]]
10 Git server
11 ==========
13 Let's create a user called `ikiwiki_example`. This user gets SSH
14 access restricted to GIT pull/push, using `git-shell` as a shell.
16 The root (bare) repository:
18 - is stored in `~ikiwki_example/ikiwiki_example.git`
19 - is owned by `ikiwiki_example:ikiwiki_example`
20 - has permissions 0700
22 The master repository's post-update hook connects via SSH to
23 `webserver` as user `ikiwiki_example`, in order to run
24 `~/bin/ikiwiki.update` on `webserver`; this post-update hook, located
25 in `~ikiwki_example/ikiwiki_example.git/hooks/post-update`, is
26 executable and contains:
28         #!/bin/sh
29         /usr/bin/ssh ikiwiki_example@webserver bin/ikiwiki.update
31 Password-less SSH must be setup to make this possible; one can
32 restrict `gitserver:ikiwiki_example` to be able to run only the needed
33 command on the web server, using such a line in
34 `webserver:~ikiwiki_example/.ssh/authorized_keys`:
36         command="bin/ikiwiki.update",from="gitserver.example.com",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa ...
38 Web server
39 ==========
41 Let's create a user called `ikiwiki_example` on `webserver`. She needs
42 to have write permission to the destination directory.
44 The working tree repository (`srcdir`):
46 - is stored in `~ikiwki_example/src`
47 - is owned by `ikiwiki_example:ikiwiki_example`
48 - has permissions 0700
49 - has the following origin: `ikiwiki_example@gitserver:ikiwiki_example.git`
51 The CGI wrapper is generated with ownership set to
52 `ikiwiki_example:ikiwiki_example` and permissions `06755`.
54 Password-less SSH must be setup so that `ikiwiki_example@webserver` is
55 allowed to push to the master repository. As told earlier, SSH access
56 to `ikiwiki_example@gitserver` is restricted to GIT pull/push, which
57 is just what we need.
59 The Git wrapper is generated in `~ikiwiki_example/bin/ikiwiki.update`:
61         git_wrapper => '/home/ikiwiki_example/bin/ikiwiki.update'
63 As previously explained, this wrapper is run over SSH by the master
64 repository's post-update hook; it pulls updates from the master
65 repository and triggers a wiki refresh.