Keep Building

Novelty is overrated

Nov 17, 2014

Blogging Platform Configuration

The overall setup of my blogging engine is now complete. I had a few requirements which are fairly unusual:

  1. Host it myself entirely in Amazon S3
  2. Edit and upload each post entirely using my tablet (an iPad)
  3. Upload images and automatically paste links while editing a post
  4. Automatic backup of the entire blog to Dropbox each time I post
  5. Ensure that I can figure out which backup blog post points to which backup image

Hosting

The only reasonable way to host a blog on S3 is to use a static site generator. I chose Pelican, though Jekyll and Octopress are both good alternatives. These are all command line tools that turn a folder of CommonMark documents into a static set of html and CSS files that can then be uploaded for hosting anywhere.

Publishing on iOS

None of them have anything remotely like an iOS client. The closest thing to a console on iOS is Editorial, a text editor that is programmable in Python. And I found out how to run an SFTP client in Editorial and that is how I can get from a piece of text to a post.

After completing my post in Editorial, I just invoke the upload workflow to push the post to the input folder on my VPS. The VPS is configured to run Pelican and the upload is immediately detected by my daemon which uses inotifywait to detect when files are changed. The daemon then uploads the files generated by Pelican to S3 for hosting.

Image Upload

At first, I was planning on using the Transmit iOS app to upload images directly to an S3 bucket. But there is no url scheme or x-callback-url support in Transmit which would make the whole process cumbersome.

So instead, I decided to reuse the SFTP code in my post upload workflow in Editorial. My picture workflow lets me choose one or more pictures from the camera roll and then inserts a CommonMark image tag for each url. When I upload the blog post, then the images themselves will be copied from my VPS to S3 at the same time by my daemon.

Automatic Backup

Since I am authoring and publishing directly from my tablet, I need to make sure that I am have everything backed up in multiple places. I will retain a copy on my tablet, and there will be an extra copy on my VPS, but it still feels a bit fragile. So every post and image is also uploaded to Dropbox. This is easy to do in Editorial which can be linked to a Dropbox account. The real trick will be handling sync if and when I decide to add a way to upload blog posts from my laptop.