Skip to content

Instantly share code, notes, and snippets.

View lorentzca's full-sized avatar
🏕️
In the Woods.

Kohta Kunishima lorentzca

🏕️
In the Woods.
View GitHub Profile
@lorentzca
lorentzca / config.json
Last active January 29, 2016 08:53
consul server用設定
{
"bootstrap_expect": 1 ,
"server": true,
"data_dir": "/var/consul",
"bind_addr": "127.0.0.1",
"client_addr": "0.0.0.0"
}
@lorentzca
lorentzca / Dockerfile
Last active January 15, 2016 08:36
consul on centos5.11
FROM centos:5.11
RUN \
yum install -y curl wget unzip && \
wget --no-check-certificate -O consul.zip https://releases.hashicorp.com/consul/0.6.0/consul_0.6.0_linux_amd64.zip && \
unzip consul.zip && \
rm -f consul.zip && \
mv consul /usr/local/sbin && \
chmod 755 /usr/local/sbin/consul && \
curl https://gist.githubusercontent.com/Lorentzca/98c7e00b3313155a53e2/raw/consul > /etc/init.d/consul && \
@lorentzca
lorentzca / my_box.json
Created January 7, 2016 02:03
Create a Vagrant Box from an existing Virtualbox image
{
"builders": [
{
"type": "virtualbox-ovf",
"source_path": "my_box.ova",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"shutdown_command": "echo 'vagrant' | sudo -S /sbin/shutdown -h now"
}
],
@lorentzca
lorentzca / my_ami.json
Created January 7, 2016 03:19
create ami with packer
{
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
"aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}"
},
"builders": [
{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
@lorentzca
lorentzca / install_mha4mysql-manager.sh
Last active February 2, 2016 02:39
install mha4mysq (centos5)
#!/bin/sh
# install depend packages
sudo yum install -y epel-release wget
sudo yum install -y perl-DBD-MySQL
sudo yum install --enablerepo=epel -y perl-Config-Tiny perl-Log-Dispatch perl-Parallel-ForkManager
# install mha-node
wget --no-check-certificate -O /tmp/mha4mysql-node-0.56-0.el5.noarch.rpm https://72003f4c60f5cc941cd1c7d448fc3c99e0aebaa8.googledrive.com/host/0B1lu97m8-haWeHdGWXp0YVVUSlk/mha4mysql-node-0.56-0.el5.noarch.rpm
sudo rpm -ivh /tmp/mha4mysql-node-0.56-0.el5.noarch.rpm
@lorentzca
lorentzca / install_consul.sh
Last active February 1, 2016 06:48
install consul (centos5)
#!/bin/sh
sudo yum install -y wget unzip
# add consul binary
wget --no-check-certificate -O /tmp/consul.zip https://releases.hashicorp.com/consul/0.6.0/consul_0.6.0_linux_amd64.zip
sudo unzip /tmp/consul.zip -d /usr/local/sbin
sudo rm -f /tmp/consul.zip
sudo chmod 755 /usr/local/sbin/consul
@lorentzca
lorentzca / consul
Last active January 18, 2016 05:56
install monit (centos)
check process consul
with pidfile "/var/run/consul.pid"
start program "/etc/init.d/consul start"
stop program "/etc/init.d/consul stop"
@lorentzca
lorentzca / consul.conf
Last active January 18, 2016 05:49
consulドメインへの名前解決にdnsmasqを利用するための設定
server=/consul/127.0.0.1#8600
@lorentzca
lorentzca / master_name_failover
Last active February 22, 2017 01:56
mhaフェイルオーバー時consulのカタログデータベースを書き換えるスクリプト
#!/usr/bin/env perl
# Copyright (C) 2011 DeNA Co.,Ltd.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@lorentzca
lorentzca / kunishima.rb
Created January 21, 2016 10:46
集え我が一族
#!/usr/bin/ruby
require 'uri'
require 'open-uri'
require 'net/http'
open('http://data.iana.org/TLD/tlds-alpha-by-domain.txt') {|f|
f.each_line {|line|
next line if %r(^#) =~ line
url = "http://kunishima.#{line}"