From 66cded75e0f512b431d27cea2cffbc45deb3d859 Mon Sep 17 00:00:00 2001 From: Ian Duffy Date: Sat, 11 Apr 2015 16:17:02 +0100 Subject: [PATCH] Move Devcloud4 into main repository --- tools/devcloud4/.gitignore | 4 + tools/devcloud4/README.md | 101 ++++++ tools/devcloud4/advanced/Berksfile | 27 ++ tools/devcloud4/advanced/README.md | 95 ++++++ tools/devcloud4/advanced/Vagrantfile | 115 +++++++ .../advanced/chef_configuration.json | 24 ++ tools/devcloud4/advanced/marvin.cfg | 124 ++++++++ tools/devcloud4/basic/Berksfile | 27 ++ tools/devcloud4/basic/README.md | 83 +++++ tools/devcloud4/basic/Vagrantfile | 81 +++++ tools/devcloud4/basic/chef_configuration.json | 22 ++ tools/devcloud4/basic/marvin.cfg | 110 +++++++ .../binary-installation-advanced/Berksfile | 26 ++ .../binary-installation-advanced/Vagrantfile | 119 ++++++++ .../chef_configuration.json | 37 +++ .../marvin.cfg.erb | 123 ++++++++ .../binary-installation-basic/Berksfile | 26 ++ .../binary-installation-basic/Vagrantfile | 83 +++++ .../chef_configuration.json | 34 +++ .../binary-installation-basic/marvin.cfg.erb | 109 +++++++ .../common/binary-installation/README.md | 0 .../attributes/database_server.rb | 22 ++ .../binary-installation/attributes/default.rb | 38 +++ .../common/binary-installation/metadata.rb | 42 +++ .../recipes/database_server.rb | 24 ++ .../binary-installation/recipes/default.rb | 27 ++ .../recipes/management_server.rb | 57 ++++ .../binary-installation/recipes/nfsshares.rb | 48 +++ tools/devcloud4/common/configure-network.sh | 37 +++ .../common/development-installation/README.md | 0 .../attributes/database_server.rb | 22 ++ .../attributes/default.rb | 29 ++ .../files/default/cloud-install-sys-tmplt | 288 ++++++++++++++++++ .../files/default/createtmplt.sh | 239 +++++++++++++++ .../development-installation/metadata.rb | 42 +++ .../recipes/database_server.rb | 24 ++ .../recipes/default.rb | 27 ++ .../recipes/nfsshares.rb | 48 +++ .../recipes/system_templates.rb | 38 +++ tools/devcloud4/pom.xml | 112 +++++++ tools/devcloud4/prefill.sql | 34 +++ tools/pom.xml | 3 +- 42 files changed, 2570 insertions(+), 1 deletion(-) create mode 100644 tools/devcloud4/.gitignore create mode 100644 tools/devcloud4/README.md create mode 100644 tools/devcloud4/advanced/Berksfile create mode 100644 tools/devcloud4/advanced/README.md create mode 100644 tools/devcloud4/advanced/Vagrantfile create mode 100644 tools/devcloud4/advanced/chef_configuration.json create mode 100644 tools/devcloud4/advanced/marvin.cfg create mode 100644 tools/devcloud4/basic/Berksfile create mode 100644 tools/devcloud4/basic/README.md create mode 100644 tools/devcloud4/basic/Vagrantfile create mode 100644 tools/devcloud4/basic/chef_configuration.json create mode 100644 tools/devcloud4/basic/marvin.cfg create mode 100644 tools/devcloud4/binary-installation-advanced/Berksfile create mode 100644 tools/devcloud4/binary-installation-advanced/Vagrantfile create mode 100644 tools/devcloud4/binary-installation-advanced/chef_configuration.json create mode 100644 tools/devcloud4/binary-installation-advanced/marvin.cfg.erb create mode 100644 tools/devcloud4/binary-installation-basic/Berksfile create mode 100644 tools/devcloud4/binary-installation-basic/Vagrantfile create mode 100644 tools/devcloud4/binary-installation-basic/chef_configuration.json create mode 100644 tools/devcloud4/binary-installation-basic/marvin.cfg.erb create mode 100644 tools/devcloud4/common/binary-installation/README.md create mode 100644 tools/devcloud4/common/binary-installation/attributes/database_server.rb create mode 100644 tools/devcloud4/common/binary-installation/attributes/default.rb create mode 100644 tools/devcloud4/common/binary-installation/metadata.rb create mode 100644 tools/devcloud4/common/binary-installation/recipes/database_server.rb create mode 100644 tools/devcloud4/common/binary-installation/recipes/default.rb create mode 100644 tools/devcloud4/common/binary-installation/recipes/management_server.rb create mode 100644 tools/devcloud4/common/binary-installation/recipes/nfsshares.rb create mode 100644 tools/devcloud4/common/configure-network.sh create mode 100644 tools/devcloud4/common/development-installation/README.md create mode 100644 tools/devcloud4/common/development-installation/attributes/database_server.rb create mode 100644 tools/devcloud4/common/development-installation/attributes/default.rb create mode 100755 tools/devcloud4/common/development-installation/files/default/cloud-install-sys-tmplt create mode 100755 tools/devcloud4/common/development-installation/files/default/createtmplt.sh create mode 100644 tools/devcloud4/common/development-installation/metadata.rb create mode 100644 tools/devcloud4/common/development-installation/recipes/database_server.rb create mode 100644 tools/devcloud4/common/development-installation/recipes/default.rb create mode 100644 tools/devcloud4/common/development-installation/recipes/nfsshares.rb create mode 100644 tools/devcloud4/common/development-installation/recipes/system_templates.rb create mode 100644 tools/devcloud4/pom.xml create mode 100644 tools/devcloud4/prefill.sql diff --git a/tools/devcloud4/.gitignore b/tools/devcloud4/.gitignore new file mode 100644 index 00000000000..3969b1b356b --- /dev/null +++ b/tools/devcloud4/.gitignore @@ -0,0 +1,4 @@ +tmp +cookbooks +*.lock +.vagrant \ No newline at end of file diff --git a/tools/devcloud4/README.md b/tools/devcloud4/README.md new file mode 100644 index 00000000000..00d6756b7a4 --- /dev/null +++ b/tools/devcloud4/README.md @@ -0,0 +1,101 @@ +# Devcloud 4 + +## Introduction + +The follow project aims to simplify getting a full Apache CloudStack environment running on your machine. You can either take the easy ride and run `vagrant up` in either one of the 'binary installation' directories or compile CloudStack yourself. See for instructions in the 'basic' and 'advanced' directories. + +The included VagrantFile will give you: + + - Management + - NFS Server + - MySQL Server + - Router + - * Cloudstack Management Server * (Only given in binary installation) + + - XenServer 6.2 + +## Getting started + +1. Due to the large amount of data to be pulled from the Internet, it's probably not a good idea to do this over WiFi or Mobile data. + +1. Given the amount of virtual machines this brings up it is recommended you have atleast 8gb of ram before attempting this. + +1. Ensure your system has `git` installed. + +1. When on Windows, make sure you've set the git option `autocrlf` to `false`: + + ``` + git config --global core.autocrlf false + ``` + +1. Clone the repository: + + ``` + git clone https://github.com/imduffy15/devcloud4.git + ``` + +1. Download and Install [VirtualBox](https://www.virtualbox.org/wiki/Downloads) + + On Windows7, the Xenserver VM crashed immediately after booting with a General Protection Fault. + Installing VirtualBox version 4.3.6r91406 (https://www.virtualbox.org/wiki/Download_Old_Builds_4_3) fixed the problem, but only downgrade if the latest version does not work for you. + +1. Download and install [Vagrant](https://www.vagrantup.com/downloads.html) + +1. Ensure all Vagrant Plugins are installed: + + ```bash + vagrant plugin install vagrant-berkshelf vagrant-omnibus + ``` + +1. Download and install [ChefDK](https://downloads.chef.io/chef-dk/) + +### Configure virtualbox + +1. Open virtualbox and navigate to its preferences/settings window. + +1. Click onto the network tab and then onto the host only network tab. + +1. Configure your adapters as follows: + + - On Windows, the adapternames are different, and map as follows: + - vboxnet0: VirtualBox Host-Only Ethernet Adapter + - vboxnet1: VirtualBox Host-Only Ethernet Adapter 2 + - vboxnet2: VirtualBox Host-Only Ethernet Adapter 3 + + #### For Basic Networking you only need: + + ##### vboxnet0 + - IPv4 IP address of 192.168.22.1 + - Subnet of 255.255.255.0 + - DHCP server disabled + + #### For Advanced Networking you will need: + + + + ##### vboxnet1 + - IPv4 IP address of 192.168.23.1 + - Subnet of 255.255.255.0 + - DHCP server disabled + + + + ##### vboxnet2 + - IPv4 IP address of 192.168.24.1 + - Subnet of 255.255.255.0 + - DHCP server disabled + +## Defaults + +### Management Server + + - IP: 192.168.22.5 + - Username: vagrant or root + - Password: vagrant + +### Hypervisor + + - IP: 192.168.22.10 + - Username: root + - Password: password + diff --git a/tools/devcloud4/advanced/Berksfile b/tools/devcloud4/advanced/Berksfile new file mode 100644 index 00000000000..616ca68dc24 --- /dev/null +++ b/tools/devcloud4/advanced/Berksfile @@ -0,0 +1,27 @@ +# +# 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. +# + +source "https://api.berkshelf.com" + +cookbook 'hostname' +cookbook 'selinux' +cookbook 'nat-router', git: 'http://github.com/imduffy15/cookbook_nat-router' +cookbook 'cloudstack', git: 'https://github.com/imduffy15/cookbook_cloudstack-1' +cookbook 'development-installation', path: '../common/development-installation' +cookbook 'python', git: 'https://github.com/imduffy15/python.git' diff --git a/tools/devcloud4/advanced/README.md b/tools/devcloud4/advanced/README.md new file mode 100644 index 00000000000..6171839e68a --- /dev/null +++ b/tools/devcloud4/advanced/README.md @@ -0,0 +1,95 @@ +### Configure virtualbox + +1. Open virtualbox and navigate to its preferences/settings window. + +1. Click onto the network tab and then onto the host only network tab. + +1. Configure your adapters as follows: + + ##### vboxnet0 + - IPv4 IP address of 192.168.22.1 + - Subnet of 255.255.255.0 + - DHCP server disabled + + ##### vboxnet1 + - IPv4 IP address of 192.168.23.1 + - Subnet of 255.255.255.0 + - DHCP server disabled + + ##### vboxnet2 + - IPv4 IP address of 192.168.24.1 + - Subnet of 255.255.255.0 + - DHCP server disabled + + +### Start the vagrant boxes + +```bash +vagrant up +``` + +*** Common issues: *** + +- 'Cannot forward the specified ports on this VM': There could be MySQL or some other + service running on the host OS causing vagrant to fail setting up local port forwarding. + + +### Start Cloudstack + +1. Clone the Cloudstack Repository: + + ``` + git clone https://github.com/apache/cloudstack.git + ``` + + *** Note: *** + + Personally I prefer to use the 4.3 codebase rather than master. If you wish to do the same: + + ``` + git reset --hard 0810029 + ``` + +1. Download vhd-util: + + ```bash + cd /path/to/cloudstack/repo + wget http://download.cloud.com.s3.amazonaws.com/tools/vhd-util -P scripts/vm/hypervisor/xenserver/ + chmod +x scripts/vm/hypervisor/xenserver/vhd-util + ``` + +1. Compile Cloudstack: + + ```bash + cd /path/to/cloudstack/repo + mvn -P developer,systemvm clean install -DskipTests=true + ``` + +1. Deploy Cloudstack Database: + + ```bash + cd /path/to/cloudstack/repo + mvn -P developer -pl developer,tools/devcloud4 -Ddeploydb + ``` + +1. Start Cloudstack: + + ```bash + cd /path/to/cloudstack/repo + mvn -pl :cloud-client-ui jetty:run + ``` + +1. Install Marvin: + + ``` + cd /path/to/cloudstack/repo + pip install tools/marvin/dist/Marvin-0.1.0.tar.gz + ``` + +1. Deploy: + + ``` + python -m marvin.deployDataCenter -i marvin.cfg + ``` + + diff --git a/tools/devcloud4/advanced/Vagrantfile b/tools/devcloud4/advanced/Vagrantfile new file mode 100644 index 00000000000..0bf843bcb73 --- /dev/null +++ b/tools/devcloud4/advanced/Vagrantfile @@ -0,0 +1,115 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : +# +# 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. +# + +VAGRANTFILE_API_VERSION = '2' + +Vagrant.require_version '>= 1.5.0' + +unless Vagrant.has_plugin?('vagrant-berkshelf') + raise 'vagrant-berkshelf is not installed!' +end + +unless Vagrant.has_plugin?('vagrant-omnibus') + raise 'vagrant-omnibus is not installed!' +end + +xenserver_networking_script = File.join(File.dirname(__FILE__), '../common/', 'configure-network.sh') + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + + config.vm.define 'xenserver' do |xenserver| + xenserver.vm.box = 'duffy/xenserver' + + # Public Network (IP address is ignored.) + xenserver.vm.network :private_network, :auto_config => false, :ip => '192.168.23.10' + + # Guest Network (IP address is ignored.) + xenserver.vm.network :private_network, :auto_config => false, :ip => '192.168.24.10' + + # Configure Interfaces + + ## Configure Management Interface + xenserver.vm.provision 'shell' do |s| + s.path = xenserver_networking_script + s.args = %w(eth1 192.168.22.10 255.255.255.0 MGMT) + end + + ## Configure Public Interface + xenserver.vm.provision 'shell' do |s| + s.path = xenserver_networking_script + s.args = %w(eth2 na na PUBLIC) + end + + ## Configure Guest Interface + xenserver.vm.provision 'shell' do |s| + s.path = xenserver_networking_script + s.args = %w(eth3 na na GUEST) + end + + ## Tweak kernel + xenserver.vm.provision "shell", inline: "sed -i -e 's/net.bridge.bridge-nf-call-iptables = 1/net.bridge.bridge-nf-call-iptables = 0/g' -e 's/net.bridge.bridge-nf-call-arptables = 1/net.bridge.bridge-nf-call-arptables = 0/g' /etc/sysctl.conf && /sbin/sysctl -p /etc/sysctl.conf" + + ## Map host only networks and the adapters + xenserver.vm.provider 'virtualbox' do |v| + v.customize ['modifyvm', :id, '--nicpromisc2', 'allow-all'] + v.customize ['modifyvm', :id, '--nicpromisc3', 'allow-all'] + v.customize ['modifyvm', :id, '--nicpromisc4', 'allow-all'] + v.customize ['modifyvm', :id, '--hostonlyadapter2', 'vboxnet0'] + v.customize ['modifyvm', :id, '--hostonlyadapter3', 'vboxnet1'] + v.customize ['modifyvm', :id, '--hostonlyadapter4', 'vboxnet2'] + v.customize ["modifyvm", :id, '--nictype2', 'Am79C973'] + v.customize ["modifyvm", :id, '--nictype3', 'Am79C973'] + v.customize ["modifyvm", :id, '--nictype4', 'Am79C973'] + end + end + + config.vm.define 'management' do |management| + management.vm.box = 'chef/centos-6.5' + + # Configure management interface + management.vm.network :private_network, :auto_config => true, :ip => '192.168.22.5' + + # Configure public interface + management.vm.network :private_network, :auto_config => true, :ip => '192.168.23.5' + + # Port forward MySQL + management.vm.network 'forwarded_port', guest: 3306, host: 3306 + + management.vm.provider 'virtualbox' do |v| + v.customize ['modifyvm', :id, '--memory', 512] + v.customize ['modifyvm', :id, '--hostonlyadapter2', 'vboxnet0'] + v.customize ['modifyvm', :id, '--hostonlyadapter3', 'vboxnet1'] + v.customize ["modifyvm", :id, '--nictype2', 'Am79C973'] + v.customize ["modifyvm", :id, '--nictype3', 'Am79C973'] + end + + management.omnibus.chef_version = "11.16.4" + management.berkshelf.berksfile_path = File.join(File.dirname(__FILE__), 'Berksfile') + management.berkshelf.enabled = true + + CHEF_CONFIGURATION = JSON.parse(Pathname(__FILE__).dirname.join('chef_configuration.json').read) + + management.vm.provision 'chef_solo' do |chef| + chef.run_list = CHEF_CONFIGURATION.delete('run_list') + chef.json = CHEF_CONFIGURATION + end + end +end diff --git a/tools/devcloud4/advanced/chef_configuration.json b/tools/devcloud4/advanced/chef_configuration.json new file mode 100644 index 00000000000..40d5bce3f28 --- /dev/null +++ b/tools/devcloud4/advanced/chef_configuration.json @@ -0,0 +1,24 @@ +{ + "run_list": [ + "recipe[development-installation]", + "recipe[nat-router]" + ], + "iptables": { + "lans": ["eth1", "eth2"] + }, + "set_fqdn": "*.localdomain", + "selinux": { + "state": "permissive" + }, + "cloudstack": { + "secondary": { + "path": "/exports/secondary" + }, + "primary": { + "path": "/exports/primary" + }, + "hypervisor_tpl": { + "xenserver": "http://jenkins.buildacloud.org/job/build-systemvm64-master/lastSuccessfulBuild/artifact/tools/appliance/dist/systemvm64template-master-4.6.0-xen.vhd.bz2" + } + } +} diff --git a/tools/devcloud4/advanced/marvin.cfg b/tools/devcloud4/advanced/marvin.cfg new file mode 100644 index 00000000000..9e2ac563236 --- /dev/null +++ b/tools/devcloud4/advanced/marvin.cfg @@ -0,0 +1,124 @@ +# +# 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. +# + +{ + "zones": [ + { + "name": "DevCloud-Advanced-01", + "guestcidraddress": "10.1.1.0/24", + "localstorageenabled": true, + "dns1": "8.8.8.8", + "physical_networks": [ + { + "broadcastdomainrange": "Zone", + "vlan": "100-200", + "name": "DevCloud-Network-01", + "traffictypes": [ + { + "xen": "GUEST", + "typ": "Guest" + }, + { + "xen": "MGMT", + "typ": "Management" + }, + { + "xen": "PUBLIC", + "typ": "Public" + } + ], + "providers": [ + { + "broadcastdomainrange": "ZONE", + "name": "VirtualRouter" + }, + { + "broadcastdomainrange": "ZONE", + "name": "VpcVirtualRouter" + }, + { + "broadcastdomainrange": "ZONE", + "name": "InternalLbVm" + } + ], + "isolationmethods": [ + "VLAN" + ] + } + ], + "ipranges": [ + { + "startip": "192.168.23.100", + "endip": "192.168.23.120", + "netmask": "255.255.255.0", + "vlan": "untagged", + "gateway": "192.168.23.5" + } + ], + "networktype": "Advanced", + "pods": [ + { + "startip": "192.168.22.100", + "endip": "192.168.22.120", + "name": "DevCloud-POD-01", + "netmask": "255.255.255.0", + "clusters": [ + { + "clustername": "DevCloud-CLUSTER-01", + "hypervisor": "XenServer", + "hosts": [ + { + "username": "root", + "url": "http://192.168.22.10/", + "password": "password" + } + ], + "clustertype": "CloudManaged" + } + ], + "gateway": "192.168.22.5" + } + ], + "internaldns1": "8.8.8.8", + "secondaryStorages": [ + { + "url": "nfs://192.168.22.5/exports/secondary", + "provider": "NFS", + "details": [ ] + } + ] + } + ], + "logger": { + "LogFolderPath": "/tmp/" + }, + "mgtSvr": [ + { + "mgtSvrIp": "192.168.22.1", + "port": 8096 + } + ], + "dbSvr": { + "dbSvr": "127.0.0.1", + "port": 3306, + "user": "cloud", + "passwd": "cloud", + "db": "cloud" + } +} diff --git a/tools/devcloud4/basic/Berksfile b/tools/devcloud4/basic/Berksfile new file mode 100644 index 00000000000..616ca68dc24 --- /dev/null +++ b/tools/devcloud4/basic/Berksfile @@ -0,0 +1,27 @@ +# +# 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. +# + +source "https://api.berkshelf.com" + +cookbook 'hostname' +cookbook 'selinux' +cookbook 'nat-router', git: 'http://github.com/imduffy15/cookbook_nat-router' +cookbook 'cloudstack', git: 'https://github.com/imduffy15/cookbook_cloudstack-1' +cookbook 'development-installation', path: '../common/development-installation' +cookbook 'python', git: 'https://github.com/imduffy15/python.git' diff --git a/tools/devcloud4/basic/README.md b/tools/devcloud4/basic/README.md new file mode 100644 index 00000000000..31cb62dbabc --- /dev/null +++ b/tools/devcloud4/basic/README.md @@ -0,0 +1,83 @@ +### Configure virtualbox + +1. Open virtualbox and navigate to its preferences/settings window. + +1. Click onto the network tab and then onto the host only network tab. + +1. Configure your adapters as follows: + + ##### vboxnet0 + - IPv4 IP address of 192.168.22.1 + - Subnet of 255.255.255.0 + - DHCP server disabled + + +### Start the vagrant boxes + +```bash +vagrant up +``` + +*** Common issues: *** + +- 'Cannot forward the specified ports on this VM': There could be MySQL or some other + service running on the host OS causing vagrant to fail setting up local port forwarding. + + +### Start Cloudstack + +1. Clone the Cloudstack Repository: + + ``` + git clone https://github.com/apache/cloudstack.git + ``` + + *** Note: *** + + Personally I prefer to use the 4.3 codebase rather than master. If you wish to do the same: + + ``` + git reset --hard 0810029 + ``` + +1. Download vhd-util: + + ```bash + cd /path/to/cloudstack/repo + wget http://download.cloud.com.s3.amazonaws.com/tools/vhd-util -P scripts/vm/hypervisor/xenserver/ + chmod +x scripts/vm/hypervisor/xenserver/vhd-util + ``` + +1. Compile Cloudstack: + + ```bash + cd /path/to/cloudstack/repo + mvn -P developer,systemvm clean install -DskipTests=true + ``` + +1. Deploy Cloudstack Database: + + ```bash + cd /path/to/cloudstack/repo + mvn -P developer -pl developer,tools/devcloud4 -Ddeploydb + ``` + +1. Start Cloudstack: + + ```bash + cd /path/to/cloudstack/repo + mvn -pl :cloud-client-ui jetty:run + ``` + +1. Install Marvin: + + ``` + cd /path/to/cloudstack/repo + pip install tools/marvin/dist/Marvin-4.6.0-SNAPSHOT.tar.gz --allow-external mysql-connector-python + ``` + +1. Deploying: + + ``` + python -m marvin.deployDataCenter -i marvin.cfg + ``` diff --git a/tools/devcloud4/basic/Vagrantfile b/tools/devcloud4/basic/Vagrantfile new file mode 100644 index 00000000000..5f22edc3076 --- /dev/null +++ b/tools/devcloud4/basic/Vagrantfile @@ -0,0 +1,81 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : +# +# 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. +# + +VAGRANTFILE_API_VERSION = '2' + +Vagrant.require_version '>= 1.5.0' + +unless Vagrant.has_plugin?('vagrant-berkshelf') + raise 'vagrant-berkshelf is not installed!' +end + +unless Vagrant.has_plugin?('vagrant-omnibus') + raise 'vagrant-omnibus is not installed!' +end + +xenserver_networking_script = File.join(File.dirname(__FILE__), '../common/', 'configure-network.sh') + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + + config.vm.define 'xenserver' do |xenserver| + xenserver.vm.box = 'duffy/xenserver' + + ## Map host only networks and the adapters + xenserver.vm.provider 'virtualbox' do |v| + v.customize ['modifyvm', :id, '--hostonlyadapter2', 'vboxnet0'] + v.customize ['modifyvm', :id, '--nicpromisc2', 'allow-all'] + v.customize ["modifyvm", :id, '--nictype2', 'Am79C973'] + end + + # Configure Interface + ## Configure Management Interface + xenserver.vm.provision 'shell' do |s| + s.path = xenserver_networking_script + s.args = %w(eth1 192.168.22.10 255.255.255.0 MGMT) + end + + end + + config.vm.define 'management' do |management| + management.vm.box = 'chef/centos-6.5' + + management.vm.network :private_network, :auto_config => true, :ip => '192.168.22.5' + + management.vm.network 'forwarded_port', guest: 3306, host: 3306 + + management.vm.provider 'virtualbox' do |v| + v.customize ['modifyvm', :id, '--memory', 512] + v.customize ['modifyvm', :id, '--hostonlyadapter2', 'vboxnet0'] + v.customize ["modifyvm", :id, '--nictype2', 'Am79C973'] + end + + management.omnibus.chef_version = "11.16.4" + management.berkshelf.berksfile_path = File.join(File.dirname(__FILE__), 'Berksfile') + management.berkshelf.enabled = true + + CHEF_CONFIGURATION = JSON.parse(Pathname(__FILE__).dirname.join('chef_configuration.json').read) + + management.vm.provision 'chef_solo' do |chef| + chef.run_list = CHEF_CONFIGURATION.delete('run_list') + chef.json = CHEF_CONFIGURATION + end + end +end diff --git a/tools/devcloud4/basic/chef_configuration.json b/tools/devcloud4/basic/chef_configuration.json new file mode 100644 index 00000000000..507a0dea5a8 --- /dev/null +++ b/tools/devcloud4/basic/chef_configuration.json @@ -0,0 +1,22 @@ + +{ + "run_list": [ + "recipe[development-installation]", + "recipe[nat-router]" + ], + "set_fqdn": "*.localdomain", + "selinux": { + "state": "permissive" + }, + "cloudstack": { + "secondary": { + "path": "/exports/secondary" + }, + "primary": { + "path": "/exports/primary" + }, + "hypervisor_tpl": { + "xenserver": "http://jenkins.buildacloud.org/job/build-systemvm64-master/lastSuccessfulBuild/artifact/tools/appliance/dist/systemvm64template-master-4.6.0-xen.vhd.bz2" + } + } +} diff --git a/tools/devcloud4/basic/marvin.cfg b/tools/devcloud4/basic/marvin.cfg new file mode 100644 index 00000000000..dcc1b8226a5 --- /dev/null +++ b/tools/devcloud4/basic/marvin.cfg @@ -0,0 +1,110 @@ +# +# 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. +# + +{ + "zones": [ + { + "name": "DevCloud-Basic-01", + "enabled": "True", + "physical_networks": [ + { + "broadcastdomainrange": "Zone", + "name": "Devcloud-Network-01", + "traffictypes": [ + { + "typ": "Guest" + }, + { + "typ": "Management" + } + ], + "providers": [ + { + "broadcastdomainrange": "ZONE", + "name": "VirtualRouter" + }, + { + "broadcastdomainrange": "Pod", + "name": "SecurityGroupProvider" + } + ] + } + ], + "dns2": "8.8.4.4", + "dns1": "8.8.8.8", + "securitygroupenabled": "true", + "localstorageenabled": "true", + "networktype": "Basic", + "pods": [ + { + "endip": "192.168.22.220", + "name": "DevCloud-POD-01", + "startip": "192.168.22.200", + "guestIpRanges": [ + { + "startip": "192.168.22.100", + "endip": "192.168.22.199", + "netmask": "255.255.255.0", + "gateway": "192.168.22.5" + } + ], + "netmask": "255.255.255.0", + "clusters": [ + { + "clustername": "DevCloud-CLUSTER-01", + "hypervisor": "XenServer", + "hosts": [ + { + "username": "root", + "url": "http://192.168.22.10/", + "password": "password" + } + ], + "clustertype": "CloudManaged" + } + ], + "gateway": "192.168.22.5" + } + ], + "internaldns1": "8.8.8.8", + "secondaryStorages": [ + { + "url": "nfs://192.168.22.5/exports/secondary", + "provider": "NFS" + } + ] + } + ], + "logger": { + "LogFolderPath": "/tmp/" + }, + "mgtSvr": [ + { + "mgtSvrIp": "192.168.22.1", + "port": 8096 + } + ], + "dbSvr": { + "dbSvr": "127.0.0.1", + "port": 3306, + "user": "cloud", + "passwd": "cloud", + "db": "cloud" + } +} diff --git a/tools/devcloud4/binary-installation-advanced/Berksfile b/tools/devcloud4/binary-installation-advanced/Berksfile new file mode 100644 index 00000000000..7ad09e1a382 --- /dev/null +++ b/tools/devcloud4/binary-installation-advanced/Berksfile @@ -0,0 +1,26 @@ +# +# 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. +# + +source "https://api.berkshelf.com" + +cookbook 'hostname' +cookbook 'selinux' +cookbook 'nat-router', git: 'http://github.com/imduffy15/cookbook_nat-router' +cookbook 'cloudstack', git: 'https://github.com/imduffy15/cookbook_cloudstack-1' +cookbook 'binary-installation', path: '../common/binary-installation' \ No newline at end of file diff --git a/tools/devcloud4/binary-installation-advanced/Vagrantfile b/tools/devcloud4/binary-installation-advanced/Vagrantfile new file mode 100644 index 00000000000..255efc05f60 --- /dev/null +++ b/tools/devcloud4/binary-installation-advanced/Vagrantfile @@ -0,0 +1,119 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : +# +# 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. +# + +xenserver_networking_script = File.join(File.dirname(__FILE__), '../common/', 'configure-network.sh') + +is_windows = (RUBY_PLATFORM =~ /mswin|mingw|cygwin/) + +virtualbox_interface_0 = if is_windows then 'VirtualBox Host-Only Ethernet Adapter' else 'vboxnet0' end +virtualbox_interface_1 = if is_windows then 'VirtualBox Host-Only Ethernet Adapter #2' else 'vboxnet1' end +virtualbox_interface_2 = if is_windows then 'VirtualBox Host-Only Ethernet Adapter #3' else 'vboxnet2' end + +VAGRANTFILE_API_VERSION = '2' +Vagrant.require_version '>= 1.5.0' + +unless Vagrant.has_plugin?('vagrant-berkshelf') + raise 'vagrant-berkshelf is not installed!' +end + +unless Vagrant.has_plugin?('vagrant-omnibus') + raise 'vagrant-omnibus is not installed!' +end + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + + config.vm.define 'xenserver' do |xenserver| + xenserver.vm.box = 'duffy/xenserver' + + # Public Network (IP address is ignored.) + xenserver.vm.network :private_network, :auto_config => false, :ip => '192.168.23.10' + + # Guest Network (IP address is ignored.) + xenserver.vm.network :private_network, :auto_config => false, :ip => '192.168.24.10' + + ## Configure Management Interface + xenserver.vm.provision 'shell' do |s| + s.path = xenserver_networking_script + s.args = %w(eth1 192.168.22.10 255.255.255.0 MGMT) + end + + ## Configure Public Interface + xenserver.vm.provision 'shell' do |s| + s.path = xenserver_networking_script + s.args = %w(eth2 na na PUBLIC) + end + + ## Configure Guest Interface + xenserver.vm.provision 'shell' do |s| + s.path = xenserver_networking_script + s.args = %w(eth3 na na GUEST) + end + + ## Map host only networks and the adapters + xenserver.vm.provider 'virtualbox' do |v| + v.customize ['modifyvm', :id, '--nicpromisc2', 'allow-all'] + v.customize ['modifyvm', :id, '--nicpromisc3', 'allow-all'] + v.customize ['modifyvm', :id, '--nicpromisc4', 'allow-all'] + v.customize ['modifyvm', :id, '--hostonlyadapter2', virtualbox_interface_0] + v.customize ['modifyvm', :id, '--hostonlyadapter3', virtualbox_interface_1] + v.customize ['modifyvm', :id, '--hostonlyadapter4', virtualbox_interface_2] + v.customize ['modifyvm', :id, '--memory', 6144] + end + + ## Tweak kernel + xenserver.vm.provision "shell", inline: "sed -i -e 's/net.bridge.bridge-nf-call-iptables = 1/net.bridge.bridge-nf-call-iptables = 0/g' -e 's/net.bridge.bridge-nf-call-arptables = 1/net.bridge.bridge-nf-call-arptables = 0/g' /etc/sysctl.conf && /sbin/sysctl -p /etc/sysctl.conf" + end + + config.vm.define 'management' do |management| + management.vm.box = 'chef/centos-6.5' + + management.vm.network :private_network, :auto_config => true, :ip => '192.168.22.5' + management.vm.network :private_network, :auto_config => true, :ip => '192.168.23.5' + + management.vm.network 'forwarded_port', guest: 3306, host: 3306 + management.vm.network 'forwarded_port', guest: 8080, host: 8080 + + management.vm.provider 'virtualbox' do |v| + v.customize ['modifyvm', :id, '--memory', 2048] + v.customize ['modifyvm', :id, '--hostonlyadapter2', virtualbox_interface_0] + v.customize ['modifyvm', :id, '--hostonlyadapter3', virtualbox_interface_1] + end + + if Vagrant.has_plugin?('vagrant-cachier') + management.cache.scope = :box + management.cache.auto_detect = true + management.omnibus.cache_packages = true + end + + management.omnibus.chef_version = "11.16.4" + management.berkshelf.berksfile_path = File.join(File.dirname(__FILE__), 'Berksfile') + management.berkshelf.enabled = true + + + CHEF_CONFIGURATION = JSON.parse(Pathname(__FILE__).dirname.join('chef_configuration.json').read) + + management.vm.provision :chef_solo do |chef| + chef.log_level = :debug + chef.run_list = CHEF_CONFIGURATION.delete('run_list') + chef.json = CHEF_CONFIGURATION + end + end +end diff --git a/tools/devcloud4/binary-installation-advanced/chef_configuration.json b/tools/devcloud4/binary-installation-advanced/chef_configuration.json new file mode 100644 index 00000000000..ceae5d495e0 --- /dev/null +++ b/tools/devcloud4/binary-installation-advanced/chef_configuration.json @@ -0,0 +1,37 @@ +{ + "run_list": [ + "recipe[binary-installation]", + "recipe[nat-router]" + ], + "set_fqdn": "*.localdomain", + "selinux": { + "state": "permissive" + }, + "cloudstack": { + "db": { + "user": "cloud", + "password": "cloud", + "rootusername": "root", + "rootpassword": "password", + "management_server_key": "password", + "database_key": "password", + "prefill": "/vagrant/prefill.sql" + }, + "secondary": { + "path": "/exports/secondary" + }, + "primary": { + "path": "/exports/primary" + }, + "hypervisor_tpl": { + "xenserver": "http://packages.shapeblue.com/systemvmtemplate/4.5/systemvm64template-4.5-xen.vhd.bz2" + }, + "configuration": "/vagrant/marvin.cfg.erb", + "yum_repo": "http://packages.shapeblue.com/cloudstack/testing/centos/4.5/", + "apt_repo": "http://packages.shapeblue.com/cloudstack/testing/debian/4.5/", + "version": "4.5.0" + }, + "iptables": { + "lans": ["eth1", "eth2"] + } +} diff --git a/tools/devcloud4/binary-installation-advanced/marvin.cfg.erb b/tools/devcloud4/binary-installation-advanced/marvin.cfg.erb new file mode 100644 index 00000000000..6c847fb266d --- /dev/null +++ b/tools/devcloud4/binary-installation-advanced/marvin.cfg.erb @@ -0,0 +1,123 @@ +# 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. +# + +{ + "zones": [ + { + "name": "DevCloud-Advanced-01", + "guestcidraddress": "10.1.1.0/24", + "localstorageenabled": true, + "dns1": "8.8.8.8", + "physical_networks": [ + { + "broadcastdomainrange": "Zone", + "vlan": "100-200", + "name": "DevCloud-Network-01", + "traffictypes": [ + { + "xen": "GUEST", + "typ": "Guest" + }, + { + "xen": "MGMT", + "typ": "Management" + }, + { + "xen": "PUBLIC", + "typ": "Public" + } + ], + "providers": [ + { + "broadcastdomainrange": "ZONE", + "name": "VirtualRouter" + }, + { + "broadcastdomainrange": "ZONE", + "name": "VpcVirtualRouter" + }, + { + "broadcastdomainrange": "ZONE", + "name": "InternalLbVm" + } + ], + "isolationmethods": [ + "VLAN" + ] + } + ], + "ipranges": [ + { + "startip": "192.168.23.100", + "endip": "192.168.23.120", + "netmask": "255.255.255.0", + "vlan": "untagged", + "gateway": "192.168.23.5" + } + ], + "networktype": "Advanced", + "pods": [ + { + "startip": "192.168.22.100", + "endip": "192.168.22.120", + "name": "DevCloud-POD-01", + "netmask": "255.255.255.0", + "clusters": [ + { + "clustername": "DevCloud-CLUSTER-01", + "hypervisor": "XenServer", + "hosts": [ + { + "username": "root", + "url": "http://192.168.22.10/", + "password": "password" + } + ], + "clustertype": "CloudManaged" + } + ], + "gateway": "192.168.22.5" + } + ], + "internaldns1": "8.8.8.8", + "secondaryStorages": [ + { + "url": "nfs://192.168.22.5/exports/secondary", + "provider": "NFS", + "details": [ ] + } + ] + } + ], + "logger": { + "LogFolderPath": "/tmp/" + }, + "mgtSvr": [ + { + "mgtSvrIp": "<%= @management_server_ip %>", + "port": <%= @management_server_port %> + } + ], + "dbSvr": { + "dbSvr": "<%= @database_server_ip %>", + "port": <%= @database_server_port %>, + "user": "<%= @database_user %>", + "passwd": "<%= @database_password %>", + "db": "<%= @database %>" + } +} \ No newline at end of file diff --git a/tools/devcloud4/binary-installation-basic/Berksfile b/tools/devcloud4/binary-installation-basic/Berksfile new file mode 100644 index 00000000000..7ad09e1a382 --- /dev/null +++ b/tools/devcloud4/binary-installation-basic/Berksfile @@ -0,0 +1,26 @@ +# +# 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. +# + +source "https://api.berkshelf.com" + +cookbook 'hostname' +cookbook 'selinux' +cookbook 'nat-router', git: 'http://github.com/imduffy15/cookbook_nat-router' +cookbook 'cloudstack', git: 'https://github.com/imduffy15/cookbook_cloudstack-1' +cookbook 'binary-installation', path: '../common/binary-installation' \ No newline at end of file diff --git a/tools/devcloud4/binary-installation-basic/Vagrantfile b/tools/devcloud4/binary-installation-basic/Vagrantfile new file mode 100644 index 00000000000..acc9be7a016 --- /dev/null +++ b/tools/devcloud4/binary-installation-basic/Vagrantfile @@ -0,0 +1,83 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : +# +# 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. +# + +xenserver_networking_script = File.join(File.dirname(__FILE__), '../common/', 'configure-network.sh') + +is_windows = (RUBY_PLATFORM =~ /mswin|mingw|cygwin/) + +virtualbox_interface_0 = if is_windows then 'VirtualBox Host-Only Ethernet Adapter' else 'vboxnet0' end + +VAGRANTFILE_API_VERSION = '2' +Vagrant.require_version '>= 1.5.0' + +unless Vagrant.has_plugin?('vagrant-berkshelf') + raise 'vagrant-berkshelf is not installed!' +end + +unless Vagrant.has_plugin?('vagrant-omnibus') + raise 'vagrant-omnibus is not installed!' +end + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + + config.vm.define 'xenserver' do |xenserver| + xenserver.vm.box = 'duffy/xenserver' + + ## Configure Management Interface + xenserver.vm.provision 'shell' do |s| + s.path = xenserver_networking_script + s.args = %w(eth1 192.168.22.10 255.255.255.0 MGMT) + end + + ## Map host only networks and the adapters + xenserver.vm.provider 'virtualbox' do |v| + v.customize ['modifyvm', :id, '--nicpromisc2', 'allow-all'] + v.customize ['modifyvm', :id, '--hostonlyadapter2', virtualbox_interface_0] + v.customize ['modifyvm', :id, '--memory', 6144] + end + end + + config.vm.define 'management' do |management| + management.vm.box = 'chef/centos-6.5' + + management.vm.network :private_network, :auto_config => true, :ip => '192.168.22.5' + + management.vm.network 'forwarded_port', guest: 3306, host: 3306 + management.vm.network 'forwarded_port', guest: 8080, host: 8080 + + management.vm.provider 'virtualbox' do |v| + v.customize ['modifyvm', :id, '--memory', 2048] + v.customize ['modifyvm', :id, '--hostonlyadapter2', virtualbox_interface_0] + end + + management.omnibus.chef_version = "11.16.4" + management.berkshelf.berksfile_path = File.join(File.dirname(__FILE__), 'Berksfile') + management.berkshelf.enabled = true + + + CHEF_CONFIGURATION = JSON.parse(Pathname(__FILE__).dirname.join('chef_configuration.json').read) + + management.vm.provision :chef_solo do |chef| + chef.run_list = CHEF_CONFIGURATION.delete('run_list') + chef.json = CHEF_CONFIGURATION + end + end +end diff --git a/tools/devcloud4/binary-installation-basic/chef_configuration.json b/tools/devcloud4/binary-installation-basic/chef_configuration.json new file mode 100644 index 00000000000..87464bf577d --- /dev/null +++ b/tools/devcloud4/binary-installation-basic/chef_configuration.json @@ -0,0 +1,34 @@ +{ + "run_list": [ + "recipe[binary-installation]", + "recipe[nat-router]" + ], + "set_fqdn": "*.localdomain", + "selinux": { + "state": "permissive" + }, + "cloudstack": { + "db": { + "user": "cloud", + "password": "cloud", + "rootusername": "root", + "rootpassword": "password", + "management_server_key": "password", + "database_key": "password", + "prefill": "/vagrant/prefill.sql" + }, + "secondary": { + "path": "/exports/secondary" + }, + "primary": { + "path": "/exports/primary" + }, + "hypervisor_tpl": { + "xenserver": "http://packages.shapeblue.com/systemvmtemplate/4.5/systemvm64template-4.5-xen.vhd.bz2" + }, + "configuration": "/vagrant/marvin.cfg.erb", + "yum_repo": "http://packages.shapeblue.com/cloudstack/testing/centos/4.5/", + "apt_repo": "http://packages.shapeblue.com/cloudstack/testing/debian/4.5/", + "version": "4.5.0" + } +} diff --git a/tools/devcloud4/binary-installation-basic/marvin.cfg.erb b/tools/devcloud4/binary-installation-basic/marvin.cfg.erb new file mode 100644 index 00000000000..62415c91ad2 --- /dev/null +++ b/tools/devcloud4/binary-installation-basic/marvin.cfg.erb @@ -0,0 +1,109 @@ +# 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. +# + +{ + "zones": [ + { + "name": "DevCloud-Basic-01", + "enabled": "True", + "physical_networks": [ + { + "broadcastdomainrange": "Zone", + "name": "Devcloud-Network-01", + "traffictypes": [ + { + "typ": "Guest" + }, + { + "typ": "Management" + } + ], + "providers": [ + { + "broadcastdomainrange": "ZONE", + "name": "VirtualRouter" + }, + { + "broadcastdomainrange": "Pod", + "name": "SecurityGroupProvider" + } + ] + } + ], + "dns2": "8.8.4.4", + "dns1": "8.8.8.8", + "securitygroupenabled": "true", + "localstorageenabled": "true", + "networktype": "Basic", + "pods": [ + { + "endip": "192.168.22.220", + "name": "DevCloud-POD-01", + "startip": "192.168.22.200", + "guestIpRanges": [ + { + "startip": "192.168.22.100", + "endip": "192.168.22.199", + "netmask": "255.255.255.0", + "gateway": "192.168.22.5" + } + ], + "netmask": "255.255.255.0", + "clusters": [ + { + "clustername": "DevCloud-CLUSTER-01", + "hypervisor": "XenServer", + "hosts": [ + { + "username": "root", + "url": "http://192.168.22.10/", + "password": "password" + } + ], + "clustertype": "CloudManaged" + } + ], + "gateway": "192.168.22.5" + } + ], + "internaldns1": "8.8.8.8", + "secondaryStorages": [ + { + "url": "nfs://192.168.22.5/exports/secondary", + "provider": "NFS" + } + ] + } + ], + "logger": { + "LogFolderPath": "/tmp/" + }, + "mgtSvr": [ + { + "mgtSvrIp": "<%= @management_server_ip %>", + "port": <%= @management_server_port %> + } + ], + "dbSvr": { + "dbSvr": "<%= @database_server_ip %>", + "port": <%= @database_server_port %>, + "user": "<%= @database_user %>", + "passwd": "<%= @database_password %>", + "db": "<%= @database %>" + } +} \ No newline at end of file diff --git a/tools/devcloud4/common/binary-installation/README.md b/tools/devcloud4/common/binary-installation/README.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tools/devcloud4/common/binary-installation/attributes/database_server.rb b/tools/devcloud4/common/binary-installation/attributes/database_server.rb new file mode 100644 index 00000000000..35a388f6d52 --- /dev/null +++ b/tools/devcloud4/common/binary-installation/attributes/database_server.rb @@ -0,0 +1,22 @@ +# +# 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. +# + +default['mysql']['server_root_password'] = node['cloudstack']['db']['rootpassword'] +default['mysql']['allow_remote_root'] = true +default['mysql']['data_dir'] = '/data/mysql' diff --git a/tools/devcloud4/common/binary-installation/attributes/default.rb b/tools/devcloud4/common/binary-installation/attributes/default.rb new file mode 100644 index 00000000000..3b3eba0b02a --- /dev/null +++ b/tools/devcloud4/common/binary-installation/attributes/default.rb @@ -0,0 +1,38 @@ +# +# 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. +# + +default['cloudstack']['db']['host'] = '127.0.0.1' +default['cloudstack']['db']['user'] = 'cloud' +default['cloudstack']['db']['password'] = 'password' +default['cloudstack']['db']['rootusername'] = 'root' +default['cloudstack']['db']['rootpassword'] = 'cloud' +default['cloudstack']['db']['management_server_key'] = 'password' +default['cloudstack']['db']['database_key'] = 'password' +default['cloudstack']['db']['prefill'] = '/vagrant/prefill.sql' + +default['cloudstack']['secondary']['host'] = node['ipaddress'] +default['cloudstack']['secondary']['path'] = '/data/secondary' +default['cloudstack']['secondary']['mgt_path'] = node['cloudstack']['secondary']['path'] + +default['cloudstack']['primary']['host'] = node['ipaddress'] +default['cloudstack']['primary']['path'] = '/data/primary' +default['cloudstack']['primary']['mgt_path'] = node['cloudstack']['primary']['path'] + + +default['cloudstack']['configuration'] = '/vagrant/marvin.cfg.erb' \ No newline at end of file diff --git a/tools/devcloud4/common/binary-installation/metadata.rb b/tools/devcloud4/common/binary-installation/metadata.rb new file mode 100644 index 00000000000..bc2f515c611 --- /dev/null +++ b/tools/devcloud4/common/binary-installation/metadata.rb @@ -0,0 +1,42 @@ +# +# 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. +# + +name 'binary-installation' +maintainer 'Ian Duffy' +maintainer_email 'ian@ianduffy.ie' +license 'Apache 2' +description 'Wrapper around several different cookbooks.' +long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) +version '0.1.0' + +depends 'mysql', '= 5.6.1' +depends 'cloudstack', '>= 3.0.0' +depends 'nfs', '>= 2.0.0' + +supports 'centos' +supports 'redhat' +supports 'debian' +supports 'ubuntu' +supports 'fedora' +supports 'oracle' + +provides 'binary-installation::default' +provides 'binary-installation::management_server' +provides 'binary-installation::database_server' +provides 'binary-installation::nfs_server' diff --git a/tools/devcloud4/common/binary-installation/recipes/database_server.rb b/tools/devcloud4/common/binary-installation/recipes/database_server.rb new file mode 100644 index 00000000000..28a374c8c7e --- /dev/null +++ b/tools/devcloud4/common/binary-installation/recipes/database_server.rb @@ -0,0 +1,24 @@ +# +# 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_recipe 'mysql::server' +include_recipe 'mysql::client' + +include_recipe 'cloudstack::mysql_conf' + diff --git a/tools/devcloud4/common/binary-installation/recipes/default.rb b/tools/devcloud4/common/binary-installation/recipes/default.rb new file mode 100644 index 00000000000..6dcd47c5278 --- /dev/null +++ b/tools/devcloud4/common/binary-installation/recipes/default.rb @@ -0,0 +1,27 @@ +# +# 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. +# + +service 'iptables' do + action [:disable, :stop] + only_if { platform?(%w{redhat centos fedora oracle}) } +end + +include_recipe 'binary-installation::nfsshares' +include_recipe 'binary-installation::database_server' +include_recipe 'binary-installation::management_server' \ No newline at end of file diff --git a/tools/devcloud4/common/binary-installation/recipes/management_server.rb b/tools/devcloud4/common/binary-installation/recipes/management_server.rb new file mode 100644 index 00000000000..742f35f272e --- /dev/null +++ b/tools/devcloud4/common/binary-installation/recipes/management_server.rb @@ -0,0 +1,57 @@ +# +# 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_recipe 'cloudstack::marvin' +include_recipe 'cloudstack::management_server' + +cloudstack_setup_database node['cloudstack']['db']['host'] do + root_user node['cloudstack']['db']['rootusername'] + root_password node['cloudstack']['db']['rootpassword'] + user node['cloudstack']['db']['username'] + password node['cloudstack']['db']['password'] + action :create +end + +cloudstack_prefill_database node['cloudstack']['db']['prefill'] do + ip node['cloudstack']['db']['host'] + user node['cloudstack']['db']['username'] + password node['cloudstack']['db']['password'] +end + +cloudstack_system_template 'xenserver' do + nfs_path node['cloudstack']['secondary']['path'] + nfs_server node['cloudstack']['secondary']['host'] + db_user node['cloudstack']['db']['username'] + url node['cloudstack']['hypervisor_tpl']['xenserver'] + db_password node['cloudstack']['db']['password'] + db_host node['cloudstack']['db']['host'] + action :create +end + +cloudstack_setup_management node.name + +service 'cloudstack-management' do + action [:enable, :start] +end + +cloudstack_configure_cloud node['cloudstack']['configuration'] do + database_server_ip node['cloudstack']['db']['host'] + database_user node['cloudstack']['db']['username'] + database_password node['cloudstack']['db']['password'] +end diff --git a/tools/devcloud4/common/binary-installation/recipes/nfsshares.rb b/tools/devcloud4/common/binary-installation/recipes/nfsshares.rb new file mode 100644 index 00000000000..100eab9f2e7 --- /dev/null +++ b/tools/devcloud4/common/binary-installation/recipes/nfsshares.rb @@ -0,0 +1,48 @@ +# +# 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_recipe 'nfs::server' + +directory node['cloudstack']['secondary']['path'] do + owner 'root' + group 'root' + action :create + recursive true +end + +nfs_export node['cloudstack']['secondary']['path'] do + network '*' + writeable true + sync false + options %w(no_root_squash no_subtree_check) +end + +directory node['cloudstack']['primary']['path'] do + owner 'root' + group 'root' + action :create + recursive true +end + +nfs_export node['cloudstack']['primary']['path'] do + network '*' + writeable true + sync false + options %w(no_root_squash no_subtree_check) +end diff --git a/tools/devcloud4/common/configure-network.sh b/tools/devcloud4/common/configure-network.sh new file mode 100644 index 00000000000..dde115dc9ab --- /dev/null +++ b/tools/devcloud4/common/configure-network.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Usage ./reset-network.sh interface ip netmask +# +# 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. +# + +[ $# -lt 3 ] && { echo -e "Missing arguments\nUsage: ./reset-network interface ip netmask label"; exit 1; } + +. /etc/xensource-inventory + +PIF=$(/usr/bin/xe pif-introduce device=$1 host-uuid=${INSTALLATION_UUID}) + +NETWORKPIF=$(/usr/bin/xe pif-list uuid=${PIF} params="network-uuid" --minimal) +/usr/bin/xe network-param-set uuid=${NETWORKPIF} name-label=${4} + +if [ ${4} == "MGMT" ] +then + /usr/bin/xe pif-reconfigure-ip uuid=${PIF} mode=static ip=${2} netmask=${3} + /usr/bin/xe host-management-reconfigure pif-uuid=${PIF} +else + /usr/bin/xe pif-plug uuid=${PIF} +fi diff --git a/tools/devcloud4/common/development-installation/README.md b/tools/devcloud4/common/development-installation/README.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tools/devcloud4/common/development-installation/attributes/database_server.rb b/tools/devcloud4/common/development-installation/attributes/database_server.rb new file mode 100644 index 00000000000..314f9c1a550 --- /dev/null +++ b/tools/devcloud4/common/development-installation/attributes/database_server.rb @@ -0,0 +1,22 @@ +# +# 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. +# + +default['mysql']['server_root_password'] = '' +default['mysql']['allow_remote_root'] = true +default['mysql']['data_dir'] = '/data/mysql' diff --git a/tools/devcloud4/common/development-installation/attributes/default.rb b/tools/devcloud4/common/development-installation/attributes/default.rb new file mode 100644 index 00000000000..705423b1fef --- /dev/null +++ b/tools/devcloud4/common/development-installation/attributes/default.rb @@ -0,0 +1,29 @@ +# +# 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. +# + +default['cloudstack']['secondary']['host'] = node['ipaddress'] +default['cloudstack']['secondary']['path'] = '/data/secondary' +default['cloudstack']['secondary']['mgt_path'] = node['cloudstack']['secondary']['path'] + +default['cloudstack']['primary']['host'] = node['ipaddress'] +default['cloudstack']['primary']['path'] = '/data/primary' +default['cloudstack']['primary']['mgt_path'] = node['cloudstack']['primary']['path'] + +default['cloudstack']['cloud-install-sys-tmplt'] = "#{Chef::Config['file_cache_path']}/cloud-install-sys-tmplt" +default['cloudstack']['createtmplt'] = "#{Chef::Config['file_cache_path']}/createtmplt.sh" \ No newline at end of file diff --git a/tools/devcloud4/common/development-installation/files/default/cloud-install-sys-tmplt b/tools/devcloud4/common/development-installation/files/default/cloud-install-sys-tmplt new file mode 100755 index 00000000000..313b5999e85 --- /dev/null +++ b/tools/devcloud4/common/development-installation/files/default/cloud-install-sys-tmplt @@ -0,0 +1,288 @@ +#!/usr/bin/env bash +# $Id: installrtng.sh 11251 2010-07-23 23:40:44Z abhishek $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/storage/secondary/installrtng.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. + + +usage() { + printf "Usage: %s: -m -f [-h ] [ -s ][-u ] [-F ] [-e