Add packaging for Docker containers

In order to safely package containers, yum update -y
was added to each container.
Containers are now built and stored in an archive,
which is packed into a new rpm fuel-docker-images.

blueprint package-docker-images

Change-Id: Ib583e41ec07c9d60eb993216c00ef2f0ba2ca110
This commit is contained in:
Matthew Mosesohn 2015-02-11 16:05:01 +03:00
parent 381491f7e8
commit fe39c8f617
15 changed files with 76 additions and 28 deletions

View File

@ -5,7 +5,7 @@
FROM fuel/centos
MAINTAINER Matthew Mosesohn mmosesohn@mirantis.com
RUN rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean all; yum --quiet install -y ruby21-nailgun-mcagents sysstat
RUN rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean expire-cache ; yum update -y; yum --quiet install -y ruby21-nailgun-mcagents sysstat
ADD etc /etc
ADD start.sh /usr/local/bin/start.sh

View File

@ -5,7 +5,7 @@
FROM fuel/centos
MAINTAINER Matthew Mosesohn mmosesohn@mirantis.com
RUN rm -rf /etc/yum.repos.d/*;echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean all; yum --quiet install -y httpd cobbler dnsmasq xinetd tftp-server; ln -s /etc/dnsmasq.conf /etc/cobbler.dnsmasq.conf
RUN rm -rf /etc/yum.repos.d/*;echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean expire-cache; yum update -y; yum --quiet install -y httpd cobbler dnsmasq xinetd tftp-server; ln -s /etc/dnsmasq.conf /etc/cobbler.dnsmasq.conf
ADD etc /etc
ADD start.sh /usr/local/bin/start.sh

View File

@ -4,19 +4,14 @@ MAINTAINER Łukasz Oleś loles@mirantis.com
WORKDIR /root
RUN rm -rf /etc/yum.repos.d/*
RUN echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo
RUN yum clean all
RUN rm -rf /etc/yum.repos.d/*;echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean expire-cache;yum update -y
ADD etc /etc
RUN puppet apply --detailed-exitcodes -d -v /etc/puppet/modules/nailgun/examples/keystone-only.pp; [[ $? == 0 || $? == 2 ]]
ADD start.sh /usr/local/bin/start.sh
RUN chmod +x /usr/local/bin/start.sh
RUN echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=file:/var/www/nailgun/centos/x86_64\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo
RUN yum clean all
RUN chmod +x /usr/local/bin/start.sh; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=file:/var/www/nailgun/centos/x86_64\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean all
EXPOSE 35357
EXPOSE 5000

View File

@ -4,7 +4,7 @@ MAINTAINER Aleksandr Didenko adidenko@mirantis.com
WORKDIR /root
RUN rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean all; yum --quiet install -y sudo ruby21-mcollective
RUN rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean expire-cache; yum update -y; yum --quiet install -y sudo ruby21-mcollective
ADD etc /etc
ADD start.sh /usr/local/bin/start.sh

View File

@ -7,9 +7,7 @@ MAINTAINER Matthew Mosesohn mmosesohn@mirantis.com
WORKDIR /root
RUN rm -rf /etc/yum.repos.d/*;echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo;yum clean all;mkdir -p /opt/gateone/users/ANONYMOUS/ /var/log/nailgun
#Workaround for nailgun settings.yaml template
RUN mkdir -p /root/.ssh;chmod 700 /root/.ssh;touch /root/.ssh/id_rsa.pub;chmod 600 /root/.ssh/id_rsa.pub
RUN rm -rf /etc/yum.repos.d/*;echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo;yum clean expire-cache;yum update -y;mkdir -p /opt/gateone/users/ANONYMOUS/ /var/log/nailgun /root/.ssh;chmod 700 /root/.ssh;touch /root/.ssh/id_rsa.pub;chmod 600 /root/.ssh/id_rsa.pub
ADD etc /etc
ADD start.sh /usr/local/bin/start.sh

View File

@ -3,7 +3,7 @@
FROM fuel/centos
MAINTAINER Matthew Mosesohn mmosesohn@mirantis.com
RUN rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean all
RUN rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean expire-cache; yum update -y
ADD etc /etc
ADD start.sh /usr/local/bin/start.sh

View File

@ -5,7 +5,7 @@
FROM fuel/centos
MAINTAINER Matthew Mosesohn mmosesohn@mirantis.com
RUN rm -rf /etc/yum.repos.d/*;echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo;yum clean all; yum --quiet install -y python-fuelclient supervisor postgresql-libs
RUN rm -rf /etc/yum.repos.d/*;echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo;yum clean expire-cache;yum update -y; yum --quiet install -y python-fuelclient supervisor postgresql-libs
ADD etc /etc
ADD start.sh /usr/local/bin/start.sh

View File

@ -3,7 +3,7 @@ FROM fuel/centos
MAINTAINER Aleksandr Didenko adidenko@mirantis.com
RUN rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo;yum clean all;yum --quiet install -y sudo
RUN rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo;yum clean expire-cache; yum update -y
ADD etc /etc
ADD start.sh /usr/local/bin/start.sh

View File

@ -3,7 +3,7 @@
FROM fuel/centos
MAINTAINER Aleksandr Didenko adidenko@mirantis.com
RUN rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean all; yum --quiet install -y rabbitmq-server
RUN rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean expire-cache;yum update -y
ADD etc /etc
ADD start.sh /usr/local/bin/start.sh

View File

@ -5,7 +5,7 @@
FROM fuel/centos
MAINTAINER Matthew Mosesohn mmosesohn@mirantis.com
RUN rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo;yum clean all;yum --quiet install -y ruby21-puppet xinetd rsync logrotate
RUN rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo;yum clean expire-cache; yum update -y
ADD etc /etc
ADD start.sh /usr/local/bin/start.sh

View File

@ -2,7 +2,7 @@ FROM fuel/centos
MAINTAINER Aleksandr Didenko adidenko@mirantis.com
RUN rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean all;yum --quiet install -y anacron rsyslog
RUN rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean expire-cache; yum update -y
ADD etc /etc
ADD start.sh /usr/local/bin/start.sh

View File

@ -240,6 +240,7 @@ daemonize
dhcp
docker-io
fuelmenu
fuel-docker-images
gdisk
lrzip
lsof
@ -444,9 +445,6 @@ cp ${SOURCE}/send2syslog.py /bin/send2syslog.py
mkdir -p /var/lib/hiera
touch /var/lib/hiera/common.yaml /etc/puppet/hiera.yaml
# Deploy docker images and ctl tools if we built ISO with docker containers support
[ -d "${SOURCE}/docker" ] && cp -r ${SOURCE}/docker ${wwwdir}/docker
# Prepare local repository specification
rm /etc/yum.repos.d/CentOS*.repo
cat > /etc/yum.repos.d/nailgun.repo << EOF

View File

@ -59,7 +59,8 @@ $(BUILD_DIR)/iso/isoroot-centos.done: \
$(BUILD_DIR)/mirror/make-changelog.done \
$(BUILD_DIR)/packages/build.done \
$(BUILD_DIR)/openstack/build.done \
$(BUILD_DIR)/iso/isoroot-dotfiles.done
$(BUILD_DIR)/iso/isoroot-dotfiles.done \
$(BUILD_DIR)/packages/rpm/fuel-docker-images.done
mkdir -p $(ISOROOT)
rsync -rp $(LOCAL_MIRROR_CENTOS_OS_BASEURL)/ $(ISOROOT)
rsync -rp $(LOCAL_MIRROR)/centos-packages.changelog $(ISOROOT)
@ -114,11 +115,8 @@ $(ISOROOT)/puppet-slave.tgz: $(BUILD_DIR)/puppet/$(PUPPET_ART_NAME)
# DOCKER
########################
# DOCKER_ART_NAME is defined in /docker/module.mk
$(ISOROOT)/docker.done: $(BUILD_DIR)/docker/build.done
mkdir -p $(ISOROOT)/docker/images
cp $(BUILD_DIR)/docker/$(DOCKER_ART_NAME) $(ISOROOT)/docker/images/$(DOCKER_ART_NAME)
cp -a $(BUILD_DIR)/docker/sources $(ISOROOT)/docker/sources
cp -a $(BUILD_DIR)/docker/utils $(ISOROOT)/docker/utils
$(ISOROOT)/docker.done: $(BUILD_DIR)/docker/build.done \
$(BUILD_DIR)/packages/rpm/fuel-docker-images.done
$(ACTION.TOUCH)
########################

View File

@ -23,6 +23,7 @@ $(BUILD_DIR)/packages/rpm/buildd.tar.gz: $(BUILD_DIR)/mirror/centos/repo.done
sudo tar czf $@.tmp -C $(SANDBOX) .
mv $@.tmp $@
# Usage:
# (eval (call build_rpm,package_name))
define build_rpm
@ -87,5 +88,27 @@ $(BUILD_DIR)/packages/rpm/repo.done:
-o $(LOCAL_MIRROR_CENTOS_OS_BASEURL) $(LOCAL_MIRROR_CENTOS_OS_BASEURL)
$(ACTION.TOUCH)
$(BUILD_DIR)/packages/rpm/fuel-docker-images.done: SANDBOX:=$(BUILD_DIR)/packages/rpm/SANDBOX/fuel-docker-images
$(BUILD_DIR)/packages/rpm/fuel-docker-images.done: export SANDBOX_DOWN:=$(SANDBOX_DOWN)
$(BUILD_DIR)/packages/rpm/fuel-docker-images.done: \
$(BUILD_DIR)/repos/repos.done \
$(BUILD_DIR)/packages/rpm/buildd.tar.gz \
$(BUILD_DIR)/docker/build.done
mkdir -p $(BUILD_DIR)/packages/rpm/RPMS/x86_64
mkdir -p $(SANDBOX) && \
sudo tar xzf $(BUILD_DIR)/packages/rpm/buildd.tar.gz -C $(SANDBOX) && \
mkdir -p $(SANDBOX)/tmp/SOURCES && \
sudo cp -r $(BUILD_DIR)/docker/$(DOCKER_ART_NAME) $(SANDBOX)/tmp/SOURCES && \
(cd $(BUILD_DIR)/docker && sudo tar czf $(SANDBOX)/tmp/SOURCES/fuel-images-sources.tar.gz sources utils) && \
sudo cp $(SOURCE_DIR)/packages/rpm/specs/fuel-docker-images.spec $(SANDBOX)/tmp && \
sudo chroot $(SANDBOX) rpmbuild --nodeps -vv --define "_topdir /tmp" -ba /tmp/fuel-docker-images.spec
cp $(SANDBOX)/tmp/RPMS/*/fuel-docker-images-*.rpm $(BUILD_DIR)/packages/rpm/RPMS/x86_64
find $(BUILD_DIR)/packages/rpm/RPMS -name '*.rpm' | xargs cp -u --target-directory=$(LOCAL_MIRROR_CENTOS_OS_BASEURL)/Packages
createrepo -g $(LOCAL_MIRROR_CENTOS_OS_BASEURL)/comps.xml \
-o $(LOCAL_MIRROR_CENTOS_OS_BASEURL) $(LOCAL_MIRROR_CENTOS_OS_BASEURL)
$(ACTION.TOUCH)
$(BUILD_DIR)/packages/rpm/build.done: $(BUILD_DIR)/packages/rpm/repo.done
$(ACTION.TOUCH)

View File

@ -0,0 +1,36 @@
Name: fuel-docker-images
Summary: Fuel Docker images
Version: 1.0
Release: 1
License: Apache 2.0
BuildRoot: %{_tmppath}/%{name}-%{version}
Source0: fuel-images.tar.lrz
Source1: fuel-images-sources.tar.gz
URL: http://mirantis.com
Requires: docker-io
Requires: lrzip
%description
Images for deploying Fuel for OpenStack Docker containers
%prep
rm -rf %{name}-%{version}
mkdir %{name}-%{version}
cp %{SOURCE0} %{name}-%{version}
tar xzvf %{SOURCE1} -C %{name}-%{version}
%install
cd %{name}-%{version}
mkdir -p %{buildroot}/var/www/nailgun/docker/{images,sources,utils}
install -m 644 %{SOURCE0} %{buildroot}/var/www/nailgun/docker/images/fuel-images.tar.lrz
cp -R sources %{buildroot}/var/www/nailgun/docker/
cp -R utils %{buildroot}/var/www/nailgun/docker/
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root)
/var/www/nailgun/docker/images/fuel-images.tar.lrz
/var/www/nailgun/docker/sources/*
/var/www/nailgun/docker/utils/*