Skip to content

Instantly share code, notes, and snippets.

@eriweb
Created October 7, 2015 10:11
Show Gist options
  • Save eriweb/2b44be5305953cdeb84b to your computer and use it in GitHub Desktop.
Save eriweb/2b44be5305953cdeb84b to your computer and use it in GitHub Desktop.
#Dockerfile
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
FROM ubuntu:14.04
MAINTAINER "Apache CloudStack" <dev@cloudstack.apache.org>
LABEL Vendor="Apache.org" License="ApacheV2" Version="4.6.0"
ENV PKG_URL=http://jenkins.buildacloud.org/job/package-deb-master/lastSuccessfulBuild/artifact/dist/debian/
# install CloudStack and requirements
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y curl openssh-server gdebi-core
RUN curl -O ${PKG_URL}/cloudstack-common_4.6.0-SNAPSHOT_all.deb
RUN curl -O ${PKG_URL}/cloudstack-agent_4.6.0-SNAPSHOT_all.deb
RUN gdebi -n cloudstack-common_4.6.0-SNAPSHOT_all.deb
RUN gdebi -n cloudstack-agent_4.6.0-SNAPSHOT_all.deb
RUN rm *.deb
RUN apt-get autoremove -y
RUN apt-get autoclean
RUN locale-gen en_US.UTF-8
COPY init.sh_kvmhost /root/init.sh
CMD ["/root/init.sh"]
#init.sh_kvmhost
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
set -x
echo "root:password" | chpasswd
# Enable root logins over ssh
sed -i 's/.*PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
service ssh start
# For NFS access
service rpcbind start
# Try to fix issues
usermod -G tty libvirt-qemu
#Configure libvirt
sed -i 's/.*listen_tls.*/listen_tls=0/' /etc/libvirt/libvirtd.conf
sed -i 's/.*listen_tcp.*/listen_tcp=1/' /etc/libvirt/libvirtd.conf
sed -i 's/.*tcp_port.*/tcp_port="16509"/' /etc/libvirt/libvirtd.conf
sed -i 's/.*auth_tcp.*/auth_tcp="none"/' /etc/libvirt/libvirtd.conf
sed -i 's/.*mdns_adv.*/mdns_adv=0/' /etc/libvirt/libvirtd.conf
if [ -f /etc/sysconfig/libvirtd ]; then
# RedHat Host
sed -i "s/LIBVIRTD_ARGS=.*/LIBVIRTD_ARGS=-l/" /etc/sysconfig/libvirtd
service libvirtd start
fi
if [ -f /etc/default/libvirt-bin ]; then
# Ubuntu/Debian Host
sed -i 's/libvirtd_opts=.*/libvirtd_opts="-d -l"/' /etc/default/libvirt-bin
service libvirt-bin start
fi
sleep 30
until [ -f /var/log/cloudstack/agent/agent.log ]; do
sleep 10
done
while true; do
tail -f /var/log/cloudstack/agent/agent.log
sleep 3
done
# Ugly hack to make sure the container doesn't exit
tail -f /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment