Thursday, February 28, 2019

The Return of The DokuWiki


For some years Dokuwiki was Marcus' secret weapon in making sense of the almost infinity of Computer configurations, data, plans, daily logs and just about everything complex in this Information Technology world.

But since leaving the Enterprise Computing environment I am a little ashamed to say that I have neglected using my DokuWiki server.

But no more!

This is a post to document its return and why it is a truly indispensable tool for those trying to record complex information sources that they want to refer to later, and that they can cooperatively share for viewing and or collaborative editing.

Read on to learn more & about Raspberry Pi too.

Why Use a Wiki or DokuWiki
I covered this in 2012 with this article:

https://majzel.blogspot.com/2012/04/to-wiki-that-is-question.html

- A Wiki is a Documentation system running on a server, that you access over a Web Browser interface

- Typically you type in the data using tags, which is a bit of a pain compared to Microsoft Word or other visual editors.

- It is akin to writing a baby version of HTML, er. but annoyingly using different tag names!

- A good Wiki will have the ability to embed links (obviously), but also audio and graphics and video and arbitrary media files.

- The great differentiator for DokuWiki is that it's fully self contained.  Data is stored in flat files not in an external database.  Once you hit the Save button your data is safely stored, there is no external database to crash, no referential integrity problems.


As such the installation and maintenance is much simpler.  Backup a set of directories and you are good.


Different to A Set of Word Documents?

- The main difference is that your documentation is stored in a set of Pages which are linked together.

A Word document by comparison contains text, pictures and perhaps some links to Webpages or even other Word Documents.

But the links will be rare and the Wiki aka Dokuwiki structure is Links first, and free form pages joined together with these links.

So just like a database in 3rd normal form, if you have a common procedure you write it once and link to it from all the other documents that need it.


DokuWiki in 2019

For 2019 I uncovered a fantastic resource at https://www.techcoil.com which I will point to so that you too can professionally setup your own DokuWiki

The documentation is so brilliant that I can't really improve on it.

But First The Raspberry Pi Angle

- I've been running my Dokuwiki server on a powerful Intel webserver I use for other larger things

- This setup enables me to use DokuWiki outside of the home

- But conversely the security issue is that Dokuwiki personal technical datastore is sharing the same machine as my public webserver.  I'd like to separate it, and then for example they can be running (up and down) independently, plus backups can be separate too

- The master plan is take a Raspberry Pi 3B+, install Raspbian OS as usual, then install PHP and Dokuwiki.

- And by a stroke of genius this is what Chai Heng at www.techcoil.com already documented.  So I am simply pointing to his excellent documentation. 


The Software Bit
Installation of DokuWiki with Nginx

At the end of this you can fully use DokuWiki in your home.  It's not connected to the wider world and so is ultimately secure.

But suppose you are a hard working IT professional  (other professions are available) and you'd like web access from your phone or laptop whilst out of the home ...

Aside and Caution about CGNAT
If you use a mobile Internet connection to service all your home Internet needs or a tether from your mobile you may find that you cannot host any home website using that connection, in which case the following Website Domain Hosting will not work.  CGNAT Carrier Grade Network Address Translation or similar means that your home Internet connection shares it's IP address with others in 'groups' and is not unique.  So you can't host your own Webserver (in this case a DokuWiki Server) and connect to it from outside of the home.



Most often this can be detected whereby although your public IP address seems to routeable  (i.e. typically not 10.x address) your router shows otherwise.

For UK readers it is worth noting that Three Mobile HomeFi, now available with an unlimited dataplan,  did not suffer this limitation when I was its customer until a few months ago.


Optional
These steps allow external access of the Dokuwiki using a domain that you create, and allow for Dynamic DNS updates of the domain, so that when your home IP address changes, you can still access everything consistently






Always Make a Backup

I have literally over 1000 pages of technical information written over 7 years on my Docuwiki server.  I desire a full systems backup.  So if the server is stolen, or the underlying microSD card on which everything is running is corrupted I can restore the last backup and continue.

Full Bare metal backup is described here

I find it easiest to do this under Windows.  So the procedure is this


  1. Download and Install Win32DiskImager 
  2. Shutdown your Raspberry Pi
  3. Remove your microSD card from the Raspberry Pi and insert it into your PC slot  (e.g. via a USB to SD adapter)
  4. Start Win32 Disk Imager
  5. Choose the drive of the first FAT: disk that appeared when you inserted the microSD card.   (In my case E:)
  6. Click “Read”
  7. Win32DiskImager backup up the whole device, i.e. not just the Windows visible drive, but all the partitions, to the file that you gave
  8. Now you have a single file in DiskImager format that you should store safely offsite somewhere
  9. In the even of a disaster you restore this image from the File to a new microSD card, ideally of same size as the screwed one, after you first formatted it as FAT32 (via SD formatter)
As noted earlier I can make a simple tar backup of the single root directory containing all the Dokuwiki configuration, Text and all Media files.  This is a single tar command and can be automated to run daily in cron for example. Because DokuWiki does not use any external database you don't need to (for example) pause the database, make the backup, resume the database etc to prevent integrity issues.




To Conclude
For literally the price of buttons  (I mean less than 100 GBP for everything ) you can buy a Raspberry Pi, install Raspbian and Dokuwiki and enjoy a world class Wiki documentation system.  Included in that price is also: buying a WebDomain and changing your Nginx webserver to SSL and thereby allowing secure access of your Wiki to yourselves and others remotely from your home server.