Dropbox is a great tool, and due to it’s file sync capabilities it has a lot of possibilities to create “hack” solutions like the one that I’m going to describe here:
If you have a personal Wiki that you want to share between several computers, the usual “normal” way of doing so is to setup a 24/7 Web Server with Apache/Lighttpd and, in my case, installing Dokuwiki. Then the client PC’s to access the Wiki all they have to do is tto point their browser to access this web server. But what this means is that you really need to have a web server available 24/7 even if not using it… And where to locate this web server? At my home? Pay hosting fees? And if I don’t have connection to it? And so on…
The solution is using Dropbox as your data repository for DokuWiki Content. Content is always available and replicated automatically on all computers, even if you don’t have internet access. You can even share your Wiki privately with your friends/family/colleagues by inviting them to the Wiki folder… and off course setting up Lighttpd on their computers.
How it works:
I’m using Lighttpd as the web server. For personal use is more than enough and it supports PHP5 and Dokuwiki just fine. Lighthttpd is installed in all computers that access the wiki.
The installation steps for Ubuntu/Kubuntu and derivatives are the following:
1) Install Lighttpd, php5 and dokuwiki packages: apt-get install lighttpd php5-cgi dokuwiki.
During installation of dokuwiki, it will be asked what web server should be configured automatically, namely Apache or lighttpd. We must choose the later, lighttpd by pressing space (so that a * should appear) and, if Apache is not installed, deselect Apache.
The following question is if, in case of dokuwiki package removal, should the wiki content ALSO be removed… We should answer NO.
Then, finally, the wiki admin password is asked.
After installation, the lighttpd server should start automatically, and using a browse the local web page http://localhost should show the default web server page.
Then follow these instructions http://redmine.lighttpd.net/wiki/lighttpd/TutorialLighttpdAndPHP#Configuration to enable Lighttpd with PHP5.
Basically is to edit the php.ini file that’slocated in /etc/php5/cgi/php.ini and the lighttpd.conf file located on /etc/lighttpd directory. These changes must be done as the user root (use sudo -s on a command shell).
Make sure that when pasting the fastcgi.server section into the lighttpd.conf file, the “bin-path” entry points to the php5-cgi binary, normally located at /usr/bin/php5-cgi
Save and restart the lighttpd server with the command /etc/init.d/lighttpd restart
2) Copy /usr/share/dokuwiki to /var/www with the following command: cp -R /usr/share/dokuwiki /var/www and make sure the permissions are correct: chown -R www-data:www-data /var/www/dokuwiki
Note that the first copy command there are no trailing slashes.
3) You can rename the folder from dokuwiki to other name, like wiki, for example to change the URL. This is optional.
4) Create the Dokuwiki data directory on your Dropbox: mkdir -p ~/Dropbox/wiki/data This should be done in only ONE computer, the others will synchronize automatically.
5) Change the permissions on the directory: sudo chown -R www-data ~/Dropbox/wiki/data This should be done in ALL computers.
6) Edit the Dokuwiki configuration file dokuwiki.php located in /etc/dokuwiki and change the value of the line $conf[‘savedir’] to the data location on the dropbox folder. In my case I changed the default value from $conf[‘savedir’]=’/var/lib/dokuwiki/data’; to $conf[‘savedir’]=’/home/primalcortex/Dropbox/wiki/data’;
You must do this in all computers, only, probably, changing the Dropbox location. If you’re using the same username on all computers, just copy the file between them using Dropbox…
And that’s it. Accessing now the URL http://localhost/dokuwiki uses now the local lighttpd web server with all data synchronized between computers, and it works EVEN when offline.
You now can invite your work colleagues to this folder, and have all data available at all times to anyone that uses the same scheme.
EDIT: You may find the following error when using the Wiki based on your Dropbox directory: The datadir (‘pages‘) does not exist, isn’t accessible or writable. You should check your config and permission settings.
The problem is file/directory permissions, because the user www-data used by lighttpd can’t access your home directory/Dropbox directory.
There are two solutions, being the easy one to add the www-data user to your own group, in my case the group named primalcortex.
The other solution is to add the following permissions: chmod o+x /home/username and chmod o+x/home/Dropbox
The first solution will be better because Dropbox software can or might change the Dropbox directory permissions. Just make sure that your home directory permissions are 750.