Readme for bamboo-2009.5.19
Bamboo: a simple blog middleware on hack
Bamboo is a port of Panda, but runs on top of Hack. It's an experimental project but quite portable.
Features
plain text as data source
db
|---- blog
| |---- 08-09-01 first post
| |---- 09-09-02 learn javascript.html
|
|---- tag
| |---- programming
| |---- funny
|
|---- static
|---- About
simple config
blog_title = C大调
blog_subtitle = 野猫不吃薯片
host_name = jinjing.easymic.com
author_email = nfjinjing@gmail.com
navigation = About
per_page = 7
sidebar = Blogroll.md
favicon = bamboo_icon.png
hacker friendly
- posts are in plain text
- SCM for publishing / data managing ( not really a feature, but a design goal from the beginning )
- blindly follows the KISS principle from code to UI: be a simple blog, no more no less
Demo
blog
My blog source is available as a git repo:
git clone git://github.com/nfjinjing/jinjing-blog.git
Or browser online
Note: This blog is using the Kibro handler. It's running under lighttpd and in fcgi. Definitely more robust, but require some set up work.
config
Install in 3 steps
1. tokyo-cabinet (used for caching)
Mac
port install tokyocabinet
Arch
yaourt -S tokyocabinet
other distro
Just find this tokyo-cabinet package and install it :)
2. Bamboo Middleware
update cabal
cabal update
install bamboo
cabal install happy
cabal install rss --reinstall
cabal install bamboo
3. Pick any hack handler
Happstack
cabal install hack-handler-happstack
get a starter kit ( template )
mkdir myblog
cd myblog
# get a template to start
git clone git://github.com/nfjinjing/bamboo-template.git db
create an entry point
put this into Main.hs
module Main where
import Bamboo
import Hack.Handler.Happstack
import Hack.Contrib.Utils
import Hack.Contrib.Middleware.ContentType
import Hack.Contrib.Middleware.ContentLength
import Hack.Contrib.Middleware.ShowExceptions
import Hack.Contrib.Middleware.Static
import qualified Hack.Contrib.Middleware.Head as H
default_content_type = "text/plain; charset=UTF-8"
middleware_stack =
[ dummy_middleware
-- completeness
, content_length
, content_type default_content_type
-- debuging
, show_exceptions Nothing
-- optimization
, H.head
-- static serve
, static (Just "db/public") ["/theme", "/images", "/plugin", "/favicon.ico"]
-- real app
, bamboo
]
app = use middleware_stack dummy_app
main = run app
run
ghc --make -O2 Main.hs
./Main
It should be running on http://127.0.0.1:3000 now.
Kibro
Install Kibro
cabal install kibro
cabal install hack-handler-kibro
Install lighttpd 1.4.19 (used by kibro)
wget http://www.lighttpd.net/download/lighttpd-1.4.19.tar.gz
tar zxfv lighttpd-1.4.19.tar.gz
cd lighttpd-1.4.19
./configure --prefix=$HOME
make
make install
make sure ~/sbin
is in your $PATH
.
You also need spawn-fcgi in your path. I don't remember how I got mine, but it should come with lighttpd somewhere ...
bootstrap
# bamboo is a kibro project
kibro new myblog
cd myblog
# get a template to start
git clone git://github.com/nfjinjing/bamboo-template.git db
sh db/extra/scripts/bootstrap.sh
run
kibro start
It should be running on http://127.0.0.1:3000 now.