Sophie

Sophie

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

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>Git repository and web server on different hosts</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">
Git repository and web server on different hosts

</span>
</span>



</div>









</div>





<div id="pagebody">

<div id="content" role="main">
<p>One may want to provide ikiwiki hosting with <a href="../rcs/git.html">git</a>+ssh access and web
server located at different hosts. Here's a description for such
a setup, using password-less SSH as a way of communication between
these two hosts.</p>

<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="490" class="img" align="right" /></a></p>

<h1>Git server</h1>

<p>Let's create a user called <code>ikiwiki_example</code>. This user gets SSH
access restricted to GIT pull/push, using <code>git-shell</code> as a shell.</p>

<p>The root (bare) repository:</p>

<ul>
<li>is stored in <code>~ikiwki_example/ikiwiki_example.git</code></li>
<li>is owned by <code>ikiwiki_example:ikiwiki_example</code></li>
<li>has permissions 0700</li>
</ul>

<p>The master repository's post-update hook connects via SSH to
<code>webserver</code> as user <code>ikiwiki_example</code>, in order to run
<code>~/bin/ikiwiki.update</code> on <code>webserver</code>; this post-update hook, located
in <code>~ikiwki_example/ikiwiki_example.git/hooks/post-update</code>, is
executable and contains:</p>

<pre><code>#!/bin/sh
/usr/bin/ssh ikiwiki_example@webserver bin/ikiwiki.update
</code></pre>

<p>Password-less SSH must be setup to make this possible; one can
restrict <code>gitserver:ikiwiki_example</code> to be able to run only the needed
command on the web server, using such a line in
<code>webserver:~ikiwiki_example/.ssh/authorized_keys</code>:</p>

<pre><code>command="bin/ikiwiki.update",from="gitserver.example.com",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa ...
</code></pre>

<h1>Web server</h1>

<p>Let's create a user called <code>ikiwiki_example</code> on <code>webserver</code>. She needs
to have write permission to the destination directory.</p>

<p>The working tree repository (<code>srcdir</code>):</p>

<ul>
<li>is stored in <code>~ikiwki_example/src</code></li>
<li>is owned by <code>ikiwiki_example:ikiwiki_example</code></li>
<li>has permissions 0700</li>
<li>has the following origin: <code>ikiwiki_example@gitserver:ikiwiki_example.git</code></li>
</ul>

<p>The CGI wrapper is generated with ownership set to
<code>ikiwiki_example:ikiwiki_example</code> and permissions <code>06755</code>.</p>

<p>Password-less SSH must be setup so that <code>ikiwiki_example@webserver</code> is
allowed to push to the master repository. As told earlier, SSH access
to <code>ikiwiki_example@gitserver</code> is restricted to GIT pull/push, which
is just what we need.</p>

<p>The Git wrapper is generated in <code>~ikiwiki_example/bin/ikiwiki.update</code>:</p>

<pre><code>git_wrapper =&gt; '/home/ikiwiki_example/bin/ikiwiki.update'
</code></pre>

<p>As previously explained, this wrapper is run over SSH by the master
repository's post-update hook; it pulls updates from the master
repository and triggers a wiki refresh.</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>

<a href="./distributed_wikis.html">distributed wikis</a>


</div>






<div class="pagedate">
Last edited <span class="date">Tue Feb 26 23:01:54 2019</span>
<!-- Created <span class="date">Sun Oct 19 22:33:59 2008</span> -->
</div>

</div>


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

</div>

</body>
</html>