Skip to content

Instantly share code, notes, and snippets.

@lamanotrama
lamanotrama / nginx-stream
Created February 24, 2016 04:09
なぜかリクエストの度にlookupしてくれない。streamの設定
stream {
upstream deis {
server deis-elb-01.aya.staging:2222;
}
server {
listen 2222;
# resolve ELB's hostname to IP
mruby_stream_code '
@lamanotrama
lamanotrama / nginx -V
Created February 4, 2016 11:49
my nginx -V
$nginx -V |& sed 's/ --/\n/g' nginx version: nginx/1.9.9
built by gcc 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04)
built with OpenSSL 1.0.1f 6 Jan 2014
TLS SNI support enabled
configure arguments:
prefix=/etc/nginx
sbin-path=/usr/sbin/nginx
conf-path=/etc/nginx/nginx.conf
error-log-path=/var/log/nginx/error.log
http-log-path=/var/log/nginx/access.log
@lamanotrama
lamanotrama / oauth2_proxy.conf
Created January 13, 2016 05:45
oauth2_proxy + nginx auth_requstのサンプルだよ
# please include in server context
# ref: https://github.com/bitly/oauth2_proxy#endpoint-documentation
# for checking login status.
# only returns a 202 Accepted response or a 401 Unauthorized response;
location = /oauth2/auth {
internal;
# return 202 if local request, for inftataster test
set $local 0;
@lamanotrama
lamanotrama / postinst.sh
Created November 19, 2015 06:03
postinst script of nginx
#!/bin/sh
set -e
if [ "$1" != "configure" ]; then
exit 0
fi
# Touch and set permisions on default log files on installation
if [ -z "$2" ]; then
@lamanotrama
lamanotrama / lock.txt
Created April 1, 2015 07:10
mogilefs innodb lock log
blocking_id: 727576
requesting_id: 770256
blocking_host: mogfs001.30d.lan:57789
requesting_host: mogfs002.30d.lan:55519
lock_table: `mogilefs`.`file_to_replicate`
lock_index: `nexttry`
lock_mode: X,GAP
seconds: 54
blocking_info: UPDATE file_to_replicate SET nexttry = UNIX_TIMESTAMP() + 1000 WHERE fid IN (1935286784,1935286875,1935286818,1935286831,1935286825,1935286806,1935286837,1935286813,1935286865,1935286862,1935286777,1935286856,1935286836,1935286832,1935286844,1935286797,1935286883,1935286828,1935286877,1935286874,1935286823,1935286886,1935286809,1935286849,1935286840,1935286815,1935286810,1935286847,1935286811,1935286860,1935286833,1935286838,1935286869,1935286876,1935286845,1935286814,1935286884,1935286864,1935286839,1935286881,1935286880,1935286852,1935286817,1935286853,1935286866,1935286893,1935286758,1935286834,1935286841,1935286843,1935286846,1935286873,1935286872,1935286745,1935286848,1935286821,1935286826,1935286805,1935286871,1935286879,1935286827,1935286867,19
@lamanotrama
lamanotrama / unicorn
Last active August 29, 2015 14:07 — forked from shapeshed/unicorn
#!/bin/sh
set -e
# Example init script, this can be used with nginx, too,
# since nginx and unicorn accept the same signals
# Feel free to change any of the following variables for your app:
TIMEOUT=${TIMEOUT-60}
APP_ROOT=/path/to/your/app/current
PID=$APP_ROOT/tmp/pids/unicorn.pid
ENVIRONMENT=production
@lamanotrama
lamanotrama / zshrc
Created October 7, 2014 02:32
tmux auto rename window
## rename window to repo-name {{{
# http://blog.manaten.net/entry/tmux-repository
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git svn
zstyle ':vcs_info:*' formats '%r'
rename_tmux_window() {
[ -n "$TMUX" ] || return
LANG=en_US.UTF-8 vcs_info
@lamanotrama
lamanotrama / trace.txt
Created August 5, 2014 04:33
storage011のmogstoredにkeepaliveでつなぎっぱなのmogfs002上のquery_workerプロセスをstrace
[lamanotrama@mogfs002 ~]$ sudo strace -p 20440
Process 20440 attached - interrupt to quit
select(376, [371], NULL, NULL, {3, 846757}) = 1 (in [371], left {1, 705281})
read(371, ":monitor_events ev_type=device&u"..., 1024) = 1024
select(376, [371], NULL, NULL, {5, 0}) = 1 (in [371], left {4, 999997})
read(371, "_type=device&utilization=0.10&ev"..., 1024) = 1024
select(376, [371], NULL, NULL, {5, 0}) = 1 (in [371], left {4, 999998})
read(371, "tion=7.40&ev_id=137&ev_mode=sets"..., 1024) = 1024
select(376, [371], NULL, NULL, {5, 0}) = 1 (in [371], left {4, 999998})
read(371, "ble&ev_mode=setstate ev_type=dev"..., 1024) = 1024
@lamanotrama
lamanotrama / error.txt
Created July 1, 2014 01:58
serverspec 1.9.1のインスコでエラる件
[@@PMAC103S heteml-puppet]$ gem install serverspec
ERROR: While executing gem ... (Gem::ImpossibleDependenciesError)
rspec-2.14.1 requires rspec-core (~> 2.14.0) but it conflicted:
Activated rspec-core-2.14.8 instead of (>= 2.99.0.beta1) via:
rspec-its-1.0.1, serverspec-1.9.1
[@@PMAC103S heteml-puppet]$
[@@PMAC103S heteml-puppet]$ gem list rspec-core
*** LOCAL GEMS ***
@lamanotrama
lamanotrama / man.txt
Created June 17, 2014 07:27
supervisorctl メモ
pid Get the PID of supervisord.
pid <name> Get the PID of a single child process by name.
pid all Get the PID of every child process, one per line.
fg <process> Connect to a process in foreground mode
avail Display all configured processes
add <name> [...] Activates any updates in config for process/group
reload Restart the remote supervisord.
reread Reload the daemon's configuration files
update Reload config and add/remove as necessary