Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > d8544620e4ac7bee48ddb48c85d55709 > files > 555

ikiwiki-3.20190228-1.mga7.noarch.rpm

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>distributed wikis</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="stylesheet" href="../style.css" type="text/css" />

<link rel="stylesheet" href="../local.css" type="text/css" />










</head>
<body>

<div class="page">

<div class="pageheader">
<div class="header">
<span>
<span class="parentlinks">

<a href="../index.html">ikiwiki</a>/ 

<a href="../tips.html">tips</a>/ 

</span>
<span class="title">
distributed wikis

</span>
</span>



</div>









</div>





<div id="pagebody">

<div id="content" role="main">
<p><a href="../rcs/git.html">git</a> and other distributed version control systems are all about
making it easy to create and maintain copies and branches of a project. And
this can be used for all sorts of interesting stuff. Since ikiwiki can use
git, let's explore some possibilities for distributed wikis.</p>

<div class="toc">
	<ol>
		<li class="L2"><a href="#index1h2">Overview</a>
		<ol>
			<li class="L3"><a href="#index1h3">Default setup - one central server</a>
			</li>
			<li class="L3"><a href="#index2h3">Separate webserver and git repository</a>
			</li>
			<li class="L3"><a href="#index3h3">Separate webserver and git repository, the git srcdir being hosted on the webserver</a>
			</li>
			<li class="L3"><a href="#index4h3">Decentralised pinger setup</a>
			</li>
			<li class="L3"><a href="#index5h3">Fully decentralised setup</a>
			</li>
		</ol>
		</li>
		<li class="L2"><a href="#index2h2">Step by step setup instructions</a>
		<ol>
			<li class="L3"><a href="#index6h3">Installing ikiwiki</a>
			</li>
			<li class="L3"><a href="#index7h3">Setting up the wiki</a>
			</li>
			<li class="L3"><a href="#index8h3">Basic HTML rendering</a>
			</li>
			<li class="L3"><a href="#index9h3">Webserver configuration</a>
			</li>
			<li class="L3"><a href="#index10h3">Enable the pinger functionality</a>
			</li>
			<li class="L3"><a href="#index11h3">Fully decentralized configuration</a>
			</li>
		</ol>
		</li>
		<li class="L2"><a href="#index3h2">Other ideas</a>
		<ol>
			<li class="L3"><a href="#index12h3">Announcing the mirror</a>
			</li>
			<li class="L3"><a href="#index13h3">branching a wiki</a>
			</li>
		</ol>
		</li>
	</ol>
</div>

<h2><a name="index1h2"></a>Overview</h2>

<p>There are several possible level of decentralisation:</p>

<ol>
<li><a href="../rcs/git.html">default setup</a>, no decentralisation</li>
<li><a href="./Git_repository_and_web_server_on_different_hosts.html">a simple HTML mirror</a></li>
<li><a href="./Hosting_Ikiwiki_and_master_git_repository_on_different_machines.html">separate ikiwiki and git servers</a></li>
<li>separate <code>srcdir</code>, still requires a central bare repo - uses <a href="../plugins/pinger.html">pinger</a></li>
<li>completely distinct ikiwiki installs</li>
</ol>

<p>Here's a graphic overview of those:</p>

<h3><a name="index1h3"></a>Default setup - one central server</h3>

<p><a href="../rcs/git/wiki_edit_flow.svg"><img src="../rcs/git/wiki_edit_flow.svg" width="400" class="img" /></a></p>

<p>In the default setup, all the resources are stored on the central
servers. Users can still clone and edit the git repo by hand and
contribute by git, but otherwise all the changes happen on a single
web interface. This basic setup is best described in <a href="../rcs/git.html">git</a>.</p>

<h3><a name="index2h3"></a>Separate webserver and git repository</h3>

<p><a href="./Git_repository_and_web_server_on_different_hosts/separate-webserver.svg"><img src="./Git_repository_and_web_server_on_different_hosts/separate-webserver.svg" width="400" class="img" /></a></p>

