This repository has been archived by the owner on Jun 26, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update docker containers for CentOS7
In order to migrate docker containers to CentOS7 the following fixes and improvements were made: * systemd service is a PID 1 service in each container instead of 'start.sh' * 'start.sh' script converted to systemd service and started automatically every time a container is launched * Dockerfiles simplified by removing all setup stuff to separate 'setup.sh' file which should be launched explicitely during container preparation phase Blueprint: master-on-centos7 Is NOT compatible with CentOS6 master node Co-Authored-By: Ivan Suzdal <isuzdal@mirantis.com> Change-Id: I5f51f473a6fa783c0a85985a5bf0412b30bcb1c2
- Loading branch information
Showing
38 changed files
with
1,102 additions
and
522 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash -xe | ||
|
||
rm -rf /etc/yum.repos.d/* | ||
|
||
cat << EOF > /etc/yum.repos.d/nailgun.repo | ||
[nailgun] | ||
name=Nailgun Local Repo | ||
baseurl=http://$(route -n | awk '/^0.0.0.0/ {print $2}'):${DOCKER_PORT}/repo/os/x86_64/ | ||
gpgcheck=0 | ||
[mos] | ||
name=MOS Local Repo | ||
baseurl=http://$(route -n | awk '/^0.0.0.0/ {print $2}'):${DOCKER_PORT}/mos-repo/ | ||
gpgcheck=0 | ||
EOF | ||
|
||
for repo in ${EXTRA_RPM_REPOS}; do | ||
IFS=, read -a repo_args <<< "$repo" | ||
cat << EOF >> /etc/yum.repos.d/nailgun.repo | ||
[extra-repo-${repo_args[0]}] | ||
name=MOS Extra Repo ${repo_args[0]} | ||
baseurl=http://$(route -n | awk '/^0.0.0.0/ {print $2}'):${DOCKER_PORT}/extra-repos/${repo_args[0]} | ||
gpgcheck=0 | ||
EOF | ||
done | ||
|
||
yum clean expire-cache | ||
yum update -y | ||
|
||
packages="psmisc python-editor nailgun-mcagents sysstat " | ||
packages+="rubygem-amqp rubygem-amq-protocol rubygem-i18n rubygem-tzinfo " | ||
packages+="rubygem-minitest rubygem-open4 rubygem-Platform rubygem-symboltable " | ||
packages+="rubygem-thread_safe rubygem-eventmachine fuel-agent" | ||
|
||
echo $packages | xargs -n1 yum install -y | ||
|
||
#FIXME(dteselkin): use correct versions of rubygem packages | ||
sed -i '/amq-protocol/ s/~>/>=/' /usr/share/gems/specifications/amqp-*.gemspec | ||
|
||
|
||
systemctl daemon-reload | ||
puppet apply --debug --verbose --color false --detailed-exitcodes \ | ||
/etc/puppet/modules/nailgun/examples/astute-only.pp || [[ $? == 2 ]] | ||
|
||
cat << EOF > /etc/yum.repos.d/nailgun.repo | ||
[nailgun] | ||
name=Nailgun Local Repo | ||
baseurl=file:/var/www/nailgun/centos/x86_64 | ||
gpgcheck=0 | ||
[mos] | ||
name=MOS Local Repo | ||
baseurl=file:/var/www/nailgun/mos-centos/x86_64 | ||
gpgcheck=0 | ||
EOF | ||
|
||
yum clean all | ||
|
||
systemctl enable start-container.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,22 @@ | ||
# fuel/cobbler | ||
# fuel-cobbler | ||
# | ||
# Version 0.1 | ||
|
||
FROM fuel/centos | ||
MAINTAINER Matthew Mosesohn mmosesohn@mirantis.com | ||
|
||
#Make empty SSH key (populated later during real deployment) | ||
RUN rm -rf /etc/yum.repos.d/*; \ | ||
echo -e "\ | ||
[nailgun]\n\ | ||
name=Nailgun Local Repo\n\ | ||
baseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/repo/os/x86_64/\n\ | ||
gpgcheck=0\n\ | ||
[mos]\n\ | ||
name=MOS Local Repo\n\ | ||
baseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/mos-repo/\n\ | ||
gpgcheck=0" \ | ||
> /etc/yum.repos.d/nailgun.repo; \ | ||
yum clean expire-cache; \ | ||
yum update -y; \ | ||
mkdir -p /var/log/nailgun /root/.ssh; \ | ||
chmod 700 /root/.ssh; \ | ||
touch /root/.ssh/id_rsa.pub; \ | ||
chmod 600 /root/.ssh/id_rsa.pub; \ | ||
ln -s /etc/dnsmasq.conf /etc/cobbler.dnsmasq.conf | ||
ENV container docker | ||
ENV DOCKER_PORT _PORT_ | ||
ENV EXTRA_RPM_REPOS _EXTRA_RPM_REPOS_ | ||
|
||
ADD etc /etc | ||
ADD start.sh /usr/local/bin/start.sh | ||
ADD start.sh /usr/local/bin/ | ||
ADD setup.sh /usr/local/bin/ | ||
|
||
RUN echo -e "NETWORKING=yes\nHOSTNAME=$HOSTNAME" > /etc/sysconfig/network; \ | ||
/etc/init.d/httpd start; \ | ||
puppet apply --detailed-exitcodes -dv \ | ||
/etc/puppet/modules/nailgun/examples/cobbler-only.pp; \ | ||
[[ $? == 0 || $? == 2 ]] | ||
|
||
RUN echo -e "\ | ||
[nailgun]\n\ | ||
name=Nailgun Local Repo\n\ | ||
baseurl=file:/var/www/nailgun/centos/x86_64\n\ | ||
gpgcheck=0\n\ | ||
[mos]\n\ | ||
name=MOS Local Repo\n\ | ||
baseurl=file:/var/www/nailgun/mos-centos/x86_64\n\ | ||
gpgcheck=0" \ | ||
> /etc/yum.repos.d/nailgun.repo; \ | ||
yum clean all; \ | ||
chmod +x /usr/local/bin/start.sh | ||
RUN chmod +x /usr/local/bin/{setup,start}.sh | ||
|
||
EXPOSE 53 53/udp 67 67/udp 69/udp 80 443 | ||
|
||
VOLUME /etc/cobbler | ||
CMD /usr/local/bin/start.sh | ||
|
||
CMD ["/usr/sbin/init"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/bin/bash -xe | ||
|
||
rm -rf /etc/yum.repos.d/* | ||
|
||
cat << EOF > /etc/yum.repos.d/nailgun.repo | ||
[nailgun] | ||
name=Nailgun Local Repo | ||
baseurl=http://$(route -n | awk '/^0.0.0.0/ {print $2}'):${DOCKER_PORT}/repo/os/x86_64/ | ||
gpgcheck=0 | ||
[mos] | ||
name=MOS Local Repo | ||
baseurl=http://$(route -n | awk '/^0.0.0.0/ {print $2}'):${DOCKER_PORT}/mos-repo/ | ||
gpgcheck=0 | ||
EOF | ||
|
||
for repo in ${EXTRA_RPM_REPOS}; do | ||
IFS=, read -a repo_args <<< "$repo" | ||
cat << EOF >> /etc/yum.repos.d/nailgun.repo | ||
[extra-repo-${repo_args[0]}] | ||
name=MOS Extra Repo ${repo_args[0]} | ||
baseurl=http://$(route -n | awk '/^0.0.0.0/ {print $2}'):${DOCKER_PORT}/extra-repos/${repo_args[0]} | ||
gpgcheck=0 | ||
EOF | ||
done | ||
|
||
yum clean expire-cache | ||
yum update -y | ||
|
||
|
||
ln -s /etc/dnsmasq.conf /etc/cobbler.dnsmasq.conf | ||
|
||
packages="httpd cobbler dnsmasq xinetd tftp-server" | ||
echo $packages | xargs -n1 yum install -y | ||
|
||
|
||
mkdir -p /etc/systemd/system/{httpd,cobblerd,tftp,dnsmasq,xinetd}.service.d/ | ||
for srv in httpd cobblerd tftp dnsmasq xinetd; do | ||
cat << EOF > /etc/systemd/system/${srv}.service.d/restart.conf | ||
[Service] | ||
Restart=on-failure | ||
RestartSec=5 | ||
EOF | ||
done | ||
|
||
systemctl enable httpd.service \ | ||
cobblerd.service \ | ||
tftp.service \ | ||
dnsmasq.service \ | ||
xinetd.service | ||
|
||
|
||
#Workaround for dnsmasq startup and create blank SSH key during build | ||
cat << EOF > /etc/sysconfig/network | ||
NETWORKING=yes | ||
HOSTNAME=$HOSTNAME | ||
EOF | ||
|
||
mkdir -p /root/.ssh | ||
chmod 700 /root/.ssh | ||
touch /root/.ssh/id_rsa.pub | ||
systemctl restart httpd.service | ||
|
||
|
||
systemctl daemon-reload | ||
puppet apply --debug --verbose --color false --detailed-exitcodes \ | ||
/etc/puppet/modules/nailgun/examples/cobbler-only.pp || [[ $? == 2 ]] | ||
|
||
|
||
cat << EOF > /etc/yum.repos.d/nailgun.repo | ||
[nailgun] | ||
name=Nailgun Local Repo | ||
baseurl=file:/var/www/nailgun/centos/x86_64 | ||
gpgcheck=0 | ||
[mos] | ||
name=MOS Local Repo | ||
baseurl=file:/var/www/nailgun/mos-centos/x86_64 | ||
gpgcheck=0 | ||
EOF | ||
|
||
yum clean all | ||
|
||
|
||
systemctl enable start-container.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,32 @@ | ||
#fuel/centos-docker-build | ||
FROM centos:centos6 | ||
FROM centos:centos7 | ||
|
||
MAINTAINER Matthew Mosesohn mmosesohn@mirantis.com | ||
|
||
RUN echo -e "\ | ||
[nailgun]\n\ | ||
name=Nailgun Local Repo\n\ | ||
baseurl=file:///repo/os/x86_64/\n\ | ||
gpgcheck=0\n\ | ||
[mos]\n\ | ||
name=MOS Local Repo\n\ | ||
baseurl=file:///mos-repo/\n\ | ||
gpgcheck=0" \ | ||
> /etc/yum.repos.d/nailgun.repo | ||
ENV container docker | ||
ENV EXTRA_RPM_REPOS _EXTRA_RPM_REPOS_ | ||
|
||
RUN yum -y update | ||
RUN yum clean all | ||
RUN yum -y install dbus | ||
|
||
RUN systemctl mask dev-mqueue.mount dev-hugepages.mount \ | ||
systemd-remount-fs.service sys-kernel-config.mount \ | ||
sys-kernel-debug.mount sys-fs-fuse-connections.mount \ | ||
display-manager.service graphical.target systemd-logind.service \ | ||
firewalld.service | ||
|
||
ADD dbus.service /etc/systemd/system/dbus.service | ||
RUN systemctl enable dbus.service | ||
|
||
RUN rm -f /etc/yum.repos.d/* | ||
|
||
ADD start.sh /usr/local/bin/ | ||
ADD fuel-centos.ks /root/fuel-centos.ks | ||
|
||
RUN chmod +x /usr/local/bin/start.sh; \ | ||
touch /etc/sysconfig/network | ||
RUN chmod +x /usr/local/bin/start.sh | ||
|
||
# Set default target | ||
RUN systemctl set-default multi-user.target | ||
|
||
CMD /usr/local/bin/start.sh | ||
CMD ["/usr/lib/systemd/systemd"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[Unit] | ||
Description=D-Bus System Message Bus | ||
Requires=dbus.socket | ||
After=syslog.target | ||
|
||
[Service] | ||
PIDFile=/var/run/messagebus.pid | ||
ExecStartPre=/bin/mkdir -p /var/run/dbus | ||
ExecStartPre=/bin/chmod g+w /var/run/ /var/run/dbus/ | ||
ExecStart=/bin/dbus-daemon --system --fork | ||
ExecReload=/bin/dbus-send --print-reply --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig | ||
ExecStopPost=/bin/rm -f /var/run/messagebus.pid | ||
#OOMScoreAdjust=-900 | ||
User=dbus | ||
Group=root | ||
PermissionsStartOnly=true | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
Oops, something went wrong.