Dockerizing Gollum

setup | AD hack | image

Launch the container

Check that TCP port 4567 (default for Gollum) is still available on the Docker host,

netstat -antupe --inet --inet6 | grep LISTEN

then run the custom/ubuntu container,

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

Notes.

Enter the container,

docker exec -ti $app bash

Gollum Installation

See Setting up Gollum + as follows

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 1000 gollum
useradd -m -u 1000 -g 1000 gollum
su - gollum

Make sure the TERM and EDITOR variables are defined,

#export TERM=xterm-256color
echo $TERM

#export EDITOR=vim.nox
echo $EDITOR

update-alternatives --config editor

GIT setup to handle the documentation

See Setting up Gollum + as follows

Either locate the folder containing the existing bare-GIT repo that you’ve shared with docker-run e.g.,

ls -alhF /gollumprod/operations.git/

or create one.

Ready to go

Eventually make some handy symlinks,

cd ~/
ln -s /gollumprod/init.bash
ln -s /gollumprod

su - gollum
ln -s /gollumprod

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

su - gollum -c "/usr/local/bin/gollum /gollumprod/operations.git/ --allow-uploads --bare --config /gollumprod/config.rb" &

Check that you can now access the Markdown GUI e.g. (without passing tru the reverse-proxy yet),

http://dockerhost:4567/

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

cd ~/
vi init.bash

#!/bin/bash
set -e

su - gollum -c "/usr/local/bin/gollum /gollumprod/operations.git/ --allow-uploads --bare --config /gollumprod/config.rb" &

while true; do sleep 120; done

./init.bash

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

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

If you need to make some updates on the image while the entrypoint is already fixed,

docker commit -p gollumprod gollumprod.`date +%s`.ready
#docker rm -f gollumprod

Now that the init & logs are fine,

docker images

app=gollumprod

    [[ -n `docker ps -a | grep $app` ]] && \
            echo The $app container seems to be ALREADY RUNNING && exit 1

docker run -d --name $app -h $app \
        -p 4567:4567 \
        --volume /data/$app:/$app \
        `docker images | grep ^gollum | head -1 | awk '{print $1}'`

docker ps -a | grep $app
docker logs $app

docker images
docker rmi ...

and finally check that the daemon is eventually running as gollum user instead of root inside the container, so you can now proceed with the maintenance of the documentation repo tru SSH!

docker exec -ti gollumprod bash
ps auxfw

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


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun