pwFoo
September 18, 2015, 7:05pm
1
Hi,
I try to extend RancherOS. First try: convoy os-service
How could a add the needed files (convoy, convoy-pdata_tools) to RancherOS /usr/bin/ directory?
I wouldn’t hack / modify RancherOS, so I would prefer to use volumes to add the binaries to the host filesystem and start the convoy daemon with the docker command.
Could someone help me with examples?
pwFoo
September 18, 2015, 8:15pm
2
First step / try is to build a image to use.
Here is the dockerfile. Start it as docker container from RancherOS works fine.
FROM rancher/os-state:v0.4.0-rc6
#ADD https://github.com/rancher/convoy/releases/download/v0.3/convoy.tar.gz /tmp/convoy.tar.gz
ADD convoy.tar.gz /tmp/convoy.tar.gz
RUN cp /tmp/convoy.tar.gz/convoy/convoy* /usr/bin/
RUN rm -rf /tmp/convoy.tar.gz
RUN mkdir -p /var/lib/docker/convoy-volumes
RUN mkdir -p /etc/docker/plugins
RUN echo "unix:///var/run/convoy/convoy.sock" > /etc/docker/plugins/convoy.spec
RUN echo "/usr/bin/convoy daemon --drivers vfs --driver-opts vfs.path=/var/lib/docker/convoy-volumes" > /convoy-daemon
RUN chmod +x /convoy-daemon
CMD ["/convoy-daemon"]
But how to build it as os-service executed during boot and mapping directories / files to RancherOS?
pwFoo
October 7, 2015, 7:22pm
3
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
Should be improved and added as an os-service?
And there should be a better way (–volumes-from) instead of the host directory mapping…
pwFoo
January 2, 2016, 10:11pm
4
Posted the latest test image / commands here:
https://github.com/rancher/os/issues/706