Skip to content

Commit fc1de72

Browse files
author
Eric Scrivner
committed
Add Vagrantfile
- Add complete virtual environment with Python 2.7 and Cassandra 1.1.6 for testing.
1 parent b8103dd commit fc1de72

3 files changed

Lines changed: 130 additions & 0 deletions

File tree

Vagrantfile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
Vagrant::Config.run do |config|
5+
# All Vagrant configuration is done here. The most common configuration
6+
# options are documented and commented below. For a complete reference,
7+
# please see the online documentation at vagrantup.com.
8+
9+
# Every Vagrant virtual environment requires a box to build off of.
10+
config.vm.box = "precise"
11+
12+
# The url from where the 'config.vm.box' box will be fetched if it
13+
# doesn't already exist on the user's system.
14+
config.vm.box_url = "https://s3-us-west-2.amazonaws.com/graphplatform.swmirror/precise64.box"
15+
16+
# Boot with a GUI so you can see the screen. (Default is headless)
17+
# config.vm.boot_mode = :gui
18+
19+
# Assign this VM to a host-only network IP, allowing you to access it
20+
# via the IP. Host-only networks can talk to the host machine as well as
21+
# any other machines on the same network, but cannot be accessed (through this
22+
# network interface) by any external networks.
23+
config.vm.network :hostonly, "192.168.33.10"
24+
25+
config.vm.customize ["modifyvm", :id, "--memory", "2048"]
26+
27+
# Forward a port from the guest to the host, which allows for outside
28+
# computers to access the VM, whereas host only networking does not.
29+
config.vm.forward_port 80, 8080
30+
31+
# Share an additional folder to the guest VM. The first argument is
32+
# an identifier, the second is the path on the guest to mount the
33+
# folder, and the third is the path on the host to the actual folder.
34+
# config.vm.share_folder "v-data", "/vagrant_data", "../data"
35+
#config.vm.share_folder "v-root" "/vagrant", ".", :nfs => true
36+
37+
# Provision with puppet
38+
config.vm.provision :shell, :inline => "apt-get update"
39+
40+
config.vm.provision :puppet, :options => ['--verbose', '--debug'] do |puppet|
41+
puppet.facter = {'hostname' => 'cassandraengine'}
42+
# puppet.manifests_path = "puppet/manifests"
43+
# puppet.manifest_file = "site.pp"
44+
puppet.module_path = "modules"
45+
end
46+
end

manifests/default.pp

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Basic virtualbox configuration
2+
Exec { path => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" }
3+
4+
node basenode {
5+
package{["build-essential", "git-core", "vim"]:
6+
ensure => installed
7+
}
8+
}
9+
10+
class xfstools {
11+
package{['lvm2', 'xfsprogs']:
12+
ensure => installed
13+
}
14+
}
15+
class java {
16+
package {['openjdk-7-jre-headless']:
17+
ensure => installed
18+
}
19+
}
20+
21+
class cassandra {
22+
include xfstools
23+
include java
24+
25+
package {"wget":
26+
ensure => latest
27+
}
28+
29+
file {"/etc/init/cassandra.conf":
30+
source => "puppet:///modules/cassandra/cassandra.upstart",
31+
owner => root
32+
}
33+
34+
exec {"download-cassandra":
35+
cwd => "/tmp",
36+
command => "wget http://download.nextag.com/apache/cassandra/1.1.6/apache-cassandra-1.1.6-bin.tar.gz",
37+
creates => "/tmp/apache-cassandra-1.1.6-bin.tar.gz",
38+
require => [Package["wget"], File["/etc/init/cassandra.conf"]]
39+
}
40+
41+
exec {"install-cassandra":
42+
cwd => "/tmp",
43+
command => "tar -xzf apache-cassandra-1.1.6-bin.tar.gz; mv apache-cassandra-1.1.6 /usr/local/cassandra",
44+
require => Exec["download-cassandra"],
45+
creates => "/usr/local/cassandra/bin/cassandra"
46+
}
47+
48+
service {"cassandra":
49+
ensure => running,
50+
require => Exec["install-cassandra"]
51+
}
52+
}
53+
54+
node cassandraengine inherits basenode {
55+
include cassandra
56+
57+
package {["python-pip", "python-dev"]:
58+
ensure => installed
59+
}
60+
61+
exec {"install-requirements":
62+
cwd => "/vagrant",
63+
command => "pip install -r requirements.txt",
64+
require => [Package["python-pip"], Package["python-dev"]]
65+
}
66+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Cassandra Upstart
2+
#
3+
4+
description "Cassandra"
5+
6+
start on runlevel [2345]
7+
stop on runlevel [!2345]
8+
9+
respawn
10+
11+
exec /usr/local/cassandra/bin/cassandra -f
12+
13+
14+
15+
pre-stop script
16+
kill `cat /tmp/cassandra.pid`
17+
sleep 3
18+
end script

0 commit comments

Comments
 (0)