Skip to content

Instantly share code, notes, and snippets.

View sawanoboly's full-sized avatar
🤷‍♂️
🙃

Yukihiko SAWANOBORI sawanoboly

🤷‍♂️
🙃
View GitHub Profile
@sawanoboly
sawanoboly / chef_and_rabbitmq_spec.rb
Last active December 25, 2015 06:09
serverspecで完結するテスト駆動インフラ構築 (Test-Driven-Infrastructure with serverspec) ref: http://qiita.com/sawanoboly/items/f2e60d69a336c426ef97
require 'spec_helper'
describe command('which chef-solo') do
it {
begin
should return_exit_status(0)
rescue => e
puts e.message
puts "======= Installing Omnibus Chef..."
cmd = Serverspec::Type::Command.new('curl -L https://www.opscode.com/chef/install.sh | sudo bash')
@sawanoboly
sawanoboly / Cheffile
Created September 26, 2013 05:45
example Cheffile of some project
#!/usr/bin/env ruby
#^syntax detection
site 'http://community.opscode.com/api/v1'
cookbook 'partial_search'
cookbook 'smartmachine_functions'
cookbook 'monit_bin'
cookbook 'smf'
@sawanoboly
sawanoboly / SAMPLE.ht_ngx_access
Last active December 23, 2015 21:29
For Opscode chef. Enjoy ngx_mruby!
192.168.2.1
192.168.2.2
@sawanoboly
sawanoboly / Gemfile
Last active December 23, 2015 17:29
Omnibus-rubyプロジェクトでツールの周辺依存をまるごとrpm,debに固める ref: http://qiita.com/sawanoboly/items/a2c258a235824b91b70f
source "https://rubygems.org"
gem 'omnibus'
@sawanoboly
sawanoboly / Pry
Last active December 23, 2015 12:09
Chefのレシピ用リソースに指定する属性のバリデーションを手軽にチェック ref: http://qiita.com/sawanoboly/items/04a22981a7436e737af4
> cron.minute "abcde"
=> "abcde"
@sawanoboly
sawanoboly / config.ru
Last active May 8, 2019 10:58
SphinxをShinatraでホストしつつGithubのOAuth経由でチーム認証をかけたが ref: http://qiita.com/sawanoboly/items/9646c4c53d442a7c6b46
require 'sinatra'
require 'sinatra_auth_github'
set :public_folder, File.dirname(__FILE__) + '/build/html'
use Rack::Session::Cookie,
:secret => Digest::SHA1.hexdigest(rand.to_s),
:expire_after => 3600
set :github_options, {
:scopes => "user",
service 'httpd' do
action :start
end
file '/tmp/hoge' do
owner 'root'
group 'root'
mode '0600'
end
@sawanoboly
sawanoboly / auth_basic.rb-action-discard
Last active December 22, 2015 13:49
実践LWRP、HTTP認証用ファイル(htpasswd,htdigest)をChefのリソースとして管理する part.3 of 3 ref: http://qiita.com/sawanoboly/items/89095877826cab27c932
require 'webrick'
def whyrun_supported?
true
end
action :create do
if @current_resource.crypted_passwd
Chef::Log.warn "====== Found http_auth user #{@new_resource.user}"
salt = @current_resource.crypted_passwd[0..1]
@sawanoboly
sawanoboly / auth_basic.rb-action_delete
Last active December 22, 2015 13:49
実践LWRP、HTTP認証用ファイル(htpasswd,htdigest)をChefのリソースとして管理する part.2 of 3 ref: http://qiita.com/sawanoboly/items/79c7cdf782d64980677d
require 'webrick'
def whyrun_supported?
true
end
action :create do
if @current_resource.crypted_passwd
Chef::Log.warn "====== Found http_auth user #{@new_resource.user}"
salt = @current_resource.crypted_passwd[0..1]
@sawanoboly
sawanoboly / .htpasswd
Last active December 22, 2015 13:49
実践LWRP、HTTP認証用ファイル(htpasswd,htdigest)をChefのリソースとして管理する part.1 of 3 ref: http://qiita.com/sawanoboly/items/9bdaebcfc98d73f84843
hoge:iLWIQVkBPUswQ