Login Logout

Howto GitIt

Gitit est un wiki basé sur Git et écrit en Haskell. Il permet l’édition de pages en utilisant la syntaxe Markdown, directement via Git ou via une interface web. Au niveau rendu, il génère des pages HTML avec un style personnalisable via des templates, et permet aussi l’export en TXT/ODT/etc ; il intègre également un moteur de recherche (regardez en haut à droite !). https://wiki.evolix.org utilise fièrement Gitit !

Installation

Paquet Debian

# apt install gitit

$ gitit --version
gitit version 0.10.4 +plugins
Copyright (C) 2008 John MacFarlane
This is free software; see the source for copying conditions.  There is no
warranty, not even for merchantability or fitness for a particular purpose.

Manuellement

# apt install cabal-install ghc zlib1g-dev
# adduser --disabled-password gitit
# sudo -u gitit -i
$ cabal update
$ cabal --reorder-goals install gitit
$ echo PATH="$HOME/.cabal/bin:$PATH" > ~/.profile

$ gitit --version
gitit version 0.12.3 -plugins

Note : /tmp doit être en EXEC pendant l’installation

Pour la mise à jour, on fera simplement:

$ cabal update
$ cabal install gitit
# systemctl restart gitit

Configuration

$ gitit --print-default-config > gitit.conf

Exemple de configuration pour gitit.conf :

address: 127.0.0.1
repository-type: Git
repository-path: git
session-timeout: 36000
default-extension: md
default-page-type: Markdown
front-page: index
no-delete: index, Help
use-cache: yes

Exemple de configuration Nginx /etc/nginx/sites-available/gitit.conf :

server {
    server_name     gitit.example.com;
    listen          0.0.0.0:80;
    listen          [::]:80;
    location /_register {
        allow 192.0.2.42;
        deny all;
        proxy_pass        http://127.0.0.1:5001/_register;
        proxy_set_header  X-Real-IP  $remote_addr;
        proxy_redirect off;
    }
    location / {
        proxy_pass        http://127.0.0.1:5001/;
        proxy_set_header  X-Real-IP  $remote_addr;
        proxy_redirect off;
    }
    access_log      /var/log/nginx/gitit/access.log;
    error_log       /var/log/nginx/gitit/error.log;
}

Lancement

On peut lancer manuellement :

$ gitit -f gitit.conf

Exemple d’unité systemd :

[Unit]
Description=Wiki gitit
After=network.target

[Service]
User=gitit
Group=gitit
UMask=0027

WorkingDirectory=/home/gitit
PrivateTmp=true

ExecStart=/home/gitit/.cabal/bin/gitit -f /home/gitit/gitit.conf
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target
Alias=wiki.service

Pour voir la liste des langages supportés pour le highlighting :

$ pandoc -v

Troubleshooting

Si Gitit affiche certaines pages en markdown sans l’interpréter, il faut supprimer le contenu du répertoire cache dans son répertoire racine :

# rm -rf <GITIT_ROOT>/cache/*