Merge commit 'micah/master'
[monkeysphere.git] / website / mirrors.mdwn
1 [[meta title="Mirroring the web site"]]
2
3 In keeping with the philosophy of distributed development, our web site is
4 stored in our git repositories and converted into html by
5 [ikiwiki](http://ikiwiki.info/).
6
7 We're mirrored on several servers. Rather than using ikiwiki's [pinger/pingee
8 approach to distribution](http://ikiwiki.info/tips/distributed_wikis/), we've
9 opted for a method that uses ssh.
10
11 ## Initial steps to take on the mirror server ##
12
13 Add etch-backports to your /etc/apt/sources.list:
14
15     deb http://www.backports.org/debian etch-backports main contrib non-free
16
17 Add the following lines to your /etc/apt/preferences file:
18
19     Package: ikiwiki
20     Pin: release a=etch-backports
21     Pin-Priority: 999
22
23     # needed by ikiwiki
24     Package: libcgi-formbuilder-perl
25     Pin: release a=etch-backports
26     Pin-Priority: 999
27     
28     Package: git-core 
29     Pin: release a=etch-backports
30     Pin-Priority: 999
31
32 Install git-core and ikiwiki
33
34     aptitude update; aptitutde install git-core ikiwiki
35
36 Create a new user. Change the new users shell to git-shell:
37
38     adduser -s /usr/bin/git-shell <username>
39
40 Add webmaster@george's public key to this user's ~/.ssh/authorized_keys file
41
42 Add web site configuration that the user has write access to. If you are using Apache, include the following rewrite:
43
44     RewriteEngine On
45     RewriteCond %{HTTP_HOST} !^(YOURHOSTNAME|web)\.monkeysphere\.info$ [NC]
46     RewriteCond %{HTTP_HOST} !^$
47     RewriteRule ^/(.*) http://web.monkeysphere.info/$1 [L,R]
48
49 Upload and edit ikiwiki.setup.sample from the docs directory
50
51 As the new user, create a git repo
52
53     mkdir monkeysphere.git; cd monkeysphere.git; git init --bare;
54
55
56 ## Initial Admin steps to take to enable the configuration ##
57
58 Add a new dns record for SERVERNAME.monkeysphere.info. 
59
60 Test the ssh connection by logging in as webmaster@george.riseup.net
61
62 Add the new server as a remote on webmaster@george.riseup.net:monkeysphere.git
63
64     cd ~/monkeysphere.git
65     git add remote SERVERNAME USER@SERVERNAME.monkeysphere.info:/path/to/repo
66
67 Modify ~/monkeysphere.git/config, so the new repo stanza looks like this:
68
69     [remote "SERVERNAME"]
70                 url = USER@SERVERNAME.monkeysphere.info:monkeysphere.git
71                 push = +refs/heads/master
72                 skipDefaultUpdate = true
73
74 Test:
75
76     git push SERVERNAME
77
78
79 ## Final steps to take on mirror server ##
80
81 At this point, you should have a populated git repo in your
82 monkeyshere.git directory. 
83
84 Change the mode of monkeysphere.git/hooks/post-receive to 755
85
86     chmod 755 monkesphere.git/hooks/post-receive
87
88 Edit the file so that it executes the post-receive hook ikiwiki generates (as
89 you specified in the ikiwiki.setup file)
90
91 Next, clone the repository:
92
93     clone monkeysphere.git monkeysphere
94
95 And lastly, run ikiwiki manually to generate the post-receive hook:
96
97     ikiwiki --setup ikiwiki.setup
98