<p>This is the configuration described in
<a href="./Git_repository_and_web_server_on_different_hosts.html">Git repository and web server on different hosts</a>. The webserver part
hosts the HTML files, the ikiwiki <a href="../cgi.html">cgi</a> but everything else is on
the git server.</p>

<h3><a name="index3h3"></a>Separate webserver and git repository, the git srcdir being hosted on the webserver</h3>

<p><a href="./Hosting_Ikiwiki_and_master_git_repository_on_different_machines/separate-web-git-servers.svg"><img src="./Hosting_Ikiwiki_and_master_git_repository_on_different_machines/separate-web-git-servers.svg" width="400" class="img" /></a></p>

<p>This is the configuration described in
<a href="./Hosting_Ikiwiki_and_master_git_repository_on_different_machines.html">Hosting Ikiwiki and master git repository on different machines</a>. One server hosts the web server (and the <a href="../cgi.html">Ikiwiki cgi</a>) and the git source dir; a second server hosts the git bare repository. This can be used when you have very limited access to the git server.</p>

<h3><a name="index4h3"></a>Decentralised pinger setup</h3>

<p><a href="./distributed_wikis/ping-setup.svg"><img src="./distributed_wikis/ping-setup.svg" width="400" class="img" /></a></p>

<p>In this configuration, the mirrors all have their own <code>srcdir</code>, but
still need to push and pull from the same central bare git repo. The
<a href="../plugins/pinger.html">pinger</a> plugin is used to ping the mirrors from the central
server on edits.</p>

<p>Step by step setup instructions for this are detailed below.</p>

<h3><a name="index5h3"></a>Fully decentralised setup</h3>

<p><a href="./distributed_wikis/decentralized_wikis.svg"><img src="./distributed_wikis/decentralized_wikis.svg" width="400" class="img" /></a></p>

<p>In this configuration, each wiki is fully independent and pushes its
changes to other wikis using git.</p>

<h2><a name="index2h2"></a>Step by step setup instructions</h2>

<p>The first two ways of setting up ikiwiki are better described in <a href="../setup.html">setup</a> or <a href="./Git_repository_and_web_server_on_different_hosts.html">Git repository and web server on different hosts</a>. The remainder of this page describes the latter two more complex distributed setups. </p>

<p>Say you have a friend that has already configured a shiny ikiwiki site, and you want to help by creating a mirror. You still need to figure out how to install ikiwiki and everything, hopefully this section will help you with that.</p>

<p>Note that parts of the following documentation duplicate instructions from <a href="../setup.html">setup</a>, <a href="../setup/byhand.html">byhand</a>, <a href="../rcs/git.html">git</a> and <a href="./laptop_wiki_with_git.html">laptop wiki with git</a>.</p>

<h3><a name="index6h3"></a>Installing ikiwiki</h3>

<p>You need to install the ikiwiki package for the mirror to work. You can use ikiwiki to publish the actual HTML pages elsewhere if you don't plan on letting people edit the wiki, but generally you want the package to be installed on the webserver for editing to work.</p>

<pre><code>apt-get install ikiwiki
</code></pre>

<h3><a name="index7h3"></a>Setting up the wiki</h3>

<p><img src="../smileys/idea.png" alt="(!)" /> Optionnally: create a user just for this wiki. Otherwise the wiki will run as your user from here on.</p>

<p>We assume your username is <code>user</code> and that you will host the wiki under the hostname <code>mirror.example.com</code>. The original wiki is at <code>wiki.example.com</code>. We also assume that your friend was nice enough to provide a copy of the <code>.setup</code> file in the <code>setup</code> branch, which is the case for any wiki hosted on <a href="http://branchable.com">branchable.com</a>.</p>

<pre><code>cd ~user
# setup srcdir, named source
git clone git://wiki.example.com/ source
# convenience copy of the setup file
git clone -b origin/setup source setup
cd setup
edit ikiwiki.setup # adapt configuration
</code></pre>

