buildbot-ros icon indicating copy to clipboard operation
buildbot-ros copied to clipboard

Example Docker config improvements

Open mikepurvis opened this issue 9 years ago • 10 comments

Hey— so, I've mucked about with things a bit in my own repo, and I just want to describe them a bit before I prepare a PR for it. The Dockerfile is somewhat shorter and simpler:

FROM ubuntu:trusty
MAINTAINER Mike Purvis

ENV DEBIAN_FRONTEND noninteractive
ENV BUILDBOT_CREATED nov_7_2014

# Install build stuff.
RUN apt-get update
RUN apt-get install -q -y python-virtualenv python-dev
RUN apt-get install -q -y reprepro cowbuilder debootstrap devscripts git git-buildpackage debhelper
RUN apt-get install -q -y debmirror

RUN virtualenv --no-site-packages /root/buildbot-env
RUN echo "export PATH=/root/buildbot-ros/scripts:${PATH}" >> /root/buildbot-env/bin/activate
RUN . /root/buildbot-env/bin/activate
RUN pip install rosdistro buildbot buildbot-slave

# Pick up the buildbot configuration
ADD . /root/buildbot-ros

# Create Buildbot.
RUN buildbot create-master /root/buildbot-ros
RUN buildslave create-slave /root/rosbuilder1 localhost:9989 rosbuilder1 [pw1]
RUN buildslave create-slave /root/rosbuilder2 localhost:9989 rosbuilder2 [pw2]

# Fix the file creation defaults.
RUN sed --in-place=.bak 's/umask = None/umask = 0022/' /root/buildbot-ros/buildbot.tac
RUN sed --in-place=.bak 's/umask = None/umask = 0022/' /root/rosbuilder1/buildbot.tac

EXPOSE 8010
CMD /root/buildbot-ros/run_server

And the build/run is now a two-parter, including the webserver for the resultant packages:

docker build -t buildbot-ros .
docker run -d -p 8000:80 -v /var/www:/usr/share/nginx/html:ro --name="packages" nginx
docker run -d --privileged -p 8010:8010 -v /var/www:/var/www:rw \
              --link=packages:packages --name="buildbot-ros" buildbot-ros

The major changes to watch out for here are:

  • The buildbot-ros configuration files are being added in, rather than git-cloned in. This is better because docker can tell when you've changed the directory and it needs to rebuild. It also allows us to defer the key setup stuff until we're inside run_server.
  • Because of this, the Dockerfile is in the root directory of the repo.
  • The buildbot is able to access the built packages at http://packages/building; you can access them at http://[dockerd ip]:8000.

My proposal would be that the buildbot-ros repo (this one) gain an example signing key and Dockerfile in the root directory, with the idea that it can be deployed unmodified to inspect and play with, and that users deploying their own instances of buildbot-ros would clone this repo, create new keys, change the rosdistro url, and make any other changes needed for their use, and then build and deploy their own variant of the container.

For clarity, the run_server command (which now also handles the key stuff) would move to scripts/run_docker_container or similar.

Does this seem reasonable?

mikepurvis avatar Nov 11 '14 20:11 mikepurvis