Add binary to RancherOS as os-service

Created an first working version of convoy plugin…

dockerfile

FROM rancher/os-console:v0.4.0-rc10

ADD convoy.tar.gz /tmp/convoy.tar.gz
RUN cp -f /tmp/convoy.tar.gz/convoy/convoy* /
RUN rm -rf /tmp/convoy.tar.gz

ADD convoy-start.sh /convoy-start.sh
RUN chmod +x /convoy-start.sh

RUN echo "unix:///var/run/convoy/convoy.sock" > /tmp/convoy.spec

CMD ["/convoy-start.sh"]

convoy-start.sh

#!/bin/sh

if [ ! -d /var/lib/docker/convoy-volumes ]; then
    mkdir -p /var/lib/docker/convoy-volumes
fi

if [ ! -d /etc/docker/plugins ]; then
    mkdir -p /etc/docker/plugins
fi

if [ ! -d /var/run/convoy ]; then
    mkdir -p /var/run/convoy
fi 

if [ "$(cat /tmp/convoy.spec)" != "$(cat /etc/docker/plugins/convoy.spec)" ]; then
    mv -f /tmp/convoy.spec /etc/docker/plugins/convoy.spec
else
    rm /tmp/convoy.spec
fi

ln -fs /convoy /usr/bin/convoy
ln -fs /convoy-pdata_tools /usr/bin/convoy-pdata_tools

/usr/bin/convoy daemon --drivers vfs --driver-opts vfs.path=/var/lib/docker/convoy-volumes

Also need the convoy.tar.gz from ranchre convoy inside the docker build directory.

Start convoy-plugin container

sudo system-docker run --rm -ti -v /etc/docker:/etc/docker -v /var/lib/docker:/var/lib/docker -v /usr/bin:/usr/bin -v /var/run:/var/run convoy-plugin

convoy volumes can be used with system-docker and also (user-)docker.

I think it isn’t best practise so far, but it works as a simple system-docker container :smile:
Should be improved and added as an os-service?
And there should be a better way (–volumes-from) instead of the host directory mapping…