Add Vagrantfile
- Add complete virtual environment with Python 2.7 and Cassandra 1.1.6 for testing.
This commit is contained in:
46
Vagrantfile
vendored
Normal file
46
Vagrantfile
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
Vagrant::Config.run do |config|
|
||||
# All Vagrant configuration is done here. The most common configuration
|
||||
# options are documented and commented below. For a complete reference,
|
||||
# please see the online documentation at vagrantup.com.
|
||||
|
||||
# Every Vagrant virtual environment requires a box to build off of.
|
||||
config.vm.box = "precise"
|
||||
|
||||
# The url from where the 'config.vm.box' box will be fetched if it
|
||||
# doesn't already exist on the user's system.
|
||||
config.vm.box_url = "https://s3-us-west-2.amazonaws.com/graphplatform.swmirror/precise64.box"
|
||||
|
||||
# Boot with a GUI so you can see the screen. (Default is headless)
|
||||
# config.vm.boot_mode = :gui
|
||||
|
||||
# Assign this VM to a host-only network IP, allowing you to access it
|
||||
# via the IP. Host-only networks can talk to the host machine as well as
|
||||
# any other machines on the same network, but cannot be accessed (through this
|
||||
# network interface) by any external networks.
|
||||
config.vm.network :hostonly, "192.168.33.10"
|
||||
|
||||
config.vm.customize ["modifyvm", :id, "--memory", "2048"]
|
||||
|
||||
# Forward a port from the guest to the host, which allows for outside
|
||||
# computers to access the VM, whereas host only networking does not.
|
||||
config.vm.forward_port 80, 8080
|
||||
|
||||
# Share an additional folder to the guest VM. The first argument is
|
||||
# an identifier, the second is the path on the guest to mount the
|
||||
# folder, and the third is the path on the host to the actual folder.
|
||||
# config.vm.share_folder "v-data", "/vagrant_data", "../data"
|
||||
#config.vm.share_folder "v-root" "/vagrant", ".", :nfs => true
|
||||
|
||||
# Provision with puppet
|
||||
config.vm.provision :shell, :inline => "apt-get update"
|
||||
|
||||
config.vm.provision :puppet, :options => ['--verbose', '--debug'] do |puppet|
|
||||
puppet.facter = {'hostname' => 'cassandraengine'}
|
||||
# puppet.manifests_path = "puppet/manifests"
|
||||
# puppet.manifest_file = "site.pp"
|
||||
puppet.module_path = "modules"
|
||||
end
|
||||
end
|
66
manifests/default.pp
Normal file
66
manifests/default.pp
Normal file
@@ -0,0 +1,66 @@
|
||||
# Basic virtualbox configuration
|
||||
Exec { path => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" }
|
||||
|
||||
node basenode {
|
||||
package{["build-essential", "git-core", "vim"]:
|
||||
ensure => installed
|
||||
}
|
||||
}
|
||||
|
||||
class xfstools {
|
||||
package{['lvm2', 'xfsprogs']:
|
||||
ensure => installed
|
||||
}
|
||||
}
|
||||
class java {
|
||||
package {['openjdk-7-jre-headless']:
|
||||
ensure => installed
|
||||
}
|
||||
}
|
||||
|
||||
class cassandra {
|
||||
include xfstools
|
||||
include java
|
||||
|
||||
package {"wget":
|
||||
ensure => latest
|
||||
}
|
||||
|
||||
file {"/etc/init/cassandra.conf":
|
||||
source => "puppet:///modules/cassandra/cassandra.upstart",
|
||||
owner => root
|
||||
}
|
||||
|
||||
exec {"download-cassandra":
|
||||
cwd => "/tmp",
|
||||
command => "wget http://download.nextag.com/apache/cassandra/1.1.6/apache-cassandra-1.1.6-bin.tar.gz",
|
||||
creates => "/tmp/apache-cassandra-1.1.6-bin.tar.gz",
|
||||
require => [Package["wget"], File["/etc/init/cassandra.conf"]]
|
||||
}
|
||||
|
||||
exec {"install-cassandra":
|
||||
cwd => "/tmp",
|
||||
command => "tar -xzf apache-cassandra-1.1.6-bin.tar.gz; mv apache-cassandra-1.1.6 /usr/local/cassandra",
|
||||
require => Exec["download-cassandra"],
|
||||
creates => "/usr/local/cassandra/bin/cassandra"
|
||||
}
|
||||
|
||||
service {"cassandra":
|
||||
ensure => running,
|
||||
require => Exec["install-cassandra"]
|
||||
}
|
||||
}
|
||||
|
||||
node cassandraengine inherits basenode {
|
||||
include cassandra
|
||||
|
||||
package {["python-pip", "python-dev"]:
|
||||
ensure => installed
|
||||
}
|
||||
|
||||
exec {"install-requirements":
|
||||
cwd => "/vagrant",
|
||||
command => "pip install -r requirements.txt",
|
||||
require => [Package["python-pip"], Package["python-dev"]]
|
||||
}
|
||||
}
|
18
modules/cassandra/files/cassandra.upstart
Normal file
18
modules/cassandra/files/cassandra.upstart
Normal file
@@ -0,0 +1,18 @@
|
||||
# Cassandra Upstart
|
||||
#
|
||||
|
||||
description "Cassandra"
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [!2345]
|
||||
|
||||
respawn
|
||||
|
||||
exec /usr/local/cassandra/bin/cassandra -f
|
||||
|
||||
|
||||
|
||||
pre-stop script
|
||||
kill `cat /tmp/cassandra.pid`
|
||||
sleep 3
|
||||
end script
|
Reference in New Issue
Block a user