<p>When editing ikiwiki.setup, make sure you change the following entries:</p>

<pre><code>cgiurl: http://mirror.example.com/ikiwiki.cgi
cgi_wrapper: /var/www/ikiwiki.cgi
srcdir: /home/user/source
destdir: /var/www/mirror.example.com
libdir: /home/user/source/.ikiwiki
git_wrapper: /home/user/source/.git/hooks/post-commit
git_test_receive_wrapper: /home/user/source/.git/hooks/pre-receive
ENV:
  TMPDIR: /home/user/tmp
</code></pre>

<p>This assumes that your /var/www directory is writable by your user.</p>

<h3><a name="index8h3"></a>Basic HTML rendering</h3>

<p>You should already be able to make a plain HTML rendering of the wiki:</p>

<pre><code>ikiwiki --setup ikiwiki.setup
</code></pre>

<h3><a name="index9h3"></a>Webserver configuration</h3>

<p>You will also need a webserver to serve the content in the <code>destdir</code>
defined above. We assume you will configure a virtual host named <code>mirror.example.com</code>. Here are some examples on how to do those, see <a href="http://ikiwiki.info/setup/">setup</a> and <a href="http://ikiwiki.info/tips/dot_cgi/">tips/dot cgi</a> for complete documentation.</p>

<p>Note that this will also configure CGI so that people can edit the wiki. Note that this configuration may involve timeouts if the main site is down, as ikiwiki will attempt to push to the central git repository at every change.</p>

<h4><a name="index1h4"></a>Apache configuration</h4>

<pre><code>&lt;VirtualHost *:80&gt;
    ServerName mirror.example.com:80
    DocumentRoot /var/www/mirror.example.com
    &lt;Directory /var/www/mirror.example.com&gt;
        Options Indexes MultiViews ExecCGI
        AllowOverride None
        Order allow,deny
        allow from all
    &lt;/Directory&gt;
    ScriptAlias /ikiwiki.cgi /var/www/ikiwiki.cgi
    ErrorDocument 404 "/ikiwiki.cgi"
&lt;/VirtualHost&gt;
</code></pre>

<h4><a name="index2h4"></a>Nginx configuration</h4>

<pre><code>server {
    root /var/www/mirror.example.com/;
    index index.html index.htm;
    server_name mirror.example.com;

    location / {
        try_files &#036;uri &#036;uri/ /index.html;
    }
    location /ikiwiki.cgi {
        fastcgi_pass  unix:/tmp/fcgi.socket;
        fastcgi_index ikiwiki.cgi;
        fastcgi_param SCRIPT_FILENAME   /var/www/ikiwiki.cgi;
        fastcgi_param  DOCUMENT_ROOT      /var/www/mirror.example.com;
        include /etc/nginx/fastcgi_params;
    }
}
</code></pre>

<p>Start this process as your own user (or the user that has write access
to <code>srcdir</code>, <code>destdir</code>, etc):</p>

<pre><code>spawn-fcgi -s /tmp/fcgi.socket -n -- /usr/sbin/fcgiwrap
</code></pre>

<p>Make this writable:</p>

<pre><code>chmod a+w /tmp/fcgi.socket
</code></pre>

<h3><a name="index10h3"></a>Enable the pinger functionality</h3>

<p>At this point, you need to enable the pinger functionality to make sure that changes on the central server propagate to your mirror.</p>

<p>This assumes a central wiki that exposes its git
repository and has the <a href="../plugins/pinger.html">pinger</a> plugin enabled. Enable the
<a href="../plugins/pingee.html">pingee</a> plugin in your configuration, and edit the origin wiki,
adding a ping directive for your mirror:</p>

<pre><code>[[!ping  from="http://thewiki.com/"
to="http://mymirror.com/ikiwiki.cgi?do=ping"]]
</code></pre>

<p>The "from" parameter needs to be the url to the origin wiki. The "to" parameter
is the url to ping on your mirror. This can be done basically in any page.</p>

<p>Now whenever the main wiki is edited, it will ping your mirror, which will
pull the changes from "origin" using git, and update itself. It could, in
turn ping another mirror, etc.</p>

<p>And if someone edits a page on your mirror, it will "git push origin",
committing the changes back to the origin git repository, and updating the
origin mirror. Assuming you can push to that git repository. If you can't,
and you want a mirror, and not a branch, you should disable web edits on
your mirror. (You could also point the cgiurl for your mirror at the origin
wiki if you do not want to incur that overhead or do not want to, or can't, run a CGI.)</p>

<h3><a name="index11h3"></a>Fully decentralized configuration</h3>

<p>In the above configuration, the master git repository is still on the main site. If that site goes down, there will be delays when editing the wiki mirror. It could also simply fail because it will not be able to push the changes to the master git repo. An alternative is to setup a local bare repository that is synced with the master.</p>

<p>At the setup step, you need to create <em>two</em> git repositories on the mirror:</p>

<pre><code>cd ~user
# setup base repository, named source.git
git clone --bare git://wiki.example.com/ source.git
# setup srcdir, named source
git clone source.git
# convenience copy of the setup file
git clone -b origin/setup source.git setup
cd setup
edit ikiwiki.setup # adapt configuration
</code></pre>

<p>The following entries will be different from the above setup file:</p>

<pre><code>git_wrapper: /home/user/source.git/hooks/post-commit
git_test_receive_wrapper: /home/user/source.git/hooks/pre-receive
</code></pre>

<p>To make the mirror push back to the master, use, for example:</p>

<pre><code>git_wrapper_background_command: git push git://wiki.example.com/
</code></pre>

<p>This will help ensure that commits done on the mirror will propagate back to the master.</p>

<h2><a name="index3h2"></a>Other ideas</h2>

<p>See also:</p>

<ul>
<li><a href="../setup.html">setup</a></li>
<li><a href="../setup/byhand.html">byhand</a></li>
<li><a href="../rcs/git.html">git</a></li>
<li><a href="./laptop_wiki_with_git.html">laptop wiki with git</a></li>
<li><a href="http://piny.be/jrayhawk/notes/ikiwiki_creation/">ikiwiki creation notes</a></li>
</ul>

<h3><a name="index12h3"></a>Announcing the mirror</h3>

<p>Once your mirror works, you can also add it to the list of mirrors. You can ask the mirror where you take it from (and why not, all mirrors) to add it to their setup file. As an example, here's the configuration for the first mirror:</p>

<pre><code>mirrorlist:
  example: https://wiki.example.com/
</code></pre>

<p>The <a href="../plugins/mirrorlist.html">mirrorlist</a> plugin of course needs to be enabled for this to work.</p>

<h3><a name="index13h3"></a>branching a wiki</h3>

<p>It follows that setting up a branch of a wiki is just like the fully decentralised mirror above, except
we don't want it to push changes back to the origin. The easy way to
accomplish this is to clone the origin git repository using a readonly
protocol (ie, "git://"). Then you can't push to it.</p>

<p>If a page on your branch is modified and other modifications are made to
the same page in the origin, a conflict might occur when that change is
pulled in. How well will this be dealt with and how to resolve it? I think
that the conflict markers will just appear on the page as it's rendered in
the wiki, and if you could even resolve the conflict using the web
interface. Not 100% sure as I've not gotten into this situation yet.</p>

<p>--<span class="createlink">Joey</span></p>

</div>







</div>

<div id="footer" class="pagefooter" role="contentinfo">

<div id="pageinfo">






<div id="backlinks">
Links:

<a href="./Hosting_Ikiwiki_and_master_git_repository_on_different_machines.html">Hosting Ikiwiki and master git repository on different machines</a>


</div>






<div class="pagedate">
Last edited <span class="date">Tue Feb 26 23:01:54 2019</span>
<!-- Created <span class="date">Tue May  6 23:22:09 2008</span> -->
</div>

</div>


<!-- from ikiwiki -->
</div>

</div>

</body>
</html>