This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The recipe that calls the method | |
Chef::Log.info elb_name(node) | |
ruby_block "register_with_elb" do | |
block do | |
require 'AWS' | |
if associate_elastic_ip # Make sure it has a white listed elastic IP | |
unless production_primary_backendapp? # Production Primary backend app does not need to be on the load balancer any more. | |
ec2 = AWS::ELB::Base.new(:access_key_id => "yyyyyy", :secret_access_key => "xxxx") | |
ec2.register_instances_with_load_balancer(:load_balancer_name => "#{elb_name(node)}", :instances => ["#{node[:ec2][:instance_id]}"] ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bash "Add AWS alert" do | |
code <<-EOH | |
export JAVA_HOME="/usr/lib/jvm/java-6-sun"export PATH=/usr/lib/cloudwatch-api-tools/bin:$PATH | |
export AWS_CLOUDWATCH_HOME=/usr/lib/cloudwatch-api-tools | |
export AWS_CREDENTIAL_FILE=$AWS_CLOUDWATCH_HOME/credential-file-path.template | |
mon-put-metric-alarm xxx | |
EOH | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/ruby | |
# | |
# watch for bloating passengers and kill them gracefully if possible (SIGUSR), then with extreme prejudice (SIGTERM) | |
# | |
require 'yaml' | |
require 'rubygems' | |
require 'syslog_logger' | |
logger = SyslogLogger.new("passenger") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person < MassiveRecord::ORM::Table | |
references_one :boss, :class_name => "Person", :store_in => :info | |
references_one :attachment, :polymorphic => true | |
references_many :friends, :store_in => :info | |
references_many :cars, :records_starts_from => :cars_start_id | |
... | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2yyyyyyyyyyyyyyyyyyy3 tp.xxx.be [19/Mar/2011:23:16:28 +0000] 86.2.225.249 - F560A060C8BFDD0F REST.GET.OBJECT promo.gif "GET /promo.gif?network_user_id=jx98jWw2svXgQHYGppoTbg.z1zihgrrY-GvVVZBvAo5Zw&partner_config_hash=079c9241875af0c6eeeebd2a939051ddf9f666d3&activity_id=&d=1300576594166&r=98411662.5067439 HTTP/1.1" 200 - 35 35 4 3 "http://facebook.mafiawars.com/mwfb/iframe_proxy.php?target=Promo&encUID=jx98jWw2svXgQHYGppoTbg.z1zihgrrY-GvVVZBvAo5Zw" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15" - | |
2yyyyyyyyyyyyyyyyyyy3 tp.xxx.be [19/Mar/2011:23:16:28 +0000] 87.0.220.155 - 3537C9B2A475233C REST.GET.OBJECT promo.gif "GET /promo.gif?network_user_id=bIfjJh5ilZavnGuSs1tb8GbSkfg&partner_config_hash=6411626cd4898b0d37e14226bd832eefbd7faf1a&activity_id=&d=1300576585429&r=34975610.52439378 HTTP/1.1" 200 - 35 35 5 4 "http://fb-tc-3.farmville.com/promo.php?eId=bIfjJh5ilZavnGuSs1tb8GbSkfg" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB6.6; SLCC1; .NET CLR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this works: | |
ruby_block "register_with_elb" do | |
require 'AWS' | |
ec2 = AWS::ELB::Base.new(:access_key_id => "xxxxxx", :secret_access_key => "yyyy") | |
block do | |
ec2.register_instances_with_load_balancer(:load_balancer_name => "integration-svnetwork-app", :instances => ["#{@node[:ec2][:instance_id]}"] ) | |
end | |
not_if registered_with_load_balancer?(:ec2 => ec2).to_s | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"chef": { | |
"server_url": "http://chef.example.com:4000", | |
"url_type": "http", | |
"init_style": "runit", | |
"path": "/srv/chef", | |
"serve_path": "/srv/chef" | |
}, | |
"run_list": [ "recipe[chef::bootstrap_client]" ] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# inspiration | |
# http://github.com/jnstq/rails-nginx-passenger-ubuntu | |
# sudo this sudo that bollocks | |
sudo -i | |
# system-related stuff | |
apt-get install htop strace sysstat | |
dpkg-reconfigure sysstat | |
apt-get install ntp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PATH=/opt/ruby-enterprise/lib/ruby/gems/1.8/bin:/opt/ruby-enterprise/bin:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin | |
exec 2>&1 | |
#exec /usr/bin/env chef-client -i 1800 -s 20 | |
exec /opt/ruby-enterprise/bin/chef-client -i 1800 -s 20 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2011-02-11_00:36:46.25591 sh: Syntax error: "(" unexpected | |
2011-02-11_00:36:46.26345 sh: Syntax error: "(" unexpected | |
2011-02-11_00:36:46.28291 sh: Syntax error: "(" unexpected | |
2011-02-11_00:36:46.28892 sh: Syntax error: "(" unexpected | |
2011-02-11_00:36:46.31942 sh: Syntax error: "(" unexpected | |
2011-02-11_00:36:46.32716 sh: Syntax error: "(" unexpected | |
2011-02-11_00:36:46.33490 sh: Syntax error: "(" unexpected | |
2011-02-11_00:36:46.34335 sh: Syntax error: "(" unexpected | |
2011-02-11_00:36:46.35729 sh: Syntax error: "(" unexpected | |
2011-02-11_00:36:46.36506 sh: Syntax error: "(" unexpected |