2

My local Gitlab CE Docker container has Subgit included. When the Gitlab container is restarted the Subgit synchronisation should also start automatically.

My solution is derived from the original Dockerfile of gitlab/gitlab-ce on Dockerhub. In the original Dockerfile an SSH daemon has been added and set under control of runit.

I did the same with Subgit. Under /opt/gitlab/sv/subgit are my runit resources and subgit is enabled by setting a soft link to the /opt/gitlab/service directory. But when Gitlab Container is started the soft link is removed and therefore runsvdir is ignoring my Subgit runit files. When the soft link is enabled manually runsvdir is starting Subgit synchronisation successfully.

How can I persist the soft link and keep the automatic start of Subgit enabled respectively?


Here is the part of the Dockerfile regarding Subgit and runit:

RUN mkdir -p /opt/gitlab/sv/subgit/supervise && \
mkfifo /opt/gitlab/sv/subgit/supervise/ok && \
ln -s /opt/gitlab/sv/subgit /opt/gitlab/service/subgit
COPY ./runit_subgit_run /opt/gitlab/sv/subgit/run
COPY ./runit_subgit_finish /opt/gitlab/sv/subgit/finish
RUN chmod a+x /opt/gitlab/sv/subgit/run /opt/gitlab/sv/subgit/finish

And this is the run file for runit. The real Gitlab group and project names are replaced.

#!/bin/sh

exec 2>&1

exec /bin/sh -c "( subgit install \
"/var/opt/gitlab/git-data/repositories/<group_1>/<project_1>.git" && \
subgit install \
"/var/opt/gitlab/git-data/repositories/<group_2>/<project_1>.git" && \
subgit register \
"/var/opt/gitlab/git-data/repositories/<group_1>/<project_1>.git" && \
subgit register \
"/var/opt/gitlab/git-data/repositories/<group_2>/<project_1>.git" )"
se2016
  • 21
  • 3

0 Answers0