Posts in category "blogging"

speeding up Octopress generation

My site has 966 posts and 70 categories.

By default, Octopress re-generates the entire site - every single post, all the category pages, the archive pages

On my Acer Aspire One (Intel Atom 1.66GHz) netbook, the regeneration takes around 10 minutes.

There are a couple of options that can significantly reduce this time and make the write/preview/edit iterative process more tolerable.

Firstly, you can use 'rake isolate' to move all other posts into a 'stash' directory and simply process the newly created post.

    $ rake isolate['speeding']
    $ ls source/_posts/
    2012-09-20-speeding-up-octopress-generation.markdown

This reduces the generation time significantly to 18 seconds.

    $ time rake generate
    ## Generating Site with Jekyll
    unchanged sass/screen.scss
    Configuration from /home/andy/blog/octopress/_config.yml
    Building site: source -> public
    Successfully generated site: source -> public

    real    0m18.192s
    user    0m14.369s
    sys     0m1.368s

This is helpful for previewing the post as it will work on the site and fixing typos but still the time consuming site generation needs be to done prior to deployment.

    $ rake integrate
    $ rake generate

The second method is to use 'jekyll --limit-posts '. I added a new Rake task as follows:

    desc "Generate jekyll site (last 5 posts)"
    task :fastgen do
      raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
      puts "## Generating Site with Jekyll (last 5 posts)"
      system "compass compile --css-dir #{source_dir}/stylesheets"
      system "jekyll --limit_posts 5"
    end

This also significantly reduced the site generation time

    $ time rake fastgen
    ## Generating Site with Jekyll (last 5 posts)
    unchanged sass/screen.scss
    Configuration from /home/andy/blog/octopress/_config.yml
    Building site: source -> public
    Successfully generated site: source -> public

    real    0m59.061s
    user    0m40.995s
    sys     0m6.956s

Out of interest, I converted my content into Hyde (a static site generator written in Python).

Hyde generated the entire site in 9 mins 17 seconds. However, Hyde also supports incremental builds (which took just 34 seconds for a single new post).

I also tried raw Jekyll using the default Tom Preston-Werner theme. This took 2 minutes to generate the site in its entirety.

migration complete

The last ever migration of this blog is now complete. This blog is now powered by Octopress and is a statically generated site hosted on Amazon S3.

All posts have been migrated from HTML to Markdown and every single permalink (all 954 of them) have been painstakingly checked, rationalised and consolidated.

To achieve this, I simply generated a sitemap of the Drupal site and compared this with a sitemap for a test site using Octopress after the data migration.

This unveiled a few issues that needed to be fixed:

  • Posts with the identical slug had a numeric suffix which was often incorrect or inconsistent after being mangled by various blogging platforms.
  • Some posts had the incorrect publication date (due to timezone shift) so were typically a day out.
  • Some posts were just missing after the 'exitwp' script was used to migrate from WordPress to Hyde a year ago.
  • Hyde uses a slightly different header format from Jekyll but 'sed' was able to fix this.
  • Jekyll uses a trailing slash for each post URL whereas Drupal doesn't.
  • Amazon S3 requires the canonical URL to be www.site.com with a automatic redirect to point site.com to the correct URL with the www prefix. Previously, I favoured the naked URL 'site.com'.

The permalink structure is now 'site.com/yyyy/mm/dd/hello-world/' (with a trailing slash) and will never change. Ever. Again.

I also resurrected some orphan Disqus comments by using the URL mapping tool which works brilliantly and helped identify comments associated with a non-existent URL.

I am generally delighted with Octopress as it bundles so many features I need for a blog (Disqus, Google Analytics etc) and is much easier than using raw Jekyll.

The only vague disappointment is the fact that the entire site is re-published even after a single post has been added. On my Aspire One netbook, a 'rake generate' takes 8 minutes. I might try the same process on my work laptop (faster, newer Lenovo Thinkpad) for comparison purposes.

Inevitably, there is a Jekyll fork that supports incremental deployment but the Octopress author is (understandably) reluctant to base Octopress on a fork that could quickly become stale.

Publishing the site to Amazon S3 is slightly better but, as Atom feeds get regenerated for categories, this still takes around 4 minutes.

Still, maybe this lengthy publishing process will encourage me to properly preview and get my posts perfect before publishing.

I am not sure about having all 954 posts stored in a single directory; I would rather have a sub-directory for each year but then again, being able to quickly search all posts for a keyword using 'grep' is useful.

I decided to keep the Feedburner integration for now (to avoid losing my two readers).

The use of a statically generated site also killed one of my favourite features - my legendary and award winning rotating tagline. Oh well.

Blogging like a hacker but publishing like a snail with a heavy weight strapped to his back.

the awkward second post

Octopress is great

  • Uses Google to provide site search
  • Archives builtin
  • Tag support
  • Draft posts
  • Local preview
  • Markdown markup
  • Google+, Disqus, Google Analytics support
  • Incremental deployment
  • Deployment to Amazon S3
  • Fast as lightning

Wish I'd bitten the bullet earlier.

Hello World

This is my first post in Octopress.

The text uses Markdown which is marvellous.

My favourite blogging platforms are:

  • Octopress
  • Habari
  • Drupal
  • WordPress

The BBC is a popular Web site.

End of message.

migration plan

Loose thoughts on the plan of attack for the blog migration:

  1. Install Octopress locally
  2. Configure S3 and install a dummy Web site.
  3. Use's3cmd' to upload test site to Amazon S3
  4. Test incremental uploads. This is a firm requirement.
  5. Full database backup of existing Drupal blog
  6. Take backup of Drupal installation (additional modules, scripts).
  7. Install vanilla Drupal 7 locally.
  8. Install copy of the existing Dupal blog in local version (overwrite database ?).
  9. Use the Drupal to Octopress migration script. This extracts nodes from the database and creates Markdown files for each post, This script is probably for Drupal 6 so some tweaks (major rewrite) may be needed for bleeding edge Drupal 7. URL aliasing is supposedly supported.
  10. Test the various elements in the checklist. Disqus comments need the correct domain name so will have to come last.
  11. Configure a redirect from 'nbrightside.com' to the Amazon URL. I can see trouble and lots of Googl'ing here.
  12. Place source code (Markdown posts) into GitHub repository.
  13. Put kettle on.

blog migration checklist

I am a veteran of blog migrations with the scars to prove it. Here is a handy cut out and keep checklist of the important things I normally forget:

  • Permalink structure. Try to preserve the existing permalink structure to save hours of pain. This is particularly important when using Disqus (although there is a URL migration utility for Disqus).
  • Typically, I like to have 'Archives', 'About' and a 'Contact' page.
  • Tag support including a 'Tags' page.
  • Images. I have learned to upload all photos and screenshots to PicasaWeb and intentionally de-couple images from the blog platform.
  • Sitemap support. Helps search engines index the site.
  • RSS/Atom support . Previously I have always used Feedburner (although I may follow Google's example and sever this dependency) and simply use the native feed. Less is more.
  • Comments. Static site generators are slightly limited here (compared with proper blogging platforms) so I guess I will continue to use Disqus. Mind you, for the number of comments versus spam, I may also dispense with comments and invite people to use Google+ or identi.ca.
  • Themes. It would be desirable to be able to change themes to avoid having the same look and feel and every other Octopress blog.

Please feel free to add your own tips in the comments.

Autumn migration

My Web hosting package (provided by Bluehost) expires in October. As this blog is essentially dead (the last post was a one-liner 8 months ago), the sensible and logical thing to do would be to kill the blog and save £5 a month.

Originally I purchased the domain name 'nbrightside.com' and the Web hosting for a couple of reasons:

  • I wanted to use self hosted WordPress without some of the restrictions imposed by WordPress.com
  • I wanted to play with some of the packaged applications offered by Bluehost.
  • I wanted access to a Linux environment, mainly to build, install, experiment with various open source software tools and packages which needed a LAMP stack.

It's really questionable whether I need to maintain this Web presence but, on balance, I'd like to keep the site alive for a little longer.

WordPress, Drupal, Habari et al are all fantastic blogging platforms but rather overkill for this simple, single user blog. For a while, I have been fascinated and trying to resist the temptation of the simplicity and power of static Web site generators like Jekyll and Hyde.

Last year, I even ported the complete contents of this Drupal 7 blog to a locally installed version of Hyde and laboriously fixed up lots of hyperlinks just so the Markdown looked neater.

The completely logical and sensible decision would be to simply resurrect this Hyde environment, re-sync the last couple of one liner blog posts, configure a automatic redirect and use rsync to upload this site to some alternative, cheaper (or free) Web hosting.

So, I have decided to use Octopress and Amazon S3 to host this humble, annually updated blog in the future. I may be able to reuse some of the Hyde content with judicious use of sed to convert the meta data in the header sections or I may just start afresh.

No - I am not mad.

blog maintenance

Time to upgrade Drupal again. Yesterday version 7.12 was released and this blog is currently running a very outdated (and probably insecure) 7.4. Although Drupal 7 included automatic update for modules and themes, updating the core Drupal software still needs manual intervention and takes time.

Over the years, the main self-hosted blog platforms I have used are:

  • WordPress - one-click updates. Quick and easy. By far the best and most robust solution. Never let me down.

  • Habari - Official Habari releases were fairly infrequent so I chose to I track the latest development version so upgrade was manual but as simple as typing '$ svn update'. Rolling back was needed on a couple of occasions but possible simply by reverting to the previous SVN version ($ svn update -r ).

  • Drupal - manual update. Involves taking the site offline, copying files, thinking, run 'update.php', copying files back again, bringing the site back online and a little time. Slightly tedious as Drupal tend to to release a new version of the core software every month or so with a nagging email reminder to do the right thing.

I have also noticed that my sitemap hasn't been generated in 6 months and doesn't include the most recent entries. In addition, some (old) posts have been marked as 'Never Update' but after some housekeeping to modify some permalinks to fix various '404 - Not found' errors, these old entries now need to be regenerated.

Welcome to the brave new world

Well - I lasted about 4 hours without a blog.

This latest incarnation is powered by Hyde.

This means I can write my posts in Markdown, generate and test the site locally and then upload using 'rsync'.