In the spirit of Ikiwiki's laptop tip, it is possible to set up a local copy of a Branchable site, with an organisation similar to the original, where the working git clone, the setup file, the website and the logs are in separate subdirectories.

  • Of course, Ikiwiki needs to be installed locally. On Debian systems, the command apt-get install ikiwiki will install the programs needed by many plugins, but not all. Depending on which ones you use, it may be necessary to look in the packages suggested by ikiwiki and install the relevant ones if you encounter errors when compiling your local website copy.

  • In a first step, export the name of the Branchable site, the path to the directory that will store the local copy, and the local domain used for browsing:

export NAME=the-name-of-the-site-to-copy
export LOCALPATH=/path/for/local/copy
export LOCALDOMAIN=example.com
  • Then, clone the Branchable site's configuration and make a local branch. Later, configuration changes made on Branchable can be merged in that branch.
mkdir -p $LOCALPATH/$NAME/setup
cd $LOCALPATH/$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|/var/www/b-$NAME|$LOCALPATH/$NAME/public_html|" 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
  • These local changes can be commited.
git commit -m 'Local copy.' ikiwiki.setup
  • Now 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.