Nethence Newdoc Olddoc Lab Your IP BBDock  

Setting up Gollum within a Docker container

Launch the container

Check what TCP ports you still got available on the Docker host,

netstat -antpe --inet --inet6 | grep LISTEN

then run the custom/ubuntu container that will serve Gollum on the port of your choice e.g. 8082 (Gollum serves on 4567 by default),

app=gollumprod
docker ps -a | grep $app
docker run -d --name $app -h $app \
        -p 8082:4567 \
        --volume /data/$app:/$app \
        custom/ubuntu
docker ps -a | grep $app
docker logs $app

Note. if you wanna serve an existing GIT repo that contains supported documentation formats,

#--volume /path/to/existing/git/repo:/$app \

Enter the container,

docker exec -ti $app bash

Gollum Installation

Install the needed packages as root, and use the system-wide shit for the tables to display correctly,

apt -y install ruby
#git? zlib1g-dbg?
gem install gollum
gem install github-markdown

alternative,

#apt -y install git ruby ruby-dev zlib1g-dbg zlib1g-dev libicu-dev make build-essential
#gem install bundle
#git clone https://github.com/gollum/gollum.git
#git clone https://github.com/sekhmeth13/gollum-tweaked.git
#cd gollum/
#bundle install

Eventually setup the user account to have the same UID and GID as the docker host user, so the doc can be edited AND commited both sides from the command line: from the docker host as well as on the gollum container,

groupadd -g 1002 gollum
useradd -m -u 1002 -g 1002 gollum
su - gollum

Otherwise you can stay root as we’re still into a container.

Make sure the TERM and EDITOR variables are setup,

#export TERM=screen
echo $TERM

#export EDITOR=vim.nox
echo $EDITOR

update-alternatives --config editor

GIT setup to handle the documentation

Setup the GIT profile that corresponds to the non-authenticated Gollum WUI: try to use some mailing-list address and shared name. You will be able to setup binding to some Directory Server afterwards anyway.

git config --global user.email "project@example.com"
git config --global user.name "ACME Project"

Either locate the right GIT repo you’ve already shared at docker-run time e.g.,

ls -alhF /gollumprod/

Or create a local repository,

cd ~/
git init doc
cd doc/
vi check.md
git add check.md
git commit
git status

Ready to go

Now either as gollum user (see above) or simply as root (still in a container),

cd /
/usr/local/bin/gollum gollumprod/ --allow-uploads &
#cd ~/gollum/
#bundle exec bin/gollum --help
#bundle exec bin/gollum ../doc/
##bundle exec bin/gollum /gollumprod/

Notes.

Check that you can now access the Markdown GUI e.g.,

http://dockerhost:8082/

Everything’s fine? Then back to the container, temporarily break the service and setup the init,

cd ~/
vi init.bash

#!/bin/bash
set -e
cd $HOME/gollum/
bundle exec bin/gollum ../doc/
#bundle exec bin/gollum /gollumprod/

./init.bash

Check again with the web browser then backup the container as an image while updating the entrypoint,

docker commit --change='CMD ["/root/init.bash"]' -p gollumprod gollumprod.`date +%s`.ready

Now eventually enable a reverse-proxy against the mapped Docker host port 8082.

References


Home | GitHub | Donate | Feedback