Skip to content

Commit 752cf11

Browse files
committed
Merge pull request apache#999 from pdion891/dockerfile7
squashed commit for dockerfiles part#2 including comments from PR#910This PR replace PR#910 which include fix from comments in PR#910. This PR simplify download of systemvm templates, work with docker-compose and enable integration-api port and use of localstorage without reconfiguration of cloudstack. Rebased on Oct28. * pr/999: squashed commit for dockerfiles part#2 including comments from PR#910 Signed-off-by: Remi Bergsma <github@remi.nl>
2 parents 04f7208 + fb2e5d2 commit 752cf11

5 files changed

Lines changed: 116 additions & 7 deletions

File tree

‎tools/docker/Dockerfile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ RUN (/usr/bin/mysqld_safe &); \
5252
sleep 3; \
5353
mvn -Pdeveloper -pl developer -Ddeploydb; \
5454
mvn -Pdeveloper -pl developer -Ddeploydb-simulator; \
55-
pip install tools/marvin/dist/Marvin-4.6.0-SNAPSHOT.tar.gz
55+
MARVIN_FILE=`find tools/marvin/dist/ -name "Marvin*.tar.gz"` \
56+
pip install $MARVIN_FILE
5657

5758
EXPOSE 8080 8096
5859

‎tools/docker/Dockerfile.centos6‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,19 @@ LABEL Vendor="Apache.org" License="ApacheV2" Version="4.6.0"
2323
ENV PKG_URL=http://jenkins.buildacloud.org/job/package-rhel63-master/lastSuccessfulBuild/artifact/dist/rpmbuild/RPMS/x86_64
2424

2525
# install CloudStack
26-
RUN yum install -y \
26+
RUN yum install -y nc wget \
2727
${PKG_URL}/cloudstack-common-4.6.0-SNAPSHOT.el6.x86_64.rpm \
2828
${PKG_URL}/cloudstack-management-4.6.0-SNAPSHOT.el6.x86_64.rpm
2929

3030
RUN cd /etc/cloudstack/management; \
3131
ln -s tomcat6-nonssl.conf tomcat6.conf; \
3232
ln -s server-nonssl.xml server.xml; \
33-
ln -s log4j-cloud.xml log4j.xml
33+
ln -s log4j-cloud.xml log4j.xml; \
34+
wget -O /usr/share/cloudstack-common/scripts/vm/hypervisor/xenserver/vhd-util \
35+
http://download.cloud.com.s3.amazonaws.com/tools/vhd-util
36+
3437
COPY init.sh_centos6 /root/init.sh
38+
COPY systemtpl.sh /root/systemtpl.sh
3539

3640
RUN yum clean all
3741

