public
Description: The blog that's almost nothing - now on Redis
Homepage: http://adam.blog.heroku.com/past/2009/7/13/scanty_on_redis/
Clone URL: git://github.com/adamwiggins/scanty-redis.git
adamwiggins (author)
Mon Jul 13 11:30:01 -0700 2009
commit  3e50a9db6745e06206d17ae73dd31165d34285e7
tree    0241658f6b01abb4641634c687c5e4abe2d32e94
parent  f5d898d130b02fc1aeb95c22d412d21dcf756af6
name age message
file .gitignore Tue Nov 04 14:45:29 -0800 2008 gitignore [adamwiggins]
file README.rdoc Mon Jul 13 11:30:55 -0700 2009 readme [adamwiggins]
file Rakefile Mon Jun 22 23:37:08 -0700 2009 import [adamwiggins]
file config.ru Fri Jun 26 11:07:03 -0700 2009 new-style sinatra config.ru [adamwiggins]
directory lib/ Sun Jul 12 12:50:04 -0700 2009 remove from tag index on destroy [adamwiggins]
file main.rb Sun Jul 12 13:13:19 -0700 2009 cache public pages [adamwiggins]
directory public/ Thu Nov 13 15:32:30 -0800 2008 css to work with marauku [adamwiggins]
directory spec/ Sun Jun 21 13:59:27 -0700 2009 major cleanup [adamwiggins]
directory vendor/ Fri Jun 26 11:02:20 -0700 2009 some fixes [adamwiggins]
directory views/ Sun Jun 21 01:01:45 -0700 2009 feed functional [adamwiggins]
README.rdoc

Scanty, a really small blog, using the Redis database

Overview

Scanty is blogging software. Software for my blog, to be exact: adam.blog.heroku.com

It is not a blogging engine, but it’s small and easy to modify, so it could be the starting point for your blog, too.

This fork modifies lib/post.rb to use Redis, a featureful key-value database, instead of SQL.

Dependencies

  $ gem install sinatra

Redis-rb, Maruku, and Syntax are all vendored.

Get Redis from: code.google.com/p/redis/downloads/list

Unarchive the tarball and run make inside the directory. When finished you can type ./redis-server to run it on the default port on localhost.

Setup

Edit main.rb and change the Blog config struct at the top to your liking, or set the appropriate environmant variables. To run the server:

  $ ruby main.rb

Then: localhost:4567

Database

Scanty Redis will connect to Redis on localhost on the default port if you don’t specify another location. To use something else, set REDIS_URL in your environment when running the app, i.e.:

  $ REDIS_URL='redis://:secret@1.2.3.4:9000/3' ruby main.rb

This would connect to host 1.2.3.4 on port 9000, uses database number 3 (Redis databases are numbered, not named), using password "secret" (which is defined in the config file optionally passed to Redis when you start the server). Redis has no usernames so there in othing before the colon.

Redis creates databases automatically as needed, but if you want to introspect or clear the database, you can use the console and the DB constant:

  $ irb -r main.rb
  irb(main):001:0> DB.keys('*')
  => ["Post:chrono", "Post:slug:first_post"]
  irb(main):002:0> DB.flush_db
  => "OK"
  irb(main):003:0> DB.keys('*')
  => []

See also

Meta

Created by Adam Wiggins

Released under the MIT License: www.opensource.org/licenses/mit-license.php

github.com/adamwiggins/scanty

adam.blog.heroku.com