octochan
github.com
curlで叩くとGitHubのIssueにコメントするやつ。Ikachan for GitHub。
Sinatraベースで、以下のように config.ru
を書くと動く。アクセス制限とかは別のRack Middlewareでやってください。
require 'octochan'
module PB
class GitHub < Octochan::App
set :access_token, '......'
end
class GHE < Octochan::App
set :access_token, '.....'
set :api_root, 'https://your.ghe.local/api/v3'
end
end
map '/github' do
run PB::GitHub
end
map '/ghe' do
run PB::GHE
end
run lambda {|e| [404, {'Content-Type' => 'text/plain'}, ["Please Access /github or /ghe"]] }
populus
github.com
Consulの様々なeventにフックして何かするやつを作るフレームワークのはずだった。
Populus.watch :event, name: "echo" do
cond {|data| data.any?{|d| d.has_key?('Payload')} }
runs do |data|
event = data.find{|d| d.has_key?('Payload')}
Populus.logger.info Base64.decode64(event['Payload'])
end
end
全面的に設計を見直したい感があり、いまのところ -type event
しかサポートしていない。今年は何かが起こる。
soko
github.com
プラットフォームアグノースティックなサーバメタデータのリポジトリみたいなのを1行で操作するやつ。
ConsulのKVSとかAWSのタグとかをストレージに指定できるようにしてある。
$ ./soko put Test Hello
OK
$ ./soko get Test
Hello
結局自分で使っていないという問題があり、仕事で構築しているやつもなんか直接 nova
コマンドを叩いているまま。この知見をなんかに生かせるだろうか?
packer-provisioner-serverspec
github.com
Packerで作ったイメージについて、イメージ化の直前にServerspecを走らせ、正しくイメージになってるかどうか検査できるやつ。
いまのところOmnibusでServerspecを入れてExecモード前提で動作する。これ、たとえばSSHに必要な情報ってぶっちゃけPackerが全部持ってるよね(だからなんとかしてSSHモードでも動かせるはずだよね)とか、いろいろオプションを追加する余地がある。誰か頼む、じゃなかった今年は何かする。
{
"builders" : [
{
"type": "amazon-ebs",
"ssh_username": "centos", // should be sudoable
"ssh_pty": true, // tty should be available after packer 0.8
//...
}
],
"provisioners": [
{
"type": "shell",
"script": "/path/to/your-provisoner.sh"
},
{
"type": "serverspec",
"source_path": "/path/to/your/serverspec-root"
}
]
}
monkfish
github.com
OpenStack Compute APIから、今のテナントに所属しているサーバ一覧を引っ張って、その情報をもとに /etc/hosts
を更新し、内部DNSと替えさせていただきますというやつ。DHCPなどがアレな構成でも安心。
もともとのアイディアはkurodaさんという人のPerlによるスクリプトです。
beforedo
github.com
プロジェクトセットアップのためのツール。Railsとかによくある bin/bootstrap.sh
みたいな環境構築スクリプト、シェルスクリプトなので同じような表現がたくさん出てくるな〜と思ってそんならツールにしようと思って書いたが、使っていないのが問題。。。
以下のような Before.yaml
を書いてコマンドを打つと、書いてある通りのいい感じのセットアップをしてくれる。基本的にはべき等。ポート空いてるとか、プロセスがいるとかを見てべき等っぽさを確保してくれる。
- task: mysql.server start
port: 3306
- task: memcached -p 11211 -m 64m -d
port: 11211
- task: bundle install --path vendor/bundle
success: bundle check
- task: cp config/database.yml.sample config/database.yml
file: config/database.yml
- task: bundle exec rake db:migrate
always: true
- task: bundle exec rails s
front: true
fluent-plugin-json_expander
github.com
matsumotolyさん? そんな感じのIDの人のために書いたやつ。タグでexpandするやつはすでにあるが、こっちはデータのボディの属性をもとに別のoutputを展開する。
やや内部実装がハッキーなので、利用する際は修正のプルリクをやっていく気持ちが必要と思う。プルリクお待ちしています。
<match access.summary>
type json_expander
subtype growthforecast
delete_used_key false # or true if you want to delete the key
# used in template construction
<template>
gfapi_url http://127.0.0.1:5125/api/
graph_path ${data[mothor_host]}/${data[vhost]}/${key_name}
name_keys count_2xx,count_3xx,count_4xx,count_5xx
</template>
</match>
puppet-report_slack2
github.com
Puppet masterのSlackレポーター。すでにあるやつは多分なんかgemの関係で動かなかったので、依存をギリギリまで減らして自作した。今思い出したけど Puppetアドベントカレンダー で紹介し忘れてたじゃん!
なんか海外で地味に使われているのを感じる。英語の問い合わせが僕のメアドに直接来たりした。
yao
github.com
何度か紹介してるからいいか... Yet Another Openstack client for Ruby。
stackspec
github.com
awspecの...アレ。OpenStackのテナントが思った通りに構築できているか、APIを叩いて確認する。yaoのリソースのメソッドを知っていればそのまま使える感じの設計のはずが、まだ Server
しか検査できないので頑張ります。。
describe server('stackspec.example.com') do
its(:name) { should eq 'stackspec.example.com' }
its(:key_name) { should eq 'sample001' }
its(:security_groups) { should have(4).security_groups }
it { should have_security_group(name: "https") }
its('flavor.id') { should eq '8' }
end
$ rspec spec/tenant_name/servers_spec.rb
OpenStack server "stackspec.example.com"
should have security group {:name=>"https"}
name
should eq "stackspec.example.com"
key_name
should eq "sample001"
security_groups
should have 4 security_groups
flavor.id
should eq "8"
Finished in 2.36 seconds (files took 0.2018 seconds to load)
5 examples, 0 failures
今年はもっとでかいの作りたかった。あと改善するというやつもやりたいところだった。
まあ、いろいろ作ると思います。
あ、スター、プルリク、人柱等お願いします!!1