Return-Path: X-Original-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AB566E7B1 for ; Sat, 15 Dec 2012 03:37:20 +0000 (UTC) Received: (qmail 72969 invoked by uid 500); 15 Dec 2012 03:37:19 -0000 Delivered-To: apmail-incubator-cloudstack-commits-archive@incubator.apache.org Received: (qmail 72140 invoked by uid 500); 15 Dec 2012 03:37:18 -0000 Mailing-List: contact cloudstack-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cloudstack-dev@incubator.apache.org Delivered-To: mailing list cloudstack-commits@incubator.apache.org Received: (qmail 70874 invoked by uid 99); 15 Dec 2012 03:37:14 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 15 Dec 2012 03:37:14 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 8B48E81D11B; Sat, 15 Dec 2012 03:37:14 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bhaisaab@apache.org To: cloudstack-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [15/15] Merge in of cleanup work. Message-Id: <20121215033714.8B48E81D11B@tyr.zones.apache.org> Date: Sat, 15 Dec 2012 03:37:14 +0000 (UTC) http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/devcloudbox/puppet-devcloud/files/iptables.save ---------------------------------------------------------------------- diff --git a/tools/devcloud/devcloudbox/puppet-devcloud/files/iptables.save b/tools/devcloud/devcloudbox/puppet-devcloud/files/iptables.save deleted file mode 100644 index 3339327..0000000 --- a/tools/devcloud/devcloudbox/puppet-devcloud/files/iptables.save +++ /dev/null @@ -1,30 +0,0 @@ -# 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. - -*mangle -:PREROUTING ACCEPT [397:23804] -:INPUT ACCEPT [397:23804] -:FORWARD ACCEPT [0:0] -:OUTPUT ACCEPT [238:22820] -:POSTROUTING ACCEPT [238:22820] --A POSTROUTING -p udp -m udp --dport 68 -j CHECKSUM --checksum-fill -COMMIT -*filter -:INPUT ACCEPT [453:27164] -:FORWARD ACCEPT [0:0] -:OUTPUT ACCEPT [273:26476] -COMMIT http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/devcloudbox/puppet-devcloud/files/startdevcloud.sh ---------------------------------------------------------------------- diff --git a/tools/devcloud/devcloudbox/puppet-devcloud/files/startdevcloud.sh b/tools/devcloud/devcloudbox/puppet-devcloud/files/startdevcloud.sh deleted file mode 100644 index f496891..0000000 --- a/tools/devcloud/devcloudbox/puppet-devcloud/files/startdevcloud.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -# 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. - -export CATALINA_HOME=/opt/cloudstack/apache-tomcat-6.0.32 -cd /opt/cloudstack/incubator-cloudstack/ -nohup ant run > /dev/null 2>&1 & -exit 0 http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/devcloudbox/puppet-devcloud/files/updatecode.sh ---------------------------------------------------------------------- diff --git a/tools/devcloud/devcloudbox/puppet-devcloud/files/updatecode.sh b/tools/devcloud/devcloudbox/puppet-devcloud/files/updatecode.sh deleted file mode 100644 index 15e191a..0000000 --- a/tools/devcloud/devcloudbox/puppet-devcloud/files/updatecode.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -# 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. - -cd /opt/cloudstack -git clone https://git-wip-us.apache.org/repos/asf/incubator-cloudstack.git -rc=$? -if [[ $rc != 0 ]] ; then - cd /opt/cloudstack/incubator-cloudstack - git pull origin master -fi -exit 0 http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/devcloudbox/puppet-devcloud/init.pp ---------------------------------------------------------------------- diff --git a/tools/devcloud/devcloudbox/puppet-devcloud/init.pp b/tools/devcloud/devcloudbox/puppet-devcloud/init.pp deleted file mode 100644 index 2574392..0000000 --- a/tools/devcloud/devcloudbox/puppet-devcloud/init.pp +++ /dev/null @@ -1,18 +0,0 @@ -# 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. - -include puppet-devcloud http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/devcloudbox/puppet-devcloud/manifests/init.pp ---------------------------------------------------------------------- diff --git a/tools/devcloud/devcloudbox/puppet-devcloud/manifests/init.pp b/tools/devcloud/devcloudbox/puppet-devcloud/manifests/init.pp deleted file mode 100644 index 3dc74a1..0000000 --- a/tools/devcloud/devcloudbox/puppet-devcloud/manifests/init.pp +++ /dev/null @@ -1,348 +0,0 @@ -# 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. - -class puppet-devcloud { - - package { 'ebtables': - ensure => latest, - } - - service { 'ebtables': - require => Package['ebtables'], - ensure => 'running', - enable => 'true', - } - - package { 'iptables': - ensure => latest, - } - - file { '/etc/iptables.save': - require => Package['iptables'], - ensure => 'file', - source => 'puppet:///modules/puppet-devcloud/iptables.save', - group => '0', - mode => '644', - owner => '0', - } - - file { '/tmp/configebtables.sh': - ensure => 'file', - source => 'puppet:///modules/puppet-devcloud/configebtables.sh', - group => '0', - mode => '777', - owner => '0', - } - - exec { "/tmp/configebtables.sh": - require => [ - File['/tmp/configebtables.sh'], - Service['ebtables'] - ], - subscribe => Package['ebtables'], - refreshonly => true, - cwd => '/', - path => '/sbin/:/usr/bin/:/bin', - } - - package { 'nfs-server': - ensure => latest, - } - - file { '/opt/storage': - ensure => 'directory', - group => '0', - mode => '755', - owner => '0', - } - - file { '/opt/storage/secondary': - ensure => 'directory', - group => '0', - mode => '755', - owner => '0', - } - - file { '/opt/storage/secondary/template': - ensure => 'directory', - group => '0', - mode => '755', - owner => '0', - } - - file { '/opt/storage/secondary/template/tmpl': - ensure => 'directory', - group => '0', - mode => '755', - owner => '0', - } - - file { '/opt/storage/secondary/template/tmpl/1': - ensure => 'directory', - group => '0', - mode => '755', - owner => '0', - } - - file { '/opt/storage/secondary/template/tmpl/1/1': - ensure => 'directory', - group => '0', - mode => '755', - owner => '0', - } - - file { '/opt/storage/secondary/template/tmpl/1/5': - ensure => 'directory', - group => '0', - mode => '755', - owner => '0', - } - - file { '/etc/exports': - require => Package['nfs-server'], - ensure => 'file', - source => 'puppet:///modules/puppet-devcloud/exports', - mode => '644', - owner => '0', - group => '0', - } - - service { 'nfs-kernel-server': - require => Package['nfs-server'], - ensure => 'running', - enable => 'true', - } - -# TODO - it would be great to have an MD5 sum to check for each of these downloads, so that the files can be re-downloaded if they have been changed. - - exec { '/usr/bin/wget http://download.cloud.com/templates/devcloud/defaulttemplates/1/dc68eb4c-228c-4a78-84fa-b80ae178fbfd.vhd -P /opt/storage/secondary/template/tmpl/1/1/': - creates => '/opt/storage/secondary/template/tmpl/1/1/dc68eb4c-228c-4a78-84fa-b80ae178fbfd.vhd', - require => File['/opt/storage/secondary/template/tmpl/1/1/'], - timeout => '0', - } - - exec { '/usr/bin/wget http://download.cloud.com/templates/devcloud/defaulttemplates/1/template.properties -P /opt/storage/secondary/template/tmpl/1/1/': - creates => '/opt/storage/secondary/template/tmpl/1/1/template.properties', - require => File['/opt/storage/secondary/template/tmpl/1/1/'], - } - - exec { '/usr/bin/wget http://download.cloud.com/templates/devcloud/defaulttemplates/5/ce5b212e-215a-3461-94fb-814a635b2215.vhd -P /opt/storage/secondary/template/tmpl/1/5/': - creates => '/opt/storage/secondary/template/tmpl/1/5/ce5b212e-215a-3461-94fb-814a635b2215.vhd', - require => File['/opt/storage/secondary/template/tmpl/1/5/'], - timeout => '0', - } - - exec { '/usr/bin/wget http://download.cloud.com/templates/devcloud/defaulttemplates/5/template.properties -P /opt/storage/secondary/template/tmpl/1/5/': - creates => '/opt/storage/secondary/template/tmpl/1/5/template.properties', - require => File['/opt/storage/secondary/template/tmpl/1/5/'], - } - - exec { 'getecho': - command => '/usr/bin/wget http://download.cloud.com/templates/devcloud/echo -P /usr/lib/xcp/plugins/', - creates => '/usr/lib/xcp/plugins/echo', - } - - exec { '/bin/chmod -R 777 /usr/lib/xcp': - require => Exec['getecho'], - } - - file { '/opt/storage/primary': - ensure => 'directory', - group => '0', - mode => '755', - owner => '0', - } - - file { '/tmp/configlocalstorage.sh': - ensure => 'file', - group => '0', - mode => '777', - owner => '0', - source => 'puppet:///modules/puppet-devcloud/configlocalstorage.sh', - } - - exec { "configlocal": - require => [ - File['/opt/storage/primary'], - File['/tmp/configlocalstorage.sh'] - ], - command => '/tmp/configlocalstorage.sh', - cwd => '/', - } - - file { '/tmp/configvnc.sh': - ensure => 'file', - source => 'puppet:///modules/puppet-devcloud/configvnc.sh', - mode => '777', - group => '0', - owner => '0', - } - - exec { "configvnc": - require => File['/tmp/configvnc.sh'], - command => '/tmp/configvnc.sh', - cwd => '/', - } - - package { 'git': - ensure => latest, - } - - package { 'unzip': - ensure => latest, - } - - package { 'mysql-server': - ensure => latest, - } - - package { 'ant': - ensure => latest, - } - - package { 'openjdk-6-jdk': - ensure => latest, - } - - file { '/opt/cloudstack': - ensure => 'directory', - group => '0', - mode => '755', - owner => '0', - } - - file { '/tmp/updatecode.sh': - ensure => 'file', - source => 'puppet:///modules/puppet-devcloud/updatecode.sh', - mode => '777', - owner => '0', - group => '0', - } - - exec { 'get_code': - require => [ - Package['git'], - File['/opt/cloudstack/'], - File['/tmp/updatecode.sh'] - ], - command => '/tmp/updatecode.sh', - cwd => '/opt/cloudstack/', - timeout => '0', - } - - file { '/opt/cloudstack/incubator-cloudstack/target': - ensure => 'directory', - group => '0', - mode => '755', - owner => '0', - require => Exec['get_code'], - } - - file { '/opt/cloudstack/incubator-cloudstack/dist': - ensure => 'directory', - group => '0', - mode => '755', - owner => '0', - require => Exec['get_code'], - } - - exec { 'downloadtomcat': - command => '/usr/bin/wget http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.zip -P /opt/cloudstack/', - creates => '/opt/cloudstack/apache-tomcat-6.0.32.zip', - require => File['/opt/cloudstack/'], - timeout => '0', - } - - exec { "unziptomcat": - require => [ - Package['unzip'], - Exec["downloadtomcat"] - ], - creates => "/opt/cloudstack/apache-tomcat-6.0.32", - command => "/usr/bin/unzip apache-tomcat-6.0.32.zip", - cwd => "/opt/cloudstack", - timeout => '0', - } - - exec { "catalina_home": - require => Exec["unziptomcat"], - unless => '/bin/grep CATALINA_HOME /root/.bashrc', - command => '/bin/echo "export CATALINA_HOME=/opt/cloudstack/apache-tomcat-6.0.32" >> /root/.bashrc', - cwd => '/', - } - - package { 'mkisofs': - ensure => latest, - } - - file { '/opt/cloudstack/buildcloudstack.sh': - ensure => 'file', - source => 'puppet:///modules/puppet-devcloud/builddevcloud.sh', - mode => '777', - owner => '0', - group => '0', - } - - file { '/opt/cloudstack/installmaven.sh': - ensure => 'file', - source => 'puppet:///modules/puppet-devcloud/installmaven.sh', - mode => '777', - owner => '0', - group => '0', - } - - exec { "install_maven": - require => File['/opt/cloudstack/installmaven.sh'], - command => '/opt/cloudstack/installmaven.sh', - cwd => '/opt/cloudstack', - creates => '/opt/cloudstack/apache-maven-3.0.4/', - timeout => '0', - } - - exec { "build_cloudstack": - require => [ - Package['ant'], - Exec['install_maven'], - Exec["catalina_home"], - File['/opt/cloudstack/incubator-cloudstack/dist'], - File['/opt/cloudstack/incubator-cloudstack/target'], - Package['mkisofs'], - File['/opt/cloudstack/buildcloudstack.sh'] - ], - command => "/opt/cloudstack/buildcloudstack.sh", - cwd => "/opt/cloudstack/", - timeout => '0', - } - - file { '/opt/cloudstack/startdevcloud.sh': - ensure => 'file', - source => 'puppet:///modules/puppet-devcloud/startdevcloud.sh', - mode => '777', - owner => '0', - group => '0', - } - - exec { "start_cloudstack": - require => [ - Exec["build_cloudstack"], - File["/opt/cloudstack/startdevcloud.sh"] - ], - command => "/opt/cloudstack/startdevcloud.sh", - cwd => "/opt/cloudstack/", - } - -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/devcloudsetup.sh ---------------------------------------------------------------------- diff --git a/tools/devcloud/devcloudsetup.sh b/tools/devcloud/devcloudsetup.sh deleted file mode 100644 index f8b69fa..0000000 --- a/tools/devcloud/devcloudsetup.sh +++ /dev/null @@ -1,151 +0,0 @@ -#!/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. - -fileSvr="http://download.cloud.com/templates/devcloud/" -install_xen() { - aptitude update - echo "install xen" - aptitude -y install linux-headers-3.2.0-23-generic-pae - aptitude -y install xen-hypervisor-4.1-i386 xcp-xapi - echo "configure xen" - - sed -i -e 's/xend_start$/#xend_start/' -e 's/xend_stop$/#xend_stop/' /etc/init.d/xend - update-rc.d xendomains disable - - sed -i 's/GRUB_DEFAULT=.\+/GRUB_DEFAULT="Xen 4.1-i386"/' /etc/default/grub - echo 'GRUB_CMDLINE_XEN_DEFAULT="dom0_mem=512M,max:512M"' | cat /etc/default/grub - >> /etc/default/newgrub - mv /etc/default/newgrub /etc/default/grub - update-grub - - mkdir /usr/share/qemu - ln -s /usr/share/qemu-linaro/keymaps /usr/share/qemu/keymaps - -cat > /etc/network/interfaces << EOF -# The loopback network interface -auto lo -iface lo inet loopback - -# The primary network interface -auto xenbr0 -iface xenbr0 inet dhcp - gateway 10.0.2.2 - bridge_ports eth0 - - -auto eth0 -iface eth0 inet dhcp -pre-up iptables-save < /etc/iptables.save -pre-up /etc/init.d/ebtables load -EOF - - echo TOOLSTACK=xapi > /etc/default/xen - echo bridge > /etc/xcp/network.conf - - echo "set root password" - echo "root:password" | chpasswd - - echo "reboot" - reboot -} - -postsetup() { - #check xen dom0 is working - xe host-list > /dev/null - if [ $? -gt 0 ]; then - print "xen dom0 is not running, make sure dom0 is installed" - exit 1 - fi - - #disable virtualbox dhcp server for Vms created by cloudstack - apt-get install ebtables - iptables -A POSTROUTING -t mangle -p udp --dport bootpc -j CHECKSUM --checksum-fill - mac=`ifconfig xenbr0 |grep HWaddr |awk '{print $5}'` - ebtables -I FORWARD -d ! $mac -i eth0 -p IPV4 --ip-prot udp --ip-dport 67:68 -j DROP - iptables-save > /etc/iptables.save - /etc/init.d/ebtables save - - echo "configure NFS server" - aptitude -y install nfs-server - if [ ! -d /opt/storage/secondary ];then - mkdir -p /opt/storage/secondary - mkdir -p /opt/storage/secondary/template/tmpl/1/1 - mkdir -p /opt/storage/secondary/template/tmpl/1/5 - - echo "/opt/storage/secondary *(rw,no_subtree_check,no_root_squash,fsid=0)" > /etc/exports - wget $fileSvr/defaulttemplates/1/dc68eb4c-228c-4a78-84fa-b80ae178fbfd.vhd -P /opt/storage/secondary/template/tmpl/1/1/ - wget $fileSvr/defaulttemplates/1/template.properties -P /opt/storage/secondary/template/tmpl/1/1/ - wget $fileSvr/defaulttemplates/5/ce5b212e-215a-3461-94fb-814a635b2215.vhd -P /opt/storage/secondary/template/tmpl/1/5/ - wget $fileSvr/defaulttemplates/5/template.properties -P /opt/storage/secondary/template/tmpl/1/5/ - /etc/init.d/nfs-kernel-server restart - fi - - echo "configure local storage" - if [ ! -d /opt/storage/primary ]; then - mkdir -p /opt/storage/primary - hostuuid=`xe host-list |grep uuid|awk '{print $5}'` - xe sr-create host-uuid=$hostuuid name-label=local-storage shared=false type=file device-config:location=/opt/storage/primary - fi - - echo "generate ssh key" - ssh-keygen -A -q - - echo "configure xcp" - wget $fileSvr/echo -P /usr/lib/xcp/plugins/ - chmod -R 777 /usr/lib/xcp - - sed -i 's/VNCTERM_LISTEN=.\+/VNCTERM_LISTEN="-v 0.0.0.0:1"/' /usr/lib/xcp/lib/vncterm-wrapper - - echo "install cloudstack " - - if [ ! -d /opt/cloudstack ];then - aptitude -y install git unzip openjdk-6-jdk mysql-server ant - mkdir /opt/cloudstack - cd /opt/cloudstack - git clone https://git-wip-us.apache.org/repos/asf/incubator-cloudstack.git - mkdir incubator-cloudstack/target - mkdir incubator-cloudstack/dist - wget http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.zip -P /opt/cloudstack/ - unzip apache-tomcat-6.0.32.zip - echo "export CATALINA_HOME=/opt/cloudstack/apache-tomcat-6.0.32" >> /root/.bashrc - cd ~ - fi - - echo "devCloud is ready to use" -} -usage() { - print "$0 -p: presetup enviroment, e.g. install xen, configure xcp etc" - print "$0 -P: postsetup, install cloudstack, prepare template etc" -} - -while getopts "pP" OPTION -do - case $OPTION in - p) - install_xen - exit 0 - ;; - P) - postsetup - exit 0 - ;; - ?) - usage - exit - ;; - esac -done http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/puppet/manifests/vagrant-devcloud.pp ---------------------------------------------------------------------- diff --git a/tools/devcloud/puppet/manifests/vagrant-devcloud.pp b/tools/devcloud/puppet/manifests/vagrant-devcloud.pp new file mode 100644 index 0000000..47b07dc --- /dev/null +++ b/tools/devcloud/puppet/manifests/vagrant-devcloud.pp @@ -0,0 +1,18 @@ +# 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. + +include devcloud http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/puppet/modules/devcloud/Modulefile ---------------------------------------------------------------------- diff --git a/tools/devcloud/puppet/modules/devcloud/Modulefile b/tools/devcloud/puppet/modules/devcloud/Modulefile new file mode 100644 index 0000000..ace7d48 --- /dev/null +++ b/tools/devcloud/puppet/modules/devcloud/Modulefile @@ -0,0 +1,8 @@ +name 'puppet-devcloud' +version '0.0.1' +source '' +author 'Apache Software Foundation' +license 'Licensed under the Apache License, Version 2.0. http://www.apache.org/licenses/LICENSE-2.0' +summary 'CloudStack DevCloud configuration module' +description 'Devcloud setup module.' +project_page 'http://cloudstack.org' http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/puppet/modules/devcloud/files/compare.sh ---------------------------------------------------------------------- diff --git a/tools/devcloud/puppet/modules/devcloud/files/compare.sh b/tools/devcloud/puppet/modules/devcloud/files/compare.sh new file mode 100644 index 0000000..e1667c1 --- /dev/null +++ b/tools/devcloud/puppet/modules/devcloud/files/compare.sh @@ -0,0 +1,6 @@ +#! /bin/bash -eux + +FILE=$1 +WORKING_DIR=$2 +cd $WORKING_DIR +test `grep $FILE ${WORKING_DIR}/md5sum.txt | awk '{print $1}'` == `md5sum $FILE |awk '{print $1}'` \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/puppet/modules/devcloud/files/configebtables.sh ---------------------------------------------------------------------- diff --git a/tools/devcloud/puppet/modules/devcloud/files/configebtables.sh b/tools/devcloud/puppet/modules/devcloud/files/configebtables.sh new file mode 100644 index 0000000..8329333 --- /dev/null +++ b/tools/devcloud/puppet/modules/devcloud/files/configebtables.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# 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. +mac=`/sbin/ifconfig xenbr0 |/bin/grep HWaddr |/usr/bin/awk '{print $5}'` +/sbin/ebtables -I FORWARD -d ! $mac -i eth0 -p IPV4 --ip-prot udp --ip-dport 67:68 -j DROP +exit 0 http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/puppet/modules/devcloud/files/configlocalstorage.sh ---------------------------------------------------------------------- diff --git a/tools/devcloud/puppet/modules/devcloud/files/configlocalstorage.sh b/tools/devcloud/puppet/modules/devcloud/files/configlocalstorage.sh new file mode 100644 index 0000000..3ed1a39 --- /dev/null +++ b/tools/devcloud/puppet/modules/devcloud/files/configlocalstorage.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +# 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. +/usr/bin/xe sr-list | /bin/grep local-storage +rc=$? +if [[ $rc != 0 ]] ; then + hostuuid=`xe host-list |grep uuid|awk '{print $5}'`; + xe sr-create host-uuid=$hostuuid name-label=local-storage shared=false type=file device-config:location=/opt/storage/primary +fi +exit 0 http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/puppet/modules/devcloud/files/configvnc.sh ---------------------------------------------------------------------- diff --git a/tools/devcloud/puppet/modules/devcloud/files/configvnc.sh b/tools/devcloud/puppet/modules/devcloud/files/configvnc.sh new file mode 100644 index 0000000..b739dc6 --- /dev/null +++ b/tools/devcloud/puppet/modules/devcloud/files/configvnc.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +# 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. + +grep 0.0.0.0 /usr/lib/xcp/lib/vncterm-wrapper +rc=$? +if [[ $rc != 0 ]] ; then + sed -i 's/VNCTERM_LISTEN=.\+/VNCTERM_LISTEN="-v 0.0.0.0:1"/' /usr/lib/xcp/lib/vncterm-wrapper +fi +exit 0 http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/puppet/modules/devcloud/files/exports ---------------------------------------------------------------------- diff --git a/tools/devcloud/puppet/modules/devcloud/files/exports b/tools/devcloud/puppet/modules/devcloud/files/exports new file mode 100644 index 0000000..1f91650 --- /dev/null +++ b/tools/devcloud/puppet/modules/devcloud/files/exports @@ -0,0 +1,19 @@ +# 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. + +/opt/storage/primary *(rw,no_subtree_check,no_root_squash,fsid=0) +/opt/storage/secondary *(rw,no_subtree_check,no_root_squash,fsid=0) http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/puppet/modules/devcloud/files/installmaven.sh ---------------------------------------------------------------------- diff --git a/tools/devcloud/puppet/modules/devcloud/files/installmaven.sh b/tools/devcloud/puppet/modules/devcloud/files/installmaven.sh new file mode 100644 index 0000000..8cd3df0 --- /dev/null +++ b/tools/devcloud/puppet/modules/devcloud/files/installmaven.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# 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. + +cd /opt/cloudstack +/usr/bin/wget http://apache.mirrors.pair.com/maven/maven-3/3.0.4/binaries/apache-maven-3.0.4-bin.tar.gz +/bin/tar xvfz apache-maven-3.0.4-bin.tar.gz http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/puppet/modules/devcloud/files/iptables.save ---------------------------------------------------------------------- diff --git a/tools/devcloud/puppet/modules/devcloud/files/iptables.save b/tools/devcloud/puppet/modules/devcloud/files/iptables.save new file mode 100644 index 0000000..07647f8 --- /dev/null +++ b/tools/devcloud/puppet/modules/devcloud/files/iptables.save @@ -0,0 +1,30 @@ +# 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. + +*mangle +:PREROUTING ACCEPT [397:23804] +:INPUT ACCEPT [397:23804] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [238:22820] +:POSTROUTING ACCEPT [238:22820] +-A POSTROUTING -p udp -m udp --dport 68 -j CHECKSUM --checksum-fill +COMMIT +*filter +:INPUT ACCEPT [453:27164] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [273:26476] +COMMIT http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/puppet/modules/devcloud/files/startdevcloud.sh ---------------------------------------------------------------------- diff --git a/tools/devcloud/puppet/modules/devcloud/files/startdevcloud.sh b/tools/devcloud/puppet/modules/devcloud/files/startdevcloud.sh new file mode 100644 index 0000000..27a7a04 --- /dev/null +++ b/tools/devcloud/puppet/modules/devcloud/files/startdevcloud.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +# 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. + +export CATALINA_HOME=/opt/cloudstack/apache-tomcat-6.0.32 +cd /opt/cloudstack/incubator-cloudstack/ +nohup ant run > /dev/null 2>&1 & +exit 0 http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/puppet/modules/devcloud/files/updatecode.sh ---------------------------------------------------------------------- diff --git a/tools/devcloud/puppet/modules/devcloud/files/updatecode.sh b/tools/devcloud/puppet/modules/devcloud/files/updatecode.sh new file mode 100644 index 0000000..5525920 --- /dev/null +++ b/tools/devcloud/puppet/modules/devcloud/files/updatecode.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# 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. + +cd /opt/cloudstack +git clone https://git-wip-us.apache.org/repos/asf/incubator-cloudstack.git +rc=$? +if [[ $rc != 0 ]] ; then + cd /opt/cloudstack/incubator-cloudstack + git pull origin master +fi +exit 0 http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/puppet/modules/devcloud/lib/facter/xeninfo.rb ---------------------------------------------------------------------- diff --git a/tools/devcloud/puppet/modules/devcloud/lib/facter/xeninfo.rb b/tools/devcloud/puppet/modules/devcloud/lib/facter/xeninfo.rb new file mode 100644 index 0000000..b174937 --- /dev/null +++ b/tools/devcloud/puppet/modules/devcloud/lib/facter/xeninfo.rb @@ -0,0 +1,5 @@ +Facter.add(:xen_hostuuid) do + setcode do + uuid=Facter::Util::Resolution.exec('xe host-list |grep uuid|awk \'{print $5}\'') + end +end \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/puppet/modules/devcloud/manifests/functions/httpdownload.pp ---------------------------------------------------------------------- diff --git a/tools/devcloud/puppet/modules/devcloud/manifests/functions/httpdownload.pp b/tools/devcloud/puppet/modules/devcloud/manifests/functions/httpdownload.pp new file mode 100644 index 0000000..5e3db33 --- /dev/null +++ b/tools/devcloud/puppet/modules/devcloud/manifests/functions/httpdownload.pp @@ -0,0 +1,20 @@ + define devcloud::functions::httpdownload () { + $file="${name['basedir']}/${name['basefile']}" + + exec { + "getfileifnotexist${name}": + command => "/usr/bin/wget ${name['url']}/${file} -O ${name['local_dir']}/${file}", + timeout => 0, + unless => "test -f ${name['local_dir']}/${file}", + require => [ File["${name['local_dir']}/${name['base_dir']}/"], + Exec["get_md5sums"] ]; + + + "getfileifnotmatch${name}": + command => "/usr/bin/wget ${name['url']}/${file} -O ${name['local_dir']}/${file}", + timeout => 0, + unless => "/usr/local/bin/compare.sh ${file} ${name['working_dir']} ", + require => [ Exec["getfileifnotexist${name}"], File["/usr/local/bin/compare.sh"] ] + } + +} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/puppet/modules/devcloud/manifests/init.pp ---------------------------------------------------------------------- diff --git a/tools/devcloud/puppet/modules/devcloud/manifests/init.pp b/tools/devcloud/puppet/modules/devcloud/manifests/init.pp new file mode 100644 index 0000000..752eae8 --- /dev/null +++ b/tools/devcloud/puppet/modules/devcloud/manifests/init.pp @@ -0,0 +1,252 @@ +# 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 permission s and limitations +# under the License. + + + +class devcloud ( + + $cs_dir = $devcloud::params::cs_dir , + $devcloud_path = $devcloud::params::devcloud_path, + $gitrepo = $devcloud::params::gitrepo, + $storage_dir = $devcloud::params::storage_dir, + $tomcat_version = $devcloud::params::tomcat_version, + $tomcat_url = $devcloud::params::tomcat_url, + $tomcat_home = $devcloud::params::tomcat_home, + $maven_version = $devcloud::params::maven_version, + $maven_url = $devcloud::params::maven_url, + $maven_home = $devcloud::params::maven_home, + $downloads = $devcloud::params::downloads, + $md5sum_local = $devcloud::params::md5sum_local, + $md5sum_remote = $devcloud::params::md5sum_remote, + $hostuuid = $::xen_hostuuid, + $bridge_device_mac = $::macaddress_xenbr0 + +) inherits devcloud::params { + + + + Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] } + + service { + 'ebtables': + require => Package['ebtables'], + ensure => 'running', + enable => true; + 'nfs-kernel-server': + require => Package['nfs-server'], + ensure => 'running', + enable => true, + subscribe => File["/etc/exports"]; + } + + package { [ + "ant", + "ebtables", + "iptables", + "git", + "mkisofs", + "mysql-server", + "nfs-server", + "openjdk-6-jdk", + "unzip" + ]: + ensure => latest, + + } + + exec { + + 'get_md5sums': + command => "/usr/bin/wget -N ${md5sum_remote} -O ${md5sum_local}", + require => File["${storage_dir}/secondary/template/tmpl/1/"], + timeout => '0'; + + 'getecho': + command => "/usr/bin/wget ${devcloud_path}/echo -O /usr/lib/xcp/plugins/echo", + creates => '/usr/lib/xcp/plugins/echo'; + + 'setxcpperms': + command => '/bin/chmod -R 755 /usr/lib/xcp', + require => Exec['getecho']; + + 'get_code': + command => "git clone ${gitrepo}", + cwd => $cs_dir, + require => [ File["${cs_dir}"]], + timeout => '7200', + creates => "$cs_dir/incubator-cloudstack"; + + 'update_code': + command => "git pull origin master", + cwd => "${cs_dir}/incubator-cloudstack", + timeout => '7200', + require => [ Exec["get_code"]]; + + "configlocal": + command => "xe sr-create host-uuid=${hostuuid} name-label=local-storage shared=false type=file device-config:location=${storage_dir}/primary", + cwd => '/', + unless => '/usr/bin/xe sr-list | /bin/egrep \'local-storage|Cloud Stack Local EXT Storage Pool\'', + require => [ + File["${storage_dir}/primary"], + File["/etc/iptables.save"] + ]; + + "configvnc": + command => 'sed -i \'s/VNCTERM_LISTEN=.\+/VNCTERM_LISTEN="-v 0.0.0.0:1"/\' /usr/lib/xcp/lib/vncterm-wrapper', + onlyif => '/bin/grep "0.0.0.0:1" /usr/lib/xcp/lib/vncterm-wrapper'; + + 'downloadtomcat': + command => "/usr/bin/wget ${tomcat_url} -P ${cs_dir}/", + creates => "${cs_dir}/apache-tomcat-${tomcat_version}.zip", + require => File[$cs_dir], + timeout => '0'; + + "unziptomcat": + require => [ + Package['unzip'], + Exec["downloadtomcat"] + ], + creates => "${tomcat_home}", + command => "/usr/bin/unzip apache-tomcat-${tomcat_version}.zip", + cwd => "${cs_dir}", + timeout => '0'; + + "downloadmaven": + command => "/usr/bin/wget ${maven_url} -P ${cs_dir}/", + creates => "${cs_dir}/apache-maven-${maven_version}-bin.tar.gz", + require => Exec['unziptomcat'], + timeout => '0'; + + "build_cloudstack": + require => [ + Package["ant"], + Exec["install_maven"], + File["${cs_dir}/incubator-cloudstack/dist"], + File["${cs_dir}/incubator-cloudstack/target"], + Package['mkisofs'], + File["${cs_dir}/buildcloudstack.sh"] + ], + command => "/opt/cloudstack/buildcloudstack.sh", + cwd => "/opt/cloudstack/", + timeout => '0'; + + + "install_maven": + require => Exec["downloadmaven"], + creates => "${maven_home}", + command => "/bin/tar xzvf ${cs_dir}/apache-maven-${maven_version}-bin.tar.gz", + cwd => "${cs_dir}", + timeout => '0'; + + 'tomcatperms': + command => "chmod +x ${tomcat_home}/bin/*.sh", + require => Exec["unziptomcat"],; + + "catalina_home": + require => Exec["unziptomcat"], + unless => '/bin/grep CATALINA_HOME /root/.bashrc', + command => "/bin/echo \"export CATALINA_HOME=${tomcat_home}\" >> /root/.bashrc", + cwd => '/'; + "configebtables": + require => [ + Service['ebtables'] + ], + command => "/sbin/ebtables -I FORWARD -d ! $bridge_device_mac -i eth0 -p IPV4 --ip-prot udp --ip-dport 67:68 -j DROP", + subscribe => Package["ebtables"], + unless => "/sbin/ebtables -L | grep \"-I FORWARD -d ! $bridge_device_mac -i eth0 -p IPV4 --ip-prot udp --ip-dport 67:68 -j DROP\"", + refreshonly => true, + cwd => "/", + path => "/sbin/:/usr/bin/:/bin" +} + + + file { + + [ $cs_dir, + "${storage_dir}", + "${storage_dir}/primary", + "${storage_dir}/secondary", + "${storage_dir}/secondary/template", + "${storage_dir}/secondary/template/tmpl", + "${storage_dir}/secondary/template/tmpl/1", + "${storage_dir}/secondary/template/tmpl/1/1", + "${storage_dir}/secondary/template/tmpl/1/5" ]: + ensure => "directory", + group => "0", + mode => "755", + owner => "0"; + + [ "${cs_dir}/incubator-cloudstack/dist", + "${cs_dir}/incubator-cloudstack/target" ] : + ensure => "directory", + group => "0", + mode => "755", + owner => "0", + require => [ Exec["update_code"]]; + + "${cs_dir}/buildcloudstack.sh": + ensure => 'file', + mode => '755', + owner => '0', + group => '0', + content => template("devcloud/builddevcloud.sh.erb"); + + "/root/.ssh" : + ensure => "directory", + group => "root", + mode => "700", + owner => "root"; + + "${cs_dir}/startdevcloud.sh": + ensure => 'file', + source => 'puppet:///modules/devcloud/startdevcloud.sh', + mode => '755', + owner => '0', + group => '0'; + "/usr/local/bin/compare.sh": + ensure => 'file', + source => 'puppet:///modules/devcloud/compare.sh', + mode => '755', + owner => 'root', + group => 'root'; + '/etc/iptables.save': + require => Package['iptables'], + ensure => 'file', + source => 'puppet:///modules/devcloud/iptables.save', + group => '0', + mode => '644', + owner => '0'; + "/etc/exports": + require => Package['nfs-server'], + ensure => 'file', + source => 'puppet:///modules/devcloud/exports', + mode => '644', + owner => '0', + group => '0'; + + } + + + devcloud::functions::httpdownload{ + $downloads: + require => [ File["${storage_dir}/secondary/template/tmpl/1/1"], + File["${storage_dir}/secondary/template/tmpl/1/5"], + Exec["get_md5sums"] + ] + } + +} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/puppet/modules/devcloud/manifests/params.pp ---------------------------------------------------------------------- diff --git a/tools/devcloud/puppet/modules/devcloud/manifests/params.pp b/tools/devcloud/puppet/modules/devcloud/manifests/params.pp new file mode 100644 index 0000000..51f0706 --- /dev/null +++ b/tools/devcloud/puppet/modules/devcloud/manifests/params.pp @@ -0,0 +1,64 @@ +# == Class: devcloud::params +# +# This class implements the module params pattern, but it's loaded using hiera +# as opposed to the 'default' usage of coding the parameter values in your +# manifest. +# +# == Usage +# +# Don't use this class directly; it's being used where it is needed +# +class devcloud::params { + + + + + $cs_dir = "/opt/cloudstack" + $storage_dir = "/opt/storage" + $tomcat_version = "6.0.32" + $tomcat_url = "http://archive.apache.org/dist/tomcat/tomcat-6/v${tomcat_version}/bin/apache-tomcat-${tomcat_version}.zip" + $tomcat_home = "${cs_dir}/apache-tomcat-${tomcat_version}" + $maven_version = "3.0.4" + $maven_url = "http://apache.mirrors.pair.com/maven/maven-3/${maven_version}/binaries/apache-maven-${maven_version}-bin.tar.gz" + $maven_home = "${cs_dir}/apache-maven-${maven_version}" + $devcloud_path = "http://download.cloud.com/templates/devcloud" + $template_path = "${devcloud_path}/defaulttemplates" + $md5sum_remote = "${template_path}/md5sum.txt" + $md5sum_local = "${storage_dir}/secondary/template/tmpl/1/md5sum.txt" + $template_dir = "${storage_dir}/secondary/template/tmpl/1" + $gitrepo = "https://github.com/apache/incubator-cloudstack.git" + + + + $downloads = [ + + { + "basefile" => "template.properties", + "basedir" => "1", + "url" => "${template_path}", + "local_dir" => "$template_dir", + "working_dir" => "$template_dir" + }, + { + "basefile" => "template.properties", + "basedir" => "5", + "url" => "${template_path}", + "local_dir" => "$template_dir", + "working_dir" => "$template_dir" + }, + { + "basefile" => "dc68eb4c-228c-4a78-84fa-b80ae178fbfd.vhd", + "basedir" => "1", + "url" => "${template_path}", + "local_dir" => "$template_dir", + "working_dir" => "$template_dir" + }, + { + "basefile" => "ce5b212e-215a-3461-94fb-814a635b2215.vhd", + "basedir" => "5", + "url" => "${template_path}", + "local_dir" => "$template_dir", + "working_dir" => "$template_dir" + } + ] +} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/puppet/modules/devcloud/templates/builddevcloud.sh.erb ---------------------------------------------------------------------- diff --git a/tools/devcloud/puppet/modules/devcloud/templates/builddevcloud.sh.erb b/tools/devcloud/puppet/modules/devcloud/templates/builddevcloud.sh.erb new file mode 100644 index 0000000..e42eedf --- /dev/null +++ b/tools/devcloud/puppet/modules/devcloud/templates/builddevcloud.sh.erb @@ -0,0 +1,28 @@ +#!/bin/sh + +# 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. + +export CATALINA_HOME=<%= @tomcat_home %> +export M2_HOME=<%= @maven_home %> +export M2=$M2_HOME/bin +MAVEN_OPTS="-Xms256m -Xmx512m" +PATH=$M2:$PATH +cd <%= @cs_dir %>/incubator-cloudstack/ +<%= @maven_home %>/bin/mvn -P developer clean install +<%= @maven_home %>/bin/mvn -P developer -pl developer,tools/devcloud -Ddeploydb +<%= @maven_home %>/bin/mvn -P developer -pl tools/devcloud -Ddeploysvr \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/veewee/definition.rb ---------------------------------------------------------------------- diff --git a/tools/devcloud/veewee/definition.rb b/tools/devcloud/veewee/definition.rb deleted file mode 100644 index cb0a907..0000000 --- a/tools/devcloud/veewee/definition.rb +++ /dev/null @@ -1,56 +0,0 @@ -# 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. - - -Veewee::Session.declare({ - :cpu_count => '1', - :memory_size=> '2048', - :disk_size => '20000', - :disk_format => 'VMDK', - :hostiocache => 'off', - :os_type_id => 'Ubuntu', - :iso_file => "ubuntu-12.04.1-server-i386.iso", - :iso_src => "http://releases.ubuntu.com/12.04/ubuntu-12.04.1-server-i386.iso", - :iso_md5 => '32184a83c8b5e6031e1264e5c499bc03', - :iso_download_timeout => "1000", - :boot_wait => "4", - :ioapic => "on", - :nestedpaging => "on", - :hwvirtex => "on", - :boot_cmd_sequence => [ - '', - '/install/vmlinuz noapic preseed/url=http://%IP%:%PORT%/preseed.cfg ', - 'debian-installer=en_US auto locale=en_US kbd-chooser/method=us ', - 'hostname=%NAME% ', - 'fb=false debconf/frontend=noninteractive ', - 'keyboard-configuration/layout=USA keyboard-configuration/variant=USA console-setup/ask_detect=false ', - 'initrd=/install/initrd.gz -- ' -], - :kickstart_port => "7122", - :kickstart_timeout => "10000", - :kickstart_file => "preseed.cfg", - :ssh_login_timeout => "10000", - :ssh_user => "devcloud", - :ssh_password => "devcloud", - :ssh_key => "", - :ssh_host_port => "2222", - :ssh_guest_port => "22", - :sudo_cmd => "echo '%p'|sudo -S sh '%f'", - :shutdown_cmd => "shutdown -P now", - :postinstall_files => [ "postinstall.sh"], - :postinstall_timeout => "10000" -}) http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/veewee/postinstall.sh ---------------------------------------------------------------------- diff --git a/tools/devcloud/veewee/postinstall.sh b/tools/devcloud/veewee/postinstall.sh deleted file mode 100644 index aeafafe..0000000 --- a/tools/devcloud/veewee/postinstall.sh +++ /dev/null @@ -1,43 +0,0 @@ -# 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. - -apt-get -y update -apt-get -y upgrade -apt-get -y install vim -apt-get -y install ruby -apt-get -y install rubygems -apt-get -y install puppet -apt-get clean - -# Setup sudo to allow no-password sudo for "admin" -groupadd -r admin -usermod -a -G admin devcloud -echo "root:password" | chpasswd -sed -i -e '/Defaults\s\+env_reset/a Defaults\texempt_group=admin' /etc/sudoers -sed -i -e 's/%admin ALL=(ALL) ALL/%admin ALL=NOPASSWD:ALL/g' /etc/sudoers - -mkdir /home/devcloud/.ssh -chmod 700 /home/devcloud/.ssh -cd /home/devcloud/.ssh -wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O authorized_keys -chmod 600 /home/devcloud/.ssh/authorized_keys -chown -R devcloud /home/devcloud/.ssh - -# Zero out the free space to save space in the final image: -dd if=/dev/zero of=/EMPTY bs=1M -rm -f /EMPTY - http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/veewee/preseed.cfg ---------------------------------------------------------------------- diff --git a/tools/devcloud/veewee/preseed.cfg b/tools/devcloud/veewee/preseed.cfg deleted file mode 100644 index 4a97171..0000000 --- a/tools/devcloud/veewee/preseed.cfg +++ /dev/null @@ -1,122 +0,0 @@ -# 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. - -## Options to set on the command line -d-i debian-installer/locale string en_US.utf8 -d-i console-setup/ask_detect boolean false -d-i console-setup/layout string USA - -#d-i netcfg/get_hostname string dummy -d-i netcfg/get_hostname string devcloud -d-i netcfg/get_domain string cloudstack.org - -# Continue without a default route -# Not working , specify a dummy in the DHCP -#d-i netcfg/no_default_route boolean - -d-i time/zone string UTC -d-i clock-setup/utc-auto boolean true -d-i clock-setup/utc boolean true - -d-i kbd-chooser/method select American English - -d-i netcfg/wireless_wep string - -d-i base-installer/kernel/override-image string linux-server -#d-i base-installer/kernel/override-image string linux-image-2.6.32-21-generic - -# Choices: Dialog, Readline, Gnome, Kde, Editor, Noninteractive -d-i debconf debconf/frontend select Noninteractive - -d-i pkgsel/install-language-support boolean false -tasksel tasksel/first multiselect standard, ubuntu-server - -#d-i partman-auto/method string regular -d-i partman-auto/method string lvm -d-i partman-auto-lvm/no_boot boolean true -d-i partman-auto/disk string /dev/sda -d-i partman-auto-lvm/new_vg_name string devcloud -d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-basicfilesystems/no_swap boolean false - -d-i partman-lvm/confirm boolean true -d-i partman-lvm/device_remove_lvm boolean true -d-i partman-auto/choose_recipe select devcloud - -d-i partman/confirm_write_new_label boolean true -d-i partman/confirm_nooverwrite boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman-auto/expert_recipe string \ -devcloud :: \ -4000 4500 4500 ext4 method{ lvm } \ -$lvmok{ } mountpoint{ / } lv_name{ root } \ -format{ } use_filesystem{ } filesystem{ ext4 } \ -.\ -15000 15000 15000 ext4 method{ lvm } \ -$lvmok{ } mountpoint{ /opt } lv_name{ data } \ -format{ } use_filesystem{ } filesystem{ ext4 } \ -. - -#http://ubuntu-virginia.ubuntuforums.org/showthread.php?p=9626883 -#Message: "write the changes to disk and configure lvm preseed" -#http://serverfault.com/questions/189328/ubuntu-kickstart-installation-using-lvm-waits-for-input -#preseed partman-lvm/confirm_nooverwrite boolean true - -# Write the changes to disks and configure LVM? -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select Finish -d-i partman/confirm_nooverwrite boolean true -d-i partman/confirm boolean true -d-i partman-auto-lvm/guided_size string max - -## Default user, we can get away with a recipe to change this -d-i passwd/user-fullname string devcloud -d-i passwd/username string devcloud -d-i passwd/user-password password devcloud -d-i passwd/user-password-again password devcloud -d-i user-setup/encrypt-home boolean false -d-i user-setup/allow-password-weak boolean true - -## minimum is puppet and ssh and ntp -# Individual additional packages to install -d-i pkgsel/include string openssh-server ntp - -# Whether to upgrade packages after debootstrap. -# Allowed values: none, safe-upgrade, full-upgrade -d-i pkgsel/upgrade select full-upgrade - -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean true -d-i finish-install/reboot_in_progress note - -#For the update -d-i pkgsel/update-policy select none - -# debconf-get-selections --install -#Use mirror -#d-i apt-setup/use_mirror boolean true -#d-i mirror/country string manual -#choose-mirror-bin mirror/protocol string http -#choose-mirror-bin mirror/http/hostname string 192.168.4.150 -#choose-mirror-bin mirror/http/directory string /ubuntu -#choose-mirror-bin mirror/suite select maverick -#d-i debian-installer/allow_unauthenticated string true - -choose-mirror-bin mirror/http/proxy string http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b996aff4/tools/devcloud/waitforxe.sh ---------------------------------------------------------------------- diff --git a/tools/devcloud/waitforxe.sh b/tools/devcloud/waitforxe.sh new file mode 100755 index 0000000..d59518f --- /dev/null +++ b/tools/devcloud/waitforxe.sh @@ -0,0 +1,23 @@ +#! /bin/bash +date +interval=20 +timeout=300 +command="xe host-list" + +count=0 +maxcount=$(($timeout/$interval)) + + +until [ $count -gt $maxcount ]; do + if $command > /dev/null 2>&1; then + echo "\"$command\" executed successfully." + date + exit 0 + fi + let count=count+1 + echo "Waiting for \"$command\" to run successfully." + sleep $interval +done + +echo "\"$command\" failed to complete." +date