Skip to content

Instantly share code, notes, and snippets.

@dmdeklerk
Last active December 20, 2015 00:29
Show Gist options
  • Save dmdeklerk/6041684 to your computer and use it in GitHub Desktop.
Save dmdeklerk/6041684 to your computer and use it in GitHub Desktop.
rubber-z.yml
##############################################################################################################
## This is my Vagrant file
##############################################################################################################
Vagrant.configure("2") do |config|
config.vm.box = "precise32"
config.vm.define :master do |master|
master.vm.synced_folder ".", "/vagrant" #, :nfs => true
master.vm.network :private_network, ip: "192.168.70.12"
master.vm.provision :rubber do |rubber|
rubber.rubber_env = 'production'
rubber.roles = 'redis,redis_master,resque_web,db:primary=true,web_tools'
end
end
config.vm.define :worker do |worker|
worker.vm.synced_folder ".", "/vagrant" #, :nfs => true
worker.vm.network :private_network, ip: "192.168.70.13"
worker.vm.provision :rubber do |rubber|
rubber.rubber_env = 'production'
rubber.roles = 'resque_worker'
end
end
end
##############################################################################################################
## This is my config file ... rubber-z.yml
##############################################################################################################
roles:
resque_worker:
assigned_security_groups: [resque_worker]
resque_web:
assigned_security_groups: [resque_web]
security_groups:
resque_worker:
description: "To open up port 9934,9935 (drb), 9515..9525 (chromedriver), 7050..7060"
rules:
- protocol: tcp
from_port: 9934
to_port: 9935
source_ips: [0.0.0.0/0]
- protocol: tcp
from_port: 9515
to_port: 9525
source_ips: [0.0.0.0/0]
- protocol: tcp
from_port: 80
to_port: 80
source_ips: [0.0.0.0/0]
- protocol: tcp
from_port: 8080
to_port: 8080
source_ips: [0.0.0.0/0]
resque_web:
description: "To open up port #{resque_web_port} for http server on resque_web role"
rules:
- protocol: tcp
from_port: "#{resque_web_port}"
to_port: "#{resque_web_port}"
source_ips: [0.0.0.0/0]
- protocol: tcp
from_port: "#{redis_server_port}"
to_port: "#{redis_server_port}"
source_ips: [0.0.0.0/0]
##############################################################################################################
## After running `vagrant provision worker`
## This is what iptables -L returns.. On the worker..
##############################################################################################################
>> output of `sudo iptables -L`
vagrant@worker:~$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED /* Always allow established connections to remain connected. */
ACCEPT all -- anywhere anywhere /* Enable connections on loopback devices. */
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh /* cluster_app_production_default */
DROP all -- anywhere anywhere /* Disable all other connections. */
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
vagrant@worker:~$
##############################################################################################################
## After running `vagrant provision master`
## This is what iptables -L returns.. On the master..
##############################################################################################################
vagrant@master:~$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED /* Always allow established connections to remain connected. */
ACCEPT all -- anywhere anywhere /* Enable connections on loopback devices. */
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh /* cluster_app_production_default */
ACCEPT tcp -- anywhere anywhere tcp dpt:5678 /* cluster_app_production_resque_web */
ACCEPT tcp -- anywhere anywhere tcp dpt:6379 /* cluster_app_production_resque_web */
ACCEPT tcp -- anywhere anywhere tcp dpt:http-alt /* cluster_app_production_web_tools */
ACCEPT tcp -- anywhere anywhere tcp dpt:8443 /* cluster_app_production_web_tools */
DROP all -- anywhere anywhere /* Disable all other connections. */
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
vagrant@master:~$
##############################################################################################################
## Running `cap rubber:describe_security_groups` results in..
##############################################################################################################
** Auto role: resque_worker => worker.foo.com, {:platform=>"linux", :provider=>"vagrant"}
* 2013-07-19 21:29:46 executing `rubber:describe_security_groups'
/home/dirk/.rvm/gems/ruby-1.9.2-p320/bundler/gems/rubber-313ef2d3e53e/lib/rubber/cloud/base.rb:150:in `describe_security_groups': undefined local variable or method `rubber_env' for #<Rubber::Cloud::Vagrant:0xb16faac> (NameError)
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/bundler/gems/rubber-313ef2d3e53e/lib/rubber/thread_safe_proxy.rb:13:in `method_missing'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/bundler/gems/rubber-313ef2d3e53e/lib/rubber/recipes/rubber/security_groups.rb:18:in `block (2 levels) in load'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:138:in `instance_eval'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:89:in `execute_task'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:46:in `block in execute_requested_actions'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:45:in `each'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:45:in `execute_requested_actions'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/cli/help.rb:19:in `execute_requested_actions_with_help'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:34:in `execute!'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:14:in `execute'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/bin/cap:4:in `<top (required)>'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/bin/cap:19:in `load'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/bin/cap:19:in `<main>'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/bin/ruby_noexec_wrapper:14:in `eval'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/bin/ruby_noexec_wrapper:14:in `<main>'
##############################################################################################################
## Running `cap rubber:setup_security_groups` results in..
##############################################################################################################
* 2013-07-19 21:30:57 executing `rubber:setup_security_groups'
/home/dirk/.rvm/gems/ruby-1.9.2-p320/bundler/gems/rubber-313ef2d3e53e/lib/rubber/cloud/base.rb:100:in `setup_security_groups': undefined method `split' for ["master.foo.com", "worker.foo.com"]:Array (NoMethodError)
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/bundler/gems/rubber-313ef2d3e53e/lib/rubber/thread_safe_proxy.rb:13:in `method_missing'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/bundler/gems/rubber-313ef2d3e53e/lib/rubber/recipes/rubber/security_groups.rb:11:in `block (2 levels) in load'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:138:in `instance_eval'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:89:in `execute_task'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:46:in `block in execute_requested_actions'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:45:in `each'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:45:in `execute_requested_actions'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/cli/help.rb:19:in `execute_requested_actions_with_help'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:34:in `execute!'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:14:in `execute'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.15.5/bin/cap:4:in `<top (required)>'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/bin/cap:19:in `load'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/bin/cap:19:in `<main>'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/bin/ruby_noexec_wrapper:14:in `eval'
from /home/dirk/.rvm/gems/ruby-1.9.2-p320/bin/ruby_noexec_wrapper:14:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment