Skip to content

Instantly share code, notes, and snippets.

@lamanotrama
Created February 24, 2016 04:09
Show Gist options
  • Save lamanotrama/192f06ac9a2945ab261d to your computer and use it in GitHub Desktop.
Save lamanotrama/192f06ac9a2945ab261d to your computer and use it in GitHub Desktop.
なぜかリクエストの度にlookupしてくれない。streamの設定
stream {
upstream deis {
server deis-elb-01.aya.staging:2222;
}
server {
listen 2222;
# resolve ELB's hostname to IP
mruby_stream_code '
host = "deis-elb-01.aya.staging"
port = "2222"
c = Nginx::Stream::Connection.new "deis"
c.upstream_server = Addrinfo.tcp("#{host}", nil).ip_address << ":#{port}"
';
proxy_pass deis;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment