Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
DATE=`date '+%Y%m%d%H%M%S'`
echo "DATE = $DATE"
/usr/local/bin/consul kv put config/erdx/web/TRIGGER_RESTART $DATE
/usr/local/bin/consul kv put config/erdx/worker/TRIGGER_RESTART $DATE
/usr/local/bin/consul kv put config/erdx/scheduler/TRIGGER_RESTART $DATE
diff --git a/bin/docker-entrypoint b/bin/docker-entrypoint
index 6bd0707..c98f362 100755
--- a/bin/docker-entrypoint
+++ b/bin/docker-entrypoint
@@ -1,6 +1,9 @@
#!/bin/bash
set -e
+REDASH_HTTP_IP=${REDASH_HTTP_IP:-0.0.0.0}
+REDASH_HTTP_PORT=${REDASH_HTTP_PORT:-5000}
source :rubygems
gem "test-kitchen", "< 1.0"
gem "chef", "11.0.0"
gem "knife-github-cookbooks", "0.1.8"
gem "rspec", "~> 2.12.0"
@threetee
threetee / server.rb
Created July 6, 2012 15:35
logstash::server recipe
rs_utils_marker :begin
# TODO: restrict search to servers in same environment
log "Retrieving elasticsearch server list via RightLink"
rs_utils_server_collection "elasticsearch_servers" do
tags ["cf_elasticsearch:active"]
secondary_tags 'server:private_ip_0'
action :load
end
@threetee
threetee / unicorn_wrapper.sh
Created January 20, 2012 19:52
Wrapper to allow runit to send signals to the unicorn master even when its PID changes
#!/bin/sh
set -e
APP=$1
APP_PATH="/srv/${APP}/current"
RAILS_ENV=$2
UNICORN_CONFIG="/etc/unicorn/${APP}.rb"
UNICORN_PID_FILE="/tmp/unicorn.${APP}.pid"
@threetee
threetee / count_ec2_instance_placement.sh
Created January 20, 2012 13:24
Opscode Chef - List/count EC2 instance AZ placement for your nodes with knife
#!/bin/sh
# Prints the number of nodes you have in each EC2 AZ
knife exec -E 'nodes.transform("*:*") {|n| puts "#{n.ec2.placement_availability_zone}"}' | awk '
{
for (i=1;i<=NF;i++)
count[$i]++
}
END {
for (i in count)
@threetee
threetee / gist:1114985
Created July 29, 2011 23:53
opscode platform problems
$ knife cookbook list | grep jruby
jruby 0.0.4
# on the client:
$ sudo chef-client
[Fri, 29 Jul 2011 23:47:12 +0000] INFO: *** Chef 0.10.2 ***
[Fri, 29 Jul 2011 23:47:14 +0000] INFO: Run List is <redacted>
[Fri, 29 Jul 2011 23:47:14 +0000] INFO: Run List expands to [<redacted>, jruby, <redacted>]
[Fri, 29 Jul 2011 23:47:14 +0000] INFO: Starting Chef Run for 20122424
[Fri, 29 Jul 2011 23:47:14 +0000] INFO: HTTP Request Returned 412 Precondition Failed: {"unsatisfiable_run_list_item":"(jruby >= 0.0.0)","non_existent_cookbooks":["Package [\"build-essential\", \"java\"]"],"most_constrained_cookbooks":[],"message":"Unable to satisfy constraints on cookbook [\"build-essential\", \"java\"], which does not exist, due to run list item (jruby >= 0.0.0). Run list items that may result in a constraint on [\"build-essential\", \"java\"]: [(jruby = 0.0.4) -> ([\"build-essential\", \"java\"] >= 0.0.0)]"}
@threetee
threetee / nginx_unicorn.rb
Created June 15, 2011 22:03
chef nginx_unicorn recipe (part of modified application cookbook)
app = node.run_state[:current_app]
#unicorn
include_recipe "application::unicorn"
#nginx
include_recipe "nginx::source"
#nginx/unicorn proxy
socket = "/tmp/unicorn_#{app['id']}.sock"
PoolParty core loadtime: 2.526893
provider_name = ec2
/Library/Ruby/Gems/1.8/gems/poolparty-1.6.9/bin/../lib/poolparty/cloud.rb:82:in `constantize': wrong number of arguments (1 for 0) (ArgumentError)
from /Library/Ruby/Gems/1.8/gems/poolparty-1.6.9/bin/../lib/poolparty/cloud.rb:82:in `using'
from ./clouds.rb:3
from /Library/Ruby/Gems/1.8/gems/poolparty-1.6.9/bin/../lib/poolparty/base.rb:13:in `instance_eval'
from /Library/Ruby/Gems/1.8/gems/poolparty-1.6.9/bin/../lib/poolparty/base.rb:13:in `initialize'
from /Library/Ruby/Gems/1.8/gems/poolparty-1.6.9/bin/../lib/poolparty/pool.rb:7:in `new'
from /Library/Ruby/Gems/1.8/gems/poolparty-1.6.9/bin/../lib/poolparty/pool.rb:7:in `cloud'
from ./clouds.rb:2
pool "myapp" do
cloud "app" do
using :ec2
instances 1..1
security_group do
authorize :from_port => 22, :to_port => 22
end
end
end