/dev/rantom

line noise

Blogging With Octopress and Git

Server-side generated static html blog. Markdown. Generated on git push. What’s not to like?

Octopress

The setup is quite simple. Clone/fork the repository

1
2
3
git clone git://github.com/imathis/octopress.git
bundle install
rake install

Git repo

Setup an additional repository on production machine.

1
2
3
mkdir -p $HOME/repositories/blog.git
cd $HOME/repositories/blog.git
git init --bare

Final touch is a post-receive hook that builds our blog.

post-receive
1
2
3
4
5
6
7
8
#!/usr/local/bin/zsh
source $HOME/local/share/chruby/chruby.sh
chruby 1.9.3-p392
GIT_WORK_TREE=$HOME/blog/staging git checkout -f
cd $HOME/blog/staging
bundle install
rake generate
rsync -av public/ /var/www/blog

Here zsh is used to provide necessary magic for chruby to work. Supposedly bash would work equally well.

On the development machine add new remote

1
2
git remote add blog ssh:/your-host.tld/path/to/your/repo/blog.git
git push blog master

Now the blog should be live.

Comments