After a long hiatus I've decided to revive my blog. To encourage my blogging I've made writing posts as frictionless as possible. I previously used Wordpress and a custom Django app, but both were clunky. My new setup is simpler, just a directory on Dropbox filled with Markdown files. Now I can write in the editor of my choice and as soon as I save the article is live.
To generate this site I'm using the nifty static blogging engine Pelican. My server runs a copy of Dropbox that syncs the posts. Whenever a file changes in the Dropbox directory, Pelican kicks out an updated version of my site.
How to setup Dropbox based blogging
If you'd like a similar setup it's not hard. Once you have a server running the HTTP server of your choice, you'll need to add Pelican, Dropbox and incron. I installed on an Ubuntu 10.04 server but other versions of Linux should be comparable.
Dropbox
The first step is getting Dropbox installed. I setup the stock version available from Dropbox's website and found this tutorial to be very helpful. In particular make sure you setup a script in /etc/init.d/ to automatically start the Dropbox daemon. I used the script shown on the linked tutorial for my init.d script.
You probably want a separate Dropbox account specifically for your blog. Otherwise all your Dropbox files will be synced to your server, a waste of space and a potential security issue. Instead I shamelessly stole the idea of using Dropbox folder sharing from Joe Hewitt. The idea is that you have two Dropbox accounts and then let the blog Dropbox account share its posts folder with your main Dropbox account. Check out the Dropbox web interface for details.
Pelican
Pelican is what powers the blog and generates the static output. The install is super simple:
$ sudo aptitude install python-pip $ sudo pip install pelican $ sudo pip install markdown
incron
The final piece is incron which detects change in the Dropbox directory and executes Pelican when it sees a change. Setup is easy but slightly more involved than Dropbox or Pelican:
$ sudo aptitude install incron
Only users specified in /etc/incron.allow are allowed to use incron so add your user account:
$ sudo echo $USER >> /etc/incron.allow
Now you need to configure incron which is done like cron:
$ incrontab -e
Here is what my incrontab file looks like:
/home/mronge/Dropbox/Blog/Posts IN_MODIFY,IN_CREATE,IN_DELETE,IN_MOVE /home/mronge/update_blog.sh
And then inside update_blog.sh I have:
pelican /home/mronge/Dropbox/Blog/Posts -t /home/mronge/Dropbox/Blog/Site -o /var/www/mronge -s /home/mronge/pelican_conf.py
which simply runs Pelican and specifies a template, output directory and settings file to use.
And that's it! You now have a Dropbox powered blog. If you have any questions feel free to contact me.