Skip to content

Instantly share code, notes, and snippets.

@bakins
bakins / Rockfile
Last active December 16, 2015 00:39
rock https://raw.github.com/Neopallium/lua-pb/master/lua-pb-scm-0.rockspec
rock git https://github.com/bakins/lua-resty-riak refactor
local _M = {}
local cjson = require "cjson"
local mysql = require "resty.mysql"
local math = require "math"
local encode = cjson.encode
local random = math.random
local insert = table.insert
@bakins
bakins / nginx.init
Last active December 15, 2015 04:09
Simple nginx init script for ubuntu
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
name "COMODO"
version "0.1.0"
dependencies ["openssl"]
certificate = "-----BEGIN CERTIFICATE-----
MIIE/DCCA+SgAwIBAgIQFpDDKbZ4BgdRHwWwNEhGyzANBgkqhkiG9w0BAQUFADBv
MQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFk
ZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBF
eHRlcm5hbCBDQSBSb290MB4XDTEwMDQxNjAwMDAwMFoXDTIwMDUzMDEwNDgzOFow
~ stack level too deep - (SystemStackError)
/usr/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `polyglot_original_require'
/usr/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `polyglot_original_require'
/usr/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
/usr/lib/ruby/gems/1.8/gems/bunny-0.6.0/lib/bunny.rb:62:in `setup'
/usr/lib/ruby/gems/1.8/gems/bunny-0.6.0/lib/bunny.rb:34:in `new'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.0/lib/chef/index_queue/amqp_client.rb:43:in `amqp_client'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.0/lib/chef/index_queue/amqp_client.rb:72:in `queue_for_object'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.0/lib/chef/index_queue/indexable.rb:95:in `publish_object'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.0/lib/chef/index_queue/indexable.rb:74:in `add_to_index'
/usr/lib/ruby/1.8/rubygems.rb:827:in `report_activate_error': Could not find RubyGem json_pure (>= 0) (Gem::LoadError)
from /usr/lib/ruby/1.8/rubygems.rb:261:in `activate'
from /usr/lib/ruby/1.8/rubygems.rb:68:in `gem'
from /usr/lib/ruby/1.8/merb-core/bootloader.rb:419:in `enable_json_gem'
from /usr/lib/ruby/1.8/merb-core/bootloader.rb:392:in `run'
from /usr/lib/ruby/1.8/merb-core/bootloader.rb:99:in `run'
from config.ru:13
from /var/lib/gems/1.8/gems/rack-1.3.0/lib/rack/builder.rb:51:in `instance_eval'
from /var/lib/gems/1.8/gems/rack-1.3.0/lib/rack/builder.rb:51:in `initialize'
from config.ru:1:in `new'
service "nginx" do
supports :status => true, :restart => true, :reload => true
action :enable
end
ruby_block "start nginx service" do
block do
true
end
action :create
knife node show lsds1ngx12.turner.com -a scope
{
"scope": "prod"
}
knife search node "scope:prod" -i | grep lsds1ngx12
nothing!
apt_repository "lua-turner" do
uri "http://#{node[:ubuntu][:turner_repo]}/repos/lua"
distribution node['lsb']['codename']
components ["main"]
key "http://#{node[:ubuntu][:turner_repo]}/repos/lua/turner-lua-repo.key"
action :nothing
end
@bakins
bakins / gist:810046
Created February 3, 2011 19:47
error in search
[Thu, 03 Feb 2011 14:47:07 -0500] INFO: Starting Chef Run (Version 0.9.12)
[Thu, 03 Feb 2011 14:47:08 -0500] INFO: Storing updated cookbooks/lsd/recipes/moxi.rb in the cache.
[Thu, 03 Feb 2011 14:47:11 -0500] INFO: Ran execute[apt-get update] successfully
[Thu, 03 Feb 2011 14:47:11 -0500] INFO: scope:prod AND datacenter:sdc AND roles:membase
[Thu, 03 Feb 2011 14:47:12 -0500] WARN: HTTP Request Returned 500 Internal Server Error: Net::HTTPServerException: 400 "orgapachelucenequeryParserParseException_Cannot_parse_scopeprod_AND_run_listrolelsdweb_Encountered_____at_line_1_column_36_Was_expecting_one_of_____TO______RANGEIN_QUOTED______RANGEIN_GOOP______"
[Thu, 03 Feb 2011 14:47:12 -0500] ERROR: Running exception handlers
[Thu, 03 Feb 2011 14:47:12 -0500] ERROR: Exception handlers complete
/usr/lib/ruby/1.8/net/http.rb:2101:in `error!': 500 "Internal Server Error" (Net::HTTPFatalError)
from /usr/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/rest.rb:233:in `api_request'
from /usr/lib/ruby/gems