Skip to content

Commit

Permalink
Move Devcloud4 into main repository
Browse files Browse the repository at this point in the history
  • Loading branch information
imduffy15 committed Apr 11, 2015
1 parent da233c7 commit 66cded7
Show file tree
Hide file tree
Showing 42 changed files with 2,570 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tools/devcloud4/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tmp
cookbooks
*.lock
.vagrant
101 changes: 101 additions & 0 deletions tools/devcloud4/README.md
Original file line number Diff line number Diff line change
@@ -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
27 changes: 27 additions & 0 deletions tools/devcloud4/advanced/Berksfile
Original file line number Diff line number Diff line change
@@ -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'
95 changes: 95 additions & 0 deletions tools/devcloud4/advanced/README.md
Original file line number Diff line number Diff line change
@@ -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
```
115 changes: 115 additions & 0 deletions tools/devcloud4/advanced/Vagrantfile
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions tools/devcloud4/advanced/chef_configuration.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
Loading

0 comments on commit 66cded7

Please sign in to comment.