Search code examples
gitweb-deploymentdokuwiki

Deploy Website using Git with multiple committers


I want to run a dokuwiki.org on my server. I'm using the file-based setting so there's no external database involved.

I want to setup a git repository with contains dokuwiki's data directory so multiple committers are able to work offline and push the changes back when they are done. The data directory in the git repository is no big deal, you can set the location of the data directory using dokuwiki's config-files.

I used this guide to set everything up and it's working as expected.

tl;dr of the guide:

  • setup bare repo
  • post-receive hook on the bare repo to navigate to the htdocs directory and checkout the changes from the bare repo.
  • you push something to the repo, and the htdocs directory automatically checksout the changes from the repo.

So the guide is only useful if you are using it for a static site or something database based.

My problem is that the www directory is changed everytime someone edits something via the web-based wiki and not the files in their local repository -> the changes don't get pushed back to the bare repository because there's no hook/way/...to do that.

Is there anything i'm missing here or a better way to handle this usecase?


Solution

  • There is a fairly new plugin which does exactly what you need: gitbackend. It also supports pulling into the live repo.

    It is not apparent from your description, but in case you plan to "only" change what's in data/pages and data/media, you would be missing the changes to the meta data. That means that several commits would only appear as a single revision on the old revisions of a page and other data like commit messages / change summary would be missing.

    The aforementioned plugin hasn't implemented the meta data changes either, but could do it internally. If you'd rather like to write a script which does something externally, you might want to hook into the XML-RPC API.