I am investigating how to easily setup a local work copy of a Branchable site, in the spirit of Ikiwiki's laptop wiki with git page. I would be very interested in reading some feedback!
- First, let's export the name of the site, and the local parameters.
export NAME=the-name-of-the-site-to-copy export LOCALPATH=/path/for/local/copy export LOCALDOMAIN=localdomain.example.com
- Second, let's clone its configuration and make a local branch. Later, configuration changes made on Branchable can be merged in that branch.
mkdir -p $NAME/setup cd $NAME/setup git init git remote add origin -t setup ssh://b-$NAME@$NAME.branchable.com/ git fetch origin git checkout -b setup origin/setup git checkout -b local-setup
- The setup file needs to be adapted to local paths, and the branchable modules need to be disabled.
# Adapt to local paths and names. sed -i "s|/home/b-|$LOCALPATH/|" ikiwiki.setup sed -i "s|branchable.com|$LOCALDOMAIN|" ikiwiki.setup # Disable the branchable plugins sed -i -e '/ - branchable/d' -e '/ - ikiwikihosting/d' ikiwiki.setup # Do not push/pull as we are working in ‘laptop’ mode. sed -i 's|source.git/hooks/post-update|source/.git/hooks/post-commit|' ikiwiki.setup sed -i 's|gitorigin_branch:.*|gitorigin_branch: ""|' ikiwiki.setup
- Now, let's clone the contents, and compile them locally:
cd .. git clone ssh://b-$NAME@$NAME.branchable.com/ source ikiwiki --setup setup/ikiwiki.setup
- The local HTML files can be served with Apache, with a configuration file similar to the one used in branchable:
curl 'http://source.ikiwiki-hosting.branchable.com/?p=source.git;a=blob_plain;f=templates/apache-site.tmpl;hb=HEAD' | perl -MHTML::Template -e ' $template = HTML::Template->new(filename => "/dev/stdin") ; $template->param(ADMINEMAIL => "admin\@example.com", HOSTNAME => "somewhere.localdomain.example.com", HOME => "/path/to/the/compiled/files"); print $template->output'
Charles, that's a great walkthrough. It probably deserves to be in tips.
Added, thanks for the encouragement ! --Charles
Of course, step zero is to install ikiwiki on your computer.
A future plan of mine is to add a two-level configuration to ikiwiki. That will let us leave the branchable-specific parts out of the main ikiwiki.setup file, and make this process slightly easier.
I don't know if using our apache-site.tmpl is worth the bother. The only significant apache setting is making ikiwiki the 404 handler. --Joey