How to set up one ikiwiki for mutiple machines to work with : How to set up ikiwiki distributedly with built-in backup
Now, I chose to have ikiwiki with a purpose. The core benefit of having ikiwiki, in my opinion is, that it has bliki — blog-and-wiki — capability right built in.
The second advantage over a wiki like mediawiki (or a blog like wordpress) — in my first-sight opinion — is that you can update the bliki on your mobile computer while on the move and update the hosted bliki when back online — and in no time.
Now, after having set up a lightweight webserver for ikiwiki (Cherokee), having brought ikiwiki to initial life and managed to get a git underneath the ikiwiki, now I focus on setting up the replication infrastructure for the bliki:
I want the bliki reside on my hosted server (say, remote-machine.com). I want my local in-house server (homeserver) to “download” the latest version of the bliki on a regular basis. The idea is to have a backup at hand. And I want the bliki to reside on my main computer mycomputer (which happens to be a mobile one).
To sum it up:
- the main bliki shall reside on
remote-machine.com, homeservershall pull fromremote-machine.com,mycomputershall pull fromremote-machine.comand push there also.
Both, mycomputer and remote-machine.com, shall be editable by web interface.
So, as we’re working with git, remote-machine.com will have two repositories — a bare one, since ikiwiki claims to have issues with a non-bare repository to work with, and a clone we’ll can actually work with. Similar applies for mycomputer — the box we’ll mainly work with to edit the bliki.
Suggested read: ikiwiki/ tips/ laptop wiki with git
First, let’s set up the backup computer. Therefore, we ssh there first. (As before $ indicates commands to be given as a common user, # commands that shoult be issued as root.)
$ ssh homeserver dagobart@homeserver's password: Linux homeserver 2.6.26-2-686 #1 SMP Wed Nov 4 20:45:37 UTC 2009 i686 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. You have new mail. Last login: Sun Mar 21 16:40:46 2010 from mycomputer-fritz.fritz.box $ pwd /home/dagobart mkdir .ikiwiki && cd .ikiwiki/ $ pwd /home/dagobart/.ikiwiki $ git-clone remote-machine.com:/home/dagobart/.ikiwiki/bliki Initialized empty Git repository in /home/dagobart/.ikiwiki/bliki/.git/ Receiving objects: 100% (3/3), done. remote: Counting objects: 3, done. remote: Total 3 (delta 0), reused 0 (delta 0)
You might want to ensure you won’t have to issue a password when ssh-ing to remote-machine.com every time.
Now, what do we have by now? Let’s see…
$ ls -al insgesamt 12 drwxr-xr-x 3 dagobart dagobart 4096 21. Mär 17:37 . drwxr-xr-x 41 dagobart dagobart 4096 21. Mär 17:35 .. drwxr-xr-x 3 dagobart dagobart 4096 21. Mär 17:37 bliki $ ls -al bliki/ insgesamt 16 drwxr-xr-x 3 dagobart dagobart 4096 21. Mär 17:37 . drwxr-xr-x 3 dagobart dagobart 4096 21. Mär 17:37 .. drwxr-xr-x 8 dagobart dagobart 4096 21. Mär 17:37 .git -rw-r--r-- 1 dagobart dagobart 25 21. Mär 17:37 .gitignore $ ls -al bliki/.git insgesamt 48 drwxr-xr-x 8 dagobart dagobart 4096 21. Mär 17:37 . drwxr-xr-x 3 dagobart dagobart 4096 21. Mär 17:37 .. drwxr-xr-x 2 dagobart dagobart 4096 21. Mär 17:37 branches -rw-r--r-- 1 dagobart dagobart 262 21. Mär 17:37 config -rw-r--r-- 1 dagobart dagobart 58 21. Mär 17:37 description -rw-r--r-- 1 dagobart dagobart 23 21. Mär 17:37 HEAD drwxr-xr-x 2 dagobart dagobart 4096 21. Mär 17:37 hooks -rw-r--r-- 1 dagobart dagobart 112 21. Mär 17:37 index drwxr-xr-x 2 dagobart dagobart 4096 21. Mär 17:37 info drwxr-xr-x 3 dagobart dagobart 4096 21. Mär 17:37 logs drwxr-xr-x 4 dagobart dagobart 4096 21. Mär 17:37 objects drwxr-xr-x 5 dagobart dagobart 4096 21. Mär 17:37 refs
Looks good.
Now, let’s see how a git-pull will work out:
$ cd ~/.ikiwiki/bliki/; git-pull remote-machine.com:/home/dagobart/.ikiwiki/bliki master From remote-machine.com:/home/dagobart/.ikiwiki/bliki * branch master -> FETCH_HEAD Already up-to-date.
That looks well as well.
Now, let’s ensure the backup will remain current all the time. For that let’s update the crontab:
$ crontab -e
This will open an editor.
Enter the following into the editor:
# backup ikiwiki bliki: 1 0 * * * cd /home/dagobart/.ikiwiki/bliki/; git-pull remote-machine.com:/home/dagobart/.ikiwiki/bliki 1 6 * * * cd /home/dagobart/.ikiwiki/bliki/; git-pull remote-machine.com:/home/dagobart/.ikiwiki/bliki 1 10 * * * cd /home/dagobart/.ikiwiki/bliki/; git-pull remote-machine.com:/home/dagobart/.ikiwiki/bliki 1 12 * * * cd /home/dagobart/.ikiwiki/bliki/; git-pull remote-machine.com:/home/dagobart/.ikiwiki/bliki 1 14 * * * cd /home/dagobart/.ikiwiki/bliki/; git-pull remote-machine.com:/home/dagobart/.ikiwiki/bliki 1 16 * * * cd /home/dagobart/.ikiwiki/bliki/; git-pull remote-machine.com:/home/dagobart/.ikiwiki/bliki 1 19 * * * cd /home/dagobart/.ikiwiki/bliki/; git-pull remote-machine.com:/home/dagobart/.ikiwiki/bliki 1 22 * * * cd /home/dagobart/.ikiwiki/bliki/; git-pull remote-machine.com:/home/dagobart/.ikiwiki/bliki
Basically, this sets up to poll the remote wiki frequently to keep the backup up to the hour. The setup is focussed to match my working hours as closely as possible. For an explanation of the crontab format, in the command shell issue:
$ man 5 crontab
Above crontab prerequires that you can git-pull from remote-machine.com without a password, cf.above.
More suggested reads:
$ man git-pull$ man git-clone- and the yet mentioned ikiwiki/ tips/ laptop wiki with git
create mobile computer’s local wiki
For this, I assume, we’re back on the local computer.
$ cd $ mkdir .iki-test && cd .iki-test $ pwd /home/dagobart/.iki-test
Since I initially only wanted to see how this was going to work out, I named the mobile computer’s ikiwiki directory .iki-test. — I could have search&replaced this in this walkthrough back to a more conform .ikiwiki, but actually it helps to remember on which machine and in which repository (bare or non-bare) you currently are. Therefore, .iki-test.
Now, clone the git repository from the remote machine to the local one — and let’s inspect what that made happen:
$ git-clone helbrecht.ws:/home/dagobart/.ikiwiki/bliki Initialized empty Git repository in /home/dagobart/.iki-test/bliki/.git/ dagobart@helbrecht.ws's password: remote: Counting objects: 3, done. remote: Total 3 (delta 0), reused 0 (delta 0) Receiving objects: 100% (3/3), 239 bytes, done. $ ls -al insgesamt 12 drwxr-xr-x 3 dagobart dagobart 4096 21. Mär 17:42 . drwxr-xr-x 83 dagobart dagobart 4096 21. Mär 17:41 .. drwxr-xr-x 3 dagobart dagobart 4096 21. Mär 17:42 bliki $ ls -al bliki/ insgesamt 16 drwxr-xr-x 3 dagobart dagobart 4096 21. Mär 17:42 . drwxr-xr-x 3 dagobart dagobart 4096 21. Mär 17:42 .. drwxr-xr-x 8 dagobart dagobart 4096 21. Mär 17:42 .git -rw-r--r-- 1 dagobart dagobart 25 21. Mär 17:42 .gitignore $ mv bliki/.git* . $ ls -al insgesamt 20 drwxr-xr-x 4 dagobart dagobart 4096 21. Mär 17:43 . drwxr-xr-x 83 dagobart dagobart 4096 21. Mär 17:41 .. drwxr-xr-x 2 dagobart dagobart 4096 21. Mär 17:43 bliki drwxr-xr-x 8 dagobart dagobart 4096 21. Mär 17:42 .git -rw-r--r-- 1 dagobart dagobart 25 21. Mär 17:42 .gitignore $ ls -al bliki/ insgesamt 8 drwxr-xr-x 2 dagobart dagobart 4096 21. Mär 17:43 . drwxr-xr-x 4 dagobart dagobart 4096 21. Mär 17:43 .. $ ls -al .git insgesamt 48 drwxr-xr-x 8 dagobart dagobart 4096 21. Mär 17:42 . drwxr-xr-x 4 dagobart dagobart 4096 21. Mär 17:43 .. drwxr-xr-x 2 dagobart dagobart 4096 21. Mär 17:42 branches -rw-r--r-- 1 dagobart dagobart 262 21. Mär 17:42 config -rw-r--r-- 1 dagobart dagobart 58 21. Mär 17:42 description -rw-r--r-- 1 dagobart dagobart 23 21. Mär 17:42 HEAD drwxr-xr-x 2 dagobart dagobart 4096 21. Mär 17:42 hooks -rw-r--r-- 1 dagobart dagobart 112 21. Mär 17:42 index drwxr-xr-x 2 dagobart dagobart 4096 21. Mär 17:42 info drwxr-xr-x 3 dagobart dagobart 4096 21. Mär 17:42 logs drwxr-xr-x 4 dagobart dagobart 4096 21. Mär 17:42 objects drwxr-xr-x 5 dagobart dagobart 4096 21. Mär 17:42 refs
Now, let’s re-setup those s and d directories we already used when setting up ikiwiki initially. Actually, we’re essentially going to re-do that step:
$ mkdir -p bliki/s bliki/d && cd bliki $ pwd /home/dagobart/.iki-test/bliki $ ls -al insgesamt 16 drwxr-xr-x 4 dagobart dagobart 4096 21. Mär 17:45 . drwxr-xr-x 4 dagobart dagobart 4096 21. Mär 17:43 .. drwxr-xr-x 2 dagobart dagobart 4096 21. Mär 17:45 d drwxr-xr-x 2 dagobart dagobart 4096 21. Mär 17:45 s $ ikiwiki-makerepo git s Importing s into git Initialized empty shared Git repository in /home/dagobart/.iki-test/bliki/ Initialized empty Git repository in /home/dagobart/.iki-test/bliki/s/.git/ Created initial commit 5bf1878: initial commit 1 files changed, 2 insertions(+), 0 deletions(-) create mode 100644 .gitignore Counting objects: 3, done. Writing objects: 100% (3/3), 244 bytes, done. Total 3 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. To /home/dagobart/.iki-test/bliki * [new branch] master -> master Directory s is now a clone of git repository /home/dagobart/.iki-test/bliki $ pwd /home/dagobart/.iki-test/bliki $ ls -al insgesamt 48 drwxrwsr-x 9 dagobart dagobart 4096 21. Mär 17:45 . drwxr-xr-x 4 dagobart dagobart 4096 21. Mär 17:43 .. drwxrwsr-x 2 dagobart dagobart 4096 21. Mär 17:45 branches -rw-rw-r-- 1 dagobart dagobart 126 21. Mär 17:45 config drwxr-xr-x 2 dagobart dagobart 4096 21. Mär 17:45 d -rw-rw-r-- 1 dagobart dagobart 58 21. Mär 17:45 description -rw-rw-r-- 1 dagobart dagobart 23 21. Mär 17:45 HEAD drwxrwsr-x 2 dagobart dagobart 4096 21. Mär 17:45 hooks drwxrwsr-x 2 dagobart dagobart 4096 21. Mär 17:45 info drwxrwsr-x 7 dagobart dagobart 4096 21. Mär 17:45 objects drwxrwsr-x 4 dagobart dagobart 4096 21. Mär 17:45 refs drwxr-xr-x 3 dagobart dagobart 4096 21. Mär 17:45 s
And finally, let’s make sure we can push from that local git repository to the one on the remote server:
$ git-push . Everything up-to-date $ # how to sync remote to local repo: $ git-pull dagobart@remote-machine.com's password: Already up-to-date.
Hi, sorry for this offtopic question but i dont find the RSS Feed Link to add this Blog to my Feedreader. Could you please give me the URL? Thanks a lot.
Greetings from Switzerland
SandraLima
April 20, 2010
For this blog, this is the general RSS URL: http://dagobart.wordpress.com/feed/
However, if you once upon a time can’t find an RSS feed link on any site, just look into a page’s source code (most often Ctrl+U will do) and then there within for something like “xml” or “rss”. Most often very nearby you’ll find the RSS feed URL. If it’s not the first link, look for a second or third.
NB. Removed your site link since I was unsure whether this is a honest question or a disguised spam comment. Hopefully the info above is helpful to you.
HTH,
dagobart
dagobart
April 26, 2010