‎tools/docker/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ tag:latest = master branch
8181
docker commit -m "init system.iso" -a "Apache CloudStack" cloudstack cloudstack/management_centos6
8282
```
8383

84+
8485
### Marvin
8586

8687
Build Marvin container usable to deploy cloud in the CloudStack management server container.

‎tools/docker/init.sh_centos6‎

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,41 @@
1717
# under the License.
1818
#
1919
# update database connection
20+
# /usr/bin/cloudstack-setup-databases cloud:password@$MYSQL_PORT_3306_TCP_ADDR
2021
# start cloudstack-management server
21-
#/usr/bin/cloudstack-setup-databases cloud:password@$MYSQL_PORT_3306_TCP_ADDR
2222

2323
# initial startup of the container to generage ssh_key
2424
# performed as privileged
2525
if [ ! -d /var/cloudstack/management/.ssh ]; then
2626
mknod /dev/loop6 -m0660 b 7 6
2727
fi
28-
sleep 5
2928

30-
mysql -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD" -h"$MYSQL_PORT_3306_TCP_ADDR" \
29+
# if global setting are changed, it will restart the management server
30+
RESTART_REQUIRED=false
31+
32+
if [ ! $MYSQL_PORT_3306_TCP_ADDR ]; then
33+
echo "variable MYSQL_PORT_3306_TCP_ADDR not define"
34+
exit 12
35+
fi
36+
37+
until nc -z $MYSQL_PORT_3306_TCP_ADDR 3306; do
38+
echo "waiting for mysql-server..."
39+
sleep 1
40+
done
41+
42+
mysql -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD" -h "$MYSQL_PORT_3306_TCP_ADDR" \
3143
-e "show databases;"|grep -q cloud
3244

3345
case $? in
3446
1)
3547
echo "deploying new cloud databases"
48+
INITIATED=false
3649
cloudstack-setup-databases cloud:password@${MYSQL_PORT_3306_TCP_ADDR} \
3750
--deploy-as=root:${MYSQL_ENV_MYSQL_ROOT_PASSWORD} -i localhost
3851
;;
3952
0)
4053
echo "using existing databases"
54+
INITIATED=true
4155
cloudstack-setup-databases cloud:password@${MYSQL_PORT_3306_TCP_ADDR}
4256
;;
4357
*)
@@ -47,4 +61,27 @@ case $? in
4761
esac
4862

4963
service cloudstack-management start
50-
tail -f /var/log/cloudstack/management/catalina.out
64+
sleep 10
65+
66+
if [ $HYPERVISOR_TEMPLATE ]; then
67+
#download the systemvm template into /exports
68+
/root/systemtpl.sh $HYPERVISOR_TEMPLATE
69+
fi
70+
71+
if [ $CLOUDSTACK_HOST ]; then
72+
mysql -u root -p${MYSQL_ENV_MYSQL_ROOT_PASSWORD} -h ${MYSQL_PORT_3306_TCP_ADDR} -e \
73+
"UPDATE cloud.configuration SET value='${CLOUDSTACK_HOST}' where name = 'host';"
74+
RESTART_REQUIRED=true
75+
fi
76+
77+
if [ $DEV_API ] && [ $INITIATED == false ]; then
78+
mysql -u root -p${MYSQL_ENV_MYSQL_ROOT_PASSWORD} -h ${MYSQL_PORT_3306_TCP_ADDR} -e \
79+
"UPDATE cloud.configuration SET value='8096' where name = 'integration.api.port';"
80+
mysql -u root -p${MYSQL_ENV_MYSQL_ROOT_PASSWORD} -h ${MYSQL_PORT_3306_TCP_ADDR} -e \
81+
"UPDATE cloud.configuration SET value='true' where name = 'system.vm.use.local.storage';"
82+
RESTART_REQUIRED=true
83+
fi
84+
85+
[ $RESTART_REQUIRED == true ] && service cloudstack-management restart
86+
87+
tail -f /var/log/cloudstack/management/management-server.log

‎tools/docker/systemtpl.sh‎

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/usr/bin/env bash
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
19+
#set -x
20+
21+
usage() {
22+
echo "Usage:"
23+
echo " `basename $0`: <hypervisor>"
24+
echo " `basename $0`: {xenserver, kvm, vmware, lxc, ovm}"
25+
exit 2
26+
}
27+
28+
[ $# -lt 1 ] && usage
29+
30+
31+
HYPERVISOR=$1
32+
33+
INSTALL_SYS_TMPLT=/usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt
34+
EXPORT_PATH=/exports/secondary
35+
36+
if [ ! -d ${EXPORT_PATH} ]; then
37+
echo "ERROR: Secondary Storage path '${EXPORT_PATH}' not found."
38+
exit 3
39+
fi
40+
41+
URL="http://jenkins.buildacloud.org/job/build-systemvm64-master/lastSuccessfulBuild/artifact/tools/appliance/dist"
42+
case $HYPERVISOR in
43+
kvm)
44+
TO_DOWNLOAD=${URL}/systemvm64template-master-4.6.0-kvm.qcow2.bz2
45+
;;
46+
xenserver)
47+
TO_DOWNLOAD=${URL}/systemvm64template-master-4.6.0-xen.vhd.bz2
48+
;;
49+
vmware)
50+
TO_DOWNLOAD=${URL}/systemvm64template-master-4.6.0-vmware.ova
51+
;;
52+
lxc)
53+
TO_DOWNLOAD=${URL}/systemvm64template-master-4.6.0-kvm.qcow2.bz2
54+
;;
55+
ovm)
56+
TO_DOWNLOAD=${URL}/systemvm64template-master-4.6.0-ovm.raw.bz2
57+
;;
58+
*)
59+
echo "ERROR: hypervisor not found"
60+
exit 4
61+
;;
62+
esac
63+
64+
${INSTALL_SYS_TMPLT} -m ${EXPORT_PATH} -u ${TO_DOWNLOAD} -h $HYPERVISOR
65+
66+
exit 0

0 commit comments

Comments
 (0)