MongoDB `smallfiles` setting on Ubuntu for development

MongoDB `smallfiles` setting on Ubuntu for development

Leaf logo for MongoDBI recently installed MongoDB on Ubuntu to do some development and noticed it didn’t start when I installed it via sudo aptitude install mongodb. Checking the logs I discovered the problem:

1
2
[initandlisten] ERROR: Insufficient free space for journal files
[initandlisten] Please make at least 3379MB available in /var/lib/mongodb/journal or use --smallfiles

I have a tiny SSD on my computer and I really don’t need this using over 3GB just so I can do a little hacking.

OK so I’ll just set --smallfiles. Under Ubuntu settings like arguments passed to a daemon when it starts are usually found in /etc/defaults but I couldn’t see any such file for MongoDB.

It turned out you can also set this in the config file under /etc/mongodb.conf so just add this line to the bottom of that file:

1
smallfiles = true

Load RSpec fixtures in Rails

If you’re still using fixtures in your RSpec Rails tests for some reason you might want to load them into an environment to look at. For example, to ensure the data is displaying in the application like you intend.

Rails expects you’re using Test::Unit so it expects the fixtures to live in test/fixtures. Here’s how you load fixtures from RSpec into your ‘test’ environment:

bundle exec rake db:fixtures:load RAILS_ENV=test FIXTURES_PATH=spec/fixtures

You get a deprecation warning when running this. It says you should set this with ActiveRecord::Tasks::DatabaseTasks.fixtures_path = '/path/to/fixtures' instead but I haven’t worked out where you’d put that for this kind of use (suggestions in the comments greatly appreciated!). Update: the deprecation warning was removed in Rails 4.1.

Featured in The Australian Financial Review

Featured in The Australian Financial Review

Photo from the articleI haven’t posted anything in ages and since this is fast becoming a brag book and not a blog I thought I’d post about how the OpenAustralia crew and I were recently featured in the AFR:

Our democracy opening crack by hack

There’s also a screenshot of the article if that link goes down.

OpenAustralia API Ruby Gem

OpenAustralia API Ruby Gem

Screenshot of OpenAustralia API on RubyGems.org
To celebrate International Day of Democracy I’m happy to announce the availability of the OpenAustralia API gem on RubyGems.

A couple of months back I was toying with a project in Ruby that needed information from OpenAustralia.org so I took a look at the gem made by Alex Cooper three years ago. Of course being that old it needed some love so I decided to spruce it up and publish it on RubyGems.

I mainly updated it to today’s Ruby technology, adding things like Bundler and also fixed a bug. I haven’t used it in anger so there’s doubtless other bugs and it could use an internal overhaul – pull requests accepted! :)