Removing some older unnecessary crud

Fixes #13
This commit is contained in:
R. Tyler Croy 2015-09-09 13:17:02 -07:00
parent 23b6fdd4e3
commit 7f0b8a5520
No known key found for this signature in database
GPG Key ID: 1426C7DC3F51E16F
14 changed files with 0 additions and 741 deletions

View File

@ -1,12 +0,0 @@
<?xml version="1.0"?>
<ivysettings>
<settings defaultResolver="repositories"/>
<resolvers>
<chain name="repositories">
<ibiblio name="ibiblio" m2compatible="true"/>
<ibiblio name="sonatype" root="http://repo.maven.apache.org/maven2/" m2compatible="true"/>
<ibiblio name="clojars" root="http://clojars.org/repo/" m2compatible="true"/>
<ibiblio name="conjars" root="http://conjars.org/repo/" m2compatible="true"/>
</chain>
</resolvers>
</ivysettings>

View File

@ -1,8 +0,0 @@
<?xml version="1.0"?>
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="redstorm" module="storm-deps"/>
<dependencies>
<dependency org="org.apache.storm" name="storm-core" rev="0.9.1-incubating" conf="default" transitive="true" />
<override org="org.slf4j" module="slf4j-log4j12" rev="1.6.3"/>
</dependencies>
</ivy-module>

View File

@ -1,16 +0,0 @@
<?xml version="1.0"?>
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="redstorm" module="topology-deps"/>
<dependencies>
<dependency org="org.jruby" name="jruby-core" rev="1.7.11" conf="default" transitive="true"/>
<dependency org="org.jruby" name="jruby-stdlib" rev="1.7.11" conf="default" transitive="true"/>
<!-- explicitly specify jffi to also fetch the native jar. make sure to update jffi version matching jruby-core version -->
<!-- this is the only way I found using Ivy to fetch the native jar -->
<dependency org="com.github.jnr" name="jffi" rev="1.2.7" conf="default" transitive="true">
<artifact name="jffi" type="jar" />
<artifact name="jffi" type="jar" m:classifier="native"/>
</dependency>
</dependencies>
</ivy-module>

View File

@ -1,65 +0,0 @@
require 'red_storm/version'
require 'red_storm/environment'
module RedStorm
class Application
TASKS_FILE = "#{RedStorm::REDSTORM_HOME}/lib/tasks/red_storm.rake"
def self.local_storm_command(class_file, ruby_mode = nil)
src_dir = File.expand_path(File.dirname(class_file))
"java -server -Djruby.compat.version=#{RedStorm.jruby_mode_token(ruby_mode)} -cp \"#{TARGET_CLASSES_DIR}:#{TARGET_DEPENDENCY_DIR}/storm/default/*:#{TARGET_DEPENDENCY_DIR}/topology/default/*:#{src_dir}/\" redstorm.TopologyLauncher local #{class_file}"
end
def self.cluster_storm_command(storm_conf, class_file, ruby_mode = nil)
"java -client -Dstorm.conf.file=#{File.basename(storm_conf)} -Dstorm.jar=#{TARGET_CLUSTER_JAR} -Djruby.compat.version=#{RedStorm.jruby_mode_token(ruby_mode)} -cp #{TARGET_DEPENDENCY_DIR}/storm/default/*:#{TARGET_CLUSTER_JAR}:#{File.dirname(storm_conf)} redstorm.TopologyLauncher cluster #{class_file}"
end
def self.usage
puts("usage: redstorm version")
puts(" redstorm install [--JVM_VERSION] (ex.: --1.6 or --1.7) default is current JVM version")
puts(" redstorm deps")
puts(" redstorm build [--JVM_VERSION] (ex.: --1.6 or --1.7) default is current JVM version")
puts(" redstorm examples")
puts(" redstorm bundle [BUNDLER_GROUP]")
puts(" redstorm jar DIR1, [DIR2, ...]")
puts(" redstorm local [--1.8|--1.9] TOPOLOGY_CLASS_PATH")
puts(" redstorm cluster [--1.8|--1.9] [--config STORM_CONFIG_PATH] TOPOLOGY_CLASS_PATH")
exit(1)
end
# TODO: refactor args parsing... becoming a mess.
def self.run(args)
if args.size > 0
if args[0] == "version"
puts("RedStorm v#{VERSION}")
exit
elsif ["examples", "jar", "bundle", "deps", "install", "build"].include?(args[0])
load(TASKS_FILE)
Rake::Task[args.shift].invoke(args.join(":"))
exit
elsif args.size >= 2 && ["local", "cluster"].include?(args[0])
env = args.delete_at(0)
version = args.delete("--1.8") || args.delete("--1.9")
storm_conf = args.delete("--config") ? File.expand_path(args.delete_at(0)) : DEFAULT_STORM_CONF_FILE
if args.size == 1
file = args[0]
load(TASKS_FILE)
Rake::Task['launch'].invoke(env, storm_conf, version, file)
exit
end
end
end
usage
end
def self.subshell(command)
out = IO.popen(command, STDERR => STDOUT) {|io| io.read}
[!!$?.success?, out]
end
end
end

View File

@ -1,258 +0,0 @@
begin
require 'ant'
rescue
puts("error: unable to load Ant, make sure Ant is installed, in your PATH and $ANT_HOME is defined properly")
puts("\nerror details:\n#{$!}")
exit(1)
end
require 'jruby/jrubyc'
require 'red_storm/environment'
require 'red_storm/application'
module RedStorm
INSTALL_IVY_VERSION = "2.3.0"
end
task :launch, :env, :storm_conf, :ruby_mode, :class_file do |t, args|
# use ruby mode parameter or default to current interpreter version
version_token = RedStorm.jruby_mode_token(args[:ruby_mode])
command = case args[:env]
when "local"
RedStorm::Application.local_storm_command(args[:class_file], args[:ruby_mode])
when "cluster"
unless File.exist?(RedStorm::TARGET_CLUSTER_JAR)
puts("error: cluster jar file #{RedStorm::TARGET_CLUSTER_JAR} not found. Generate it using $redstorm jar DIR1 [DIR2, ...]")
exit(1)
end
unless File.exist?(args[:storm_conf])
puts("error: Storm config file #{args[:storm_conf]} not found. Create it or supply alternate path using $redstorm cluster --config STORM_CONFIG_PATH ...")
exit(1)
end
RedStorm::Application.cluster_storm_command(args[:storm_conf], args[:class_file], args[:ruby_mode])
end
puts("launching #{command}")
unless system(command)
puts($!)
end
end
task :clean do
ant.delete 'dir' => RedStorm::TARGET_DIR
end
task :clean_jar do
ant.delete 'file' => RedStorm::TARGET_CLUSTER_JAR
end
task :setup do
puts("\n--> Setting up target directories")
ant.mkdir 'dir' => RedStorm::TARGET_DIR
ant.mkdir 'dir' => RedStorm::TARGET_CLASSES_DIR
ant.mkdir 'dir' => RedStorm::TARGET_DEPENDENCY_DIR
ant.mkdir 'dir' => RedStorm::TARGET_SRC_DIR
ant.mkdir 'dir' => RedStorm::TARGET_GEM_DIR
ant.mkdir 'dir' => RedStorm::TARGET_SPECS_DIR
ant.path 'id' => 'classpath' do
fileset 'dir' => RedStorm::TARGET_DEPENDENCY_DIR
fileset 'dir' => RedStorm::TARGET_CLASSES_DIR
end
end
desc "install dependencies and compile proxy classes"
task :install, [:jvm_version] => [:deps, :build] do |t, args|
puts("\nRedStorm install completed. All dependencies installed in #{RedStorm::TARGET_DIR}")
end
desc "locally install examples"
task :examples do
if File.identical?(RedStorm::SRC_EXAMPLES, RedStorm::DST_EXAMPLES)
STDERR.puts("error: cannot copy examples into itself")
exit(1)
end
if File.exist?(RedStorm::DST_EXAMPLES)
STDERR.puts("error: directory #{RedStorm::DST_EXAMPLES} already exists")
exit(1)
end
puts("\n--> Installing examples into #{RedStorm::DST_EXAMPLES}")
FileUtils.mkdir(RedStorm::DST_EXAMPLES)
FileUtils.cp_r(Dir["#{RedStorm::SRC_EXAMPLES}/*"], RedStorm::DST_EXAMPLES)
end
task :copy_red_storm do
FileUtils.cp_r(RedStorm::REDSTORM_LIB_DIR, RedStorm::TARGET_DIR)
end
desc "compile JRuby and Java proxy classes"
task :build, [:jvm_version] => [:setup, :copy_red_storm] do |t, args|
jvm_version = args[:jvm_version].to_s =~ /--(1.\d)/ ? $1 : RedStorm.java_runtime_version
# compile the JRuby proxy classes to Java
build_jruby("#{RedStorm::REDSTORM_LIB_DIR}/red_storm/proxy")
# compile the generated Java proxy classes
build_java_dir("#{RedStorm::TARGET_SRC_DIR}", jvm_version)
# generate the JRuby topology launcher
build_jruby("#{RedStorm::REDSTORM_LIB_DIR}/red_storm/topology_launcher.rb")
# compile the JRuby proxy classes
build_java_dir("#{RedStorm::REDSTORM_JAVA_SRC_DIR}", jvm_version)
# compile the JRuby proxy classes
build_java_dir("#{RedStorm::TARGET_SRC_DIR}", jvm_version)
end
desc "package topology gems into #{RedStorm::TARGET_GEM_DIR}"
task :bundle, [:groups] => :setup do |t, args|
require 'bundler'
defaulted_args = {:groups => 'default'}.merge(args.to_hash.delete_if{|k, v| v.to_s.empty?})
groups = defaulted_args[:groups].split(':').map(&:to_sym)
Bundler.definition.specs_for(groups).each do |spec|
next if spec.name == 'bundler'
# try to avoid infinite recursion
next if RedStorm::TARGET_GEM_DIR.start_with?(spec.full_gem_path)
destination_path = "#{RedStorm::TARGET_GEM_DIR}/#{spec.full_name}"
next if File.directory?(destination_path)
puts("installing gem #{spec.full_name} into #{destination_path}")
# copy the actual gem dir
FileUtils.cp_r(spec.full_gem_path, destination_path)
# copy the evaluated gemspec into the specifications/ dir (we
# may not have enough info to reconstruct once we delete the
# .git directory)
File.open(File.join(RedStorm::TARGET_SPECS_DIR, File.basename(spec.loaded_from)), 'w'){|f| f.write(spec.to_ruby)}
# strip the .git directory from git dependencies, it can be huge
FileUtils.rm_rf("#{destination_path}/.git")
end
end
namespace :ivy do
task :download do
mkdir_p RedStorm::DST_IVY_DIR
ant.get({
'src' => "http://repo1.maven.org/maven2/org/apache/ivy/ivy/#{RedStorm::INSTALL_IVY_VERSION}/ivy-#{RedStorm::INSTALL_IVY_VERSION}.jar",
'dest' => "#{RedStorm::DST_IVY_DIR}/ivy-#{RedStorm::INSTALL_IVY_VERSION}.jar",
'usetimestamp' => true,
})
end
task :install => :download do
ant.path 'id' => 'ivy.lib.path' do
fileset 'dir' => RedStorm::DST_IVY_DIR, 'includes' => '*.jar'
end
ant.taskdef({
'resource' => "org/apache/ivy/ant/antlib.xml",
'classpathref' => "ivy.lib.path",
#'uri' => "antlib:org.apache.ivy.ant",
})
end
end
task :ivy_config do
ant.configure 'file' => File.exists?(RedStorm::CUSTOM_IVY_SETTINGS) ? RedStorm::CUSTOM_IVY_SETTINGS : RedStorm::DEFAULT_IVY_SETTINGS
end
task :storm_deps => ["ivy:install", :ivy_config] do
puts("\n--> Installing Storm dependencies")
ant.resolve 'file' => File.exists?(RedStorm::CUSTOM_IVY_STORM_DEPENDENCIES) ? RedStorm::CUSTOM_IVY_STORM_DEPENDENCIES : RedStorm::DEFAULT_IVY_STORM_DEPENDENCIES
ant.retrieve 'pattern' => "#{RedStorm::TARGET_DEPENDENCY_DIR}/storm/[conf]/[artifact](-[classifier])-[revision].[ext]", 'sync' => "true"
end
task :topology_deps => ["ivy:install", :ivy_config] do
puts("\n--> Installing topology dependencies")
ant.resolve 'file' => File.exists?(RedStorm::CUSTOM_IVY_TOPOLOGY_DEPENDENCIES) ? RedStorm::CUSTOM_IVY_TOPOLOGY_DEPENDENCIES : RedStorm::DEFAULT_IVY_TOPOLOGY_DEPENDENCIES
ant.retrieve 'pattern' => "#{RedStorm::TARGET_DEPENDENCY_DIR}/topology/[conf]/[artifact](-[classifier])-[revision].[ext]", 'sync' => "true"
end
desc "install storm and topology dependencies in #{RedStorm::TARGET_DEPENDENCY_DIR}"
task :deps => ["ivy:install", :ivy_config, :storm_deps, :topology_deps] do
end
desc "copies topology resource files into the #{RedStorm::TARGET_CLASSES_DIR} directory"
task :cp_resources, [:include_dir] do |t, args|
if args[:include_dir]
dirs = args[:include_dir].split(":")
#add any resources/ dir in the tree in the jar root - requirement for ShellBolt multilang resources
all_resource_dirs = dirs.map do |dir|
Dir.glob("#{dir}/**/resources")
end
FileUtils.cp_r(all_resource_dirs.flatten, RedStorm::TARGET_CLASSES_DIR, verbose: true)
end
end
desc "generate #{RedStorm::TARGET_CLUSTER_JAR}"
task :jar, [:include_dir] => [:clean_jar, :cp_resources] do |t, args|
puts("\n--> Generating JAR file #{RedStorm::TARGET_CLUSTER_JAR}")
ant.jar 'destfile' => RedStorm::TARGET_CLUSTER_JAR do
# rejar all topology jars
Dir["target/dependency/topology/default/*.jar"].each do |jar|
puts("Extracting #{jar}")
zipfileset 'src' => jar, 'includes' => "**/*", 'excludes' => '**/META-INF/*.SF,**/META-INF/*.DSA,**/META-INF/*.RSA,**/META-INF/SIG-*'
end
fileset 'dir' => RedStorm::TARGET_DIR do
include 'name' => "gems/**"
end
fileset 'dir' => RedStorm::TARGET_CLASSES_DIR
# red_storm.rb and red_storm/* must be in root of jar so that "require 'red_storm'"
# in bolts/spouts works in jar context
fileset 'dir' => RedStorm::TARGET_LIB_DIR do
exclude 'name' => "tasks/**"
end
if args[:include_dir]
dirs = args[:include_dir].split(":")
# include complete source dir tree (note we don't care about potential duplicated resources dir)
fileset 'dir' => RedStorm::CWD do
dirs.each{|dir| include 'name' => "#{dir}/**/*"}
end
end
manifest do
attribute 'name' => "Main-Class", 'value' => "redstorm.TopologyLauncher"
end
end
puts("\nRedStorm generated JAR file #{RedStorm::TARGET_CLUSTER_JAR}")
end
def build_java_dir(source_folder, jvm_version)
puts("\n--> Compiling Java for JVM #{jvm_version}")
ant.javac(
'srcdir' => source_folder,
'destdir' => RedStorm::TARGET_CLASSES_DIR,
'classpathref' => 'classpath',
'source' => jvm_version,
'target' => jvm_version,
'debug' => "yes",
'includeantruntime' => "no",
'verbose' => false,
'listfiles' => true
) do
# compilerarg :value => "-Xlint:deprecation"
# compilerarg :value => "-Xlint:unchecked"
end
end
def build_jruby(source_path)
puts("\n--> Compiling JRuby")
Dir.chdir(RedStorm::REDSTORM_HOME) do
argv = []
argv << '-t' << RedStorm::TARGET_SRC_DIR
argv << '--verbose'
argv << '--java'
Dir["#{RedStorm::TARGET_DEPENDENCY_DIR}/storm/default/*.jar"].each do |jar|
argv << '-c' << %("#{jar}")
end
argv << '-c' << %("#{RedStorm::TARGET_CLASSES_DIR}")
argv << source_path
status = JRuby::Compiler::compile_argv(argv)
end
end

View File

@ -1,15 +0,0 @@
#!/usr/bin/env ruby
#^syntax detection
site 'http://community.opscode.com/api/v1'
cookbook 'users', :git => 'git://github.com/dergachev/chef_users.git'
cookbook 'ohai', :git => 'git://github.com/opscode-cookbooks/ohai.git'
cookbook 'apt', :git => 'git://github.com/opscode-cookbooks/apt.git'
cookbook 'build-essential', :git => 'git://github.com/opscode-cookbooks/build-essential.git'
cookbook 'git', :git => 'git://github.com/opscode-cookbooks/git.git'
cookbook 'redisio', :git => 'git://github.com/brianbianco/redisio.git'
cookbook 'java', :git => 'git://github.com/opscode-cookbooks/java.git'
cookbook 'runit', :git => 'git://github.com/opscode-cookbooks/runit.git'
cookbook 'storm', :git => 'git://github.com/colinsurprenant/storm-cookbook.git'

View File

@ -1,93 +0,0 @@
SITE
remote: http://community.opscode.com/api/v1
specs:
chef_handler (1.1.4)
dmg (1.1.0)
ulimit (0.2.0)
windows (1.8.10)
chef_handler (>= 0.0.0)
yum (2.2.0)
GIT
remote: git://github.com/brianbianco/redisio.git
ref: master
sha: 4b9991591d7ad134dfbf5abeeb6e806a6f1d9aa8
specs:
redisio (1.5.0)
ulimit (>= 0.1.2)
GIT
remote: git://github.com/colinsurprenant/storm-cookbook.git
ref: master
sha: bf72057e8d1aa7a7e16e0efd29b1dedfa22a335e
specs:
storm (0.2.2)
GIT
remote: git://github.com/dergachev/chef_users.git
ref: master
sha: ae22c825c3cb284a15729a20749184b3da910b51
specs:
users (1.1.4)
GIT
remote: git://github.com/opscode-cookbooks/apt.git
ref: master
sha: 72d23842ad5997076711c7b2b25381078191df1c
specs:
apt (1.9.3)
GIT
remote: git://github.com/opscode-cookbooks/build-essential.git
ref: master
sha: df4264aad07d706f3207cb1fe2bbfa03a0b82f31
specs:
build-essential (1.4.1)
GIT
remote: git://github.com/opscode-cookbooks/git.git
ref: master
sha: 767b111a755ae05b22484fbb263992a97362e209
specs:
git (2.5.0)
build-essential (>= 0.0.0)
dmg (>= 0.0.0)
runit (>= 1.0)
windows (>= 0.0.0)
yum (>= 0.0.0)
GIT
remote: git://github.com/opscode-cookbooks/java.git
ref: master
sha: 50fc41a16bdb2c9df35ad23d0296b32372cfbc0a
specs:
java (1.11.5)
windows (>= 0.0.0)
GIT
remote: git://github.com/opscode-cookbooks/ohai.git
ref: master
sha: 631fcc820949f5cbf3db45437fb895e5e1856e97
specs:
ohai (1.1.8)
GIT
remote: git://github.com/opscode-cookbooks/runit.git
ref: master
sha: 124e59194a1fca4563ed1a8dfd517808864a6b90
specs:
runit (1.1.4)
build-essential (>= 0.0.0)
yum (>= 0.0.0)
DEPENDENCIES
apt (>= 0)
build-essential (>= 0)
git (>= 0)
java (>= 0)
ohai (>= 0)
redisio (>= 0)
runit (>= 0)
storm (>= 0)
users (>= 0)

View File

@ -1,3 +0,0 @@
source "https://rubygems.org"
gem 'librarian-chef'

View File

@ -1,61 +0,0 @@
GEM
remote: https://rubygems.org/
specs:
archive-tar-minitar (0.5.2)
chef (11.4.4)
erubis
highline (>= 1.6.9)
json (>= 1.4.4, <= 1.7.7)
mixlib-authentication (>= 1.3.0)
mixlib-cli (~> 1.3.0)
mixlib-config (>= 1.1.2)
mixlib-log (>= 1.3.0)
mixlib-shellout
net-ssh (~> 2.6)
net-ssh-multi (~> 1.1.0)
ohai (>= 0.6.0)
rest-client (>= 1.0.4, < 1.7.0)
yajl-ruby (~> 1.1)
erubis (2.7.0)
highline (1.6.19)
ipaddress (0.8.0)
json (1.7.7)
librarian (0.1.0)
highline
thor (~> 0.15)
librarian-chef (0.0.1)
archive-tar-minitar (>= 0.5.2)
chef (>= 0.10)
librarian (~> 0.1.0)
mime-types (1.23)
mixlib-authentication (1.3.0)
mixlib-log
mixlib-cli (1.3.0)
mixlib-config (1.1.2)
mixlib-log (1.6.0)
mixlib-shellout (1.1.0)
net-ssh (2.6.7)
net-ssh-gateway (1.2.0)
net-ssh (>= 2.6.5)
net-ssh-multi (1.1)
net-ssh (>= 2.1.4)
net-ssh-gateway (>= 0.99.0)
ohai (6.16.0)
ipaddress
mixlib-cli
mixlib-config
mixlib-log
mixlib-shellout
systemu
yajl-ruby
rest-client (1.6.7)
mime-types (>= 1.16)
systemu (2.5.2)
thor (0.18.1)
yajl-ruby (1.1.0)
PLATFORMS
ruby
DEPENDENCIES
librarian-chef

View File

@ -1,30 +0,0 @@
# Vagrant/Chef single node Storm cluster VM
Installs Java, Storm and Redis.
Redirects these ports on local Virtualbox VM:
- 8080 for Storm UI
- 6627 for Storm Nimbus Thrift for topology submissions
- 6379 for Redis
# Install
- install vagrant
- `$ vagrant plugin install vagrant-omnibus` see https://github.com/schisamo/vagrant-omnibus
- `$ vagrant plugin install vagrant-aws` see https://github.com/mitchellh/vagrant-aws
- MRI Ruby required, JRuby cannot install the gems
- `$ bundle install`
- `$ bundle exec librarian-chef install`
- edit databags/users/storm.json
- edit storm options in Vagranfile
# Local Virtualbox usage
- `$ vagrant up dev`
- `$ ssh storm@localhost -p 2222`
# EC2 usage
- edit EC2 options in Vagrantfile
- `$ vagrant up prod --provider=aws`

167
vagrant/Vagrantfile vendored
View File

@ -1,167 +0,0 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# @param swap_size_mb [Integer] swap size in megabytes
# @param swap_file [String] full path for swap file, default is /swapfile1
# @return [String] the script text for shell inline provisioning
def create_swap(swap_size_mb, swap_file = "/swapfile1")
<<-EOS
if [ ! -f #{swap_file} ]; then
echo "Creating #{swap_size_mb}mb swap file=#{swap_file}. This could take a while..."
dd if=/dev/zero of=#{swap_file} bs=1024 count=#{swap_size_mb * 1024}
mkswap #{swap_file}
chmod 0600 #{swap_file}
swapon #{swap_file}
if ! grep -Fxq "#{swap_file} swap swap defaults 0 0" /etc/fstab
then
echo "#{swap_file} swap swap defaults 0 0" >> /etc/fstab
fi
fi
EOS
end
# execute chef provisionning with environment specific configs
# this is an attempt to DRY up the dev/prod provisionning
# @param chef [Object] the chef provisionner, see Vagrant doc
# @param env [Symbol] the environment symbol, :dev, :prod, etc
def provision(chef, env)
# provision = lambda do |chef|
# chef.log_level = :debug
chef.cookbooks_path = ["./cookbooks"]
chef.roles_path = ["./roles"]
chef.data_bags_path = ["./databags"]
# setup users (from data_bags/users/*.json)
chef.add_recipe "users::sysadmins" # creates users and sysadmin group
chef.add_recipe "users::sysadmin_sudo" # adds %sysadmin group to sudoers
chef.add_recipe "ohai"
chef.add_recipe "apt"
chef.add_recipe "build-essential"
chef.add_recipe "git"
chef.add_recipe "redisio::install"
chef.add_recipe "redisio::enable"
chef.add_recipe "runit"
chef.add_recipe "java"
chef.add_recipe "storm::singlenode"
chef.json = {
:java => {
:oracle => {
"accept_oracle_download_terms" => true
},
:install_flavor => "openjdk",
:jdk_version => "7",
},
:storm => {
:version => "0.9.1-incubating",
:deploy => {
:user => "storm",
:group => "storm",
},
},
}
case env
when :dev
chef.json[:storm].merge!({
:nimbus => {
:host => "localhost",
:childopts => "-Xmx128m",
},
:supervisor => {
:hosts => ["localhost"],
:childopts => "-Xmx128m",
},
:worker => {
:childopts => "-Xmx128m",
},
:ui => {
:childopts => "-Xmx128m",
},
})
when :prod
chef.json[:storm].merge!({
:nimbus => {
:host => "localhost",
:childopts => "-Xmx768m",
},
:supervisor => {
:hosts => ["localhost"],
:childopts => "-Xmx256m",
},
:worker => {
:childopts => "-Xmx4096m -Xms4096m",
},
:ui => {
:childopts => "-Xmx768m",
},
})
else
raise("invalid env=#{env.inspect}")
end
end
# use version 2 config object
Vagrant.configure("2") do |config|
config.ssh.forward_agent = true
config.vm.define :prod do |prod|
prod.vm.box = "dummy"
prod.ssh.username = "ubuntu"
prod.vm.provider :aws do |aws, override|
aws.access_key_id = ENV["ACCESS_KEY_ID"]
aws.secret_access_key = ENV["SECRET_ACCESS_KEY"]
aws.keypair_name = ENV["KEYPAIR_NAME"]
override.ssh.private_key_path = ENV["PRIVATE_KEY_PATH"]
aws.ami = "ami-0cdf4965" # Ubuntu 12.10, us-east-1, 64bits, ebs root
aws.instance_type = "m1.large"
aws.region = "us-east-1"
aws.tags = {"Name" => "redstorm_cluster"}
aws.security_groups = ["storm", "ssh"]
end
# TODO on EC2, add swap on ephemeral device not ebs boot
prod.vm.provision :shell, :inline => create_swap(1024, "/mnt/swapfile1")
prod.vm.provision :chef_solo do |chef|
provision(chef, :prod)
end
end
config.vm.define :dev do |dev|
dev.vm.box = "precise-amd64"
dev.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
# storm ui
dev.vm.network :forwarded_port, :guest => 8080, :host => 8080
# storm numbus thrift
dev.vm.network :forwarded_port, :guest => 6627, :host => 6627
# storm drpc
dev.vm.network :forwarded_port, :guest => 3772, :host => 3772
# redis
dev.vm.network :forwarded_port, :guest => 6379, :host => 6379
dev.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", 1536]
end
dev.vm.provision :shell, :inline => create_swap(256)
dev.vm.provision :chef_solo do |chef|
provision(chef, :dev)
end
end
# vagrant-omnibus plugin: auto install/upgrate chef
config.omnibus.chef_version = "10.18.2"
end

View File

@ -1,13 +0,0 @@
{
"groups": [
"sysadmin"
],
"comment": "Storm User",
"password": "xxx",
"ssh_keys": [
"xxx"
],
"id": "storm",
"shell": "/bin/bash"
}