fleet-redis-demo icon indicating copy to clipboard operation
fleet-redis-demo copied to clipboard

Source / Dockerfile for polvi/dynamic-etcd-amb

Open lachie opened this issue 10 years ago • 7 comments

Hi, is there some source or a Dockerfile for the polvi/dynamic-etcd-amb image?

lachie avatar Mar 18 '14 23:03 lachie

Hi, dynamic-etcd-amb use nsproxy. https://github.com/polvi/nsproxy

Dockerfile

FROM stackbrew/ubuntu:13.04
# Let's install go just like Docker (from source).
RUN apt-get update -q
RUN apt-get install -qy build-essential curl git
RUN curl -s https://go.googlecode.com/files/go1.2.src.tar.gz | tar -v -C /usr/local -xz
RUN cd /usr/local/go/src && ./make.bash --no-clean 2>&1
ENV PATH /usr/local/go/bin:$PATH
ADD . /opt/nsproxy
RUN cd /opt/nsproxy && ./build
ADD proxy-amb.sh /usr/bin/proxy-amb.sh
ENTRYPOINT ["/usr/bin/proxy-amb.sh"]

proxy-amb.sh

#!/bin/bash

SERV=$1
PORT=$2
/opt/nsproxy/nsproxy -a 0.0.0.0:${PORT} -p /services/${SERV} -C http://${ETCD_PORT_10000_TCP_ADDR}:${ETCD_PORT_10000_TCP_PORT}

mopemope avatar Mar 25 '14 03:03 mopemope

Hi,

There must be missing something since in nsproxy, the namespace-pid parameter is mandatory.

dmetzler avatar Apr 09 '14 15:04 dmetzler

Hi,

You should use 'bump-etcd' branch or my repository.

https://github.com/mopemope/nsproxy

mopemope avatar Apr 09 '14 23:04 mopemope

ok, this is what i used. When launching nsproxy inside a docker container it now not complains about missing namespace but it get the following stackstrace :

  root@37dc3ec6a85e:/opt/tmp/nsproxy# ./nsproxy -a 0.0.0.0:5432 -p /services/postgres -C http://172.17.42.1:4001
  warn: a namespace pid or path is required to setns, listening in this namespace
  2014/04/10 13:00:26 Proxying for keys in /services/postgres on host 0.0.0.0:5432
  2014/04/10 13:00:26 Proxying for keys in /services/postgres on host 0.0.0.0:5432 in namespace %!d(string=)
  panic: open : no such file or directory

  goroutine 1 [running]:
  runtime.panic(0x65ef80, 0xc21006f2a0)
    /usr/local/go/src/pkg/runtime/panic.c:266 +0xb6
  main.proxy(0xc2100537c0)
    /opt/tmp/nsproxy/nsproxy.go:69 +0x895
  github.com/codegangsta/cli.(*App).Run(0xc21000f5a0, 0xc21000a000, 0x7, 0x7, 0x8, ...)
    /opt/tmp/nsproxy/third_party/src/github.com/codegangsta/cli/app.go:106 +0x847
  main.main()
    /opt/tmp/nsproxy/nsproxy.go:103 +0x333

  goroutine 7 [runnable]:
  main.(*backends).Watch(0xc21001f5a0, 0xc210067280)
    /opt/tmp/nsproxy/backends.go:80
  created by main.proxy
    /opt/tmp/nsproxy/nsproxy.go:63 +0x6a0

  goroutine 5 [IO wait]:
  net.runtime_pollWait(0x7f4df01df848, 0x72, 0x0)
    /usr/local/go/src/pkg/runtime/netpoll.goc:116 +0x6a
  net.(*pollDesc).Wait(0xc21000a370, 0x72, 0x7f4df01ddf88, 0xb)
    /usr/local/go/src/pkg/net/fd_poll_runtime.go:81 +0x34
  net.(*pollDesc).WaitRead(0xc21000a370, 0xb, 0x7f4df01ddf88)
    /usr/local/go/src/pkg/net/fd_poll_runtime.go:86 +0x30
  net.(*netFD).Read(0xc21000a310, 0xc21006b000, 0x1000, 0x1000, 0x0, ...)
    /usr/local/go/src/pkg/net/fd_unix.go:204 +0x2a0
  net.(*conn).Read(0xc2100002b0, 0xc21006b000, 0x1000, 0x1000, 0x30, ...)
    /usr/local/go/src/pkg/net/net.go:122 +0xc5
  bufio.(*Reader).fill(0xc210038480)
    /usr/local/go/src/pkg/bufio/bufio.go:91 +0x110
  bufio.(*Reader).Peek(0xc210038480, 0x1, 0x0, 0x0, 0x0, ...)
    /usr/local/go/src/pkg/bufio/bufio.go:119 +0xcb
  net/http.(*persistConn).readLoop(0xc210067480)
    /usr/local/go/src/pkg/net/http/transport.go:687 +0xb7
  created by net/http.(*Transport).dialConn
    /usr/local/go/src/pkg/net/http/transport.go:528 +0x607

  goroutine 6 [select]:
  net/http.(*persistConn).writeLoop(0xc210067480)
    /usr/local/go/src/pkg/net/http/transport.go:791 +0x271
  created by net/http.(*Transport).dialConn
    /usr/local/go/src/pkg/net/http/transport.go:529 +0x61e

I'm not very fluent with linux network namespace but from what i understand, docker creates a dedicated namespace for the container which is not reachable via ip netns list.... so i wonder how nsproxy finds the namespace wihch is perhaps the cause of my problem.

dmetzler avatar Apr 10 '14 13:04 dmetzler

Got the same stacktrace as @dmetzler, any ideas?

ghost avatar Aug 26 '14 15:08 ghost

I get a very similar stacktrace:

warn: a namespace pid or path is required to setns, listening in this namespace
2015/04/20 14:52:01 Proxying for keys in /services/mysqld-A on host 0.0.0.0:3306
2015/04/20 14:52:01 key: /services/mysqld-A/wp-mysqld action: get value: { "port": 49153, "host": "172.17.8.103" }
2015/04/20 14:52:01 Proxying for keys in /services/mysqld-A on host 0.0.0.0:3306 in namespace %!d(string=)
panic: open : no such file or directory

goroutine 1 [running]:
runtime.panic(0x65ef80, 0xc21006e630)
    /usr/local/go/src/pkg/runtime/panic.c:266 +0xb6
main.proxy(0xc2100537e0)
    /opt/nsproxy/nsproxy.go:69 +0x895
github.com/codegangsta/cli.(*App).Run(0xc21000f5a0, 0xc21000a000, 0x7, 0x7, 0x8, ...)
    /opt/nsproxy/third_party/src/github.com/codegangsta/cli/app.go:106 +0x847
main.main()
    /opt/nsproxy/nsproxy.go:103 +0x333

goroutine 10 [runnable]:
main.(*backends).Watch(0xc21001f5a0, 0xc210066280)
    /opt/nsproxy/backends.go:80
created by main.proxy
    /opt/nsproxy/nsproxy.go:63 +0x6a0

goroutine 9 [select]:
net/http.(*persistConn).writeLoop(0xc210066580)
    /usr/local/go/src/pkg/net/http/transport.go:791 +0x271
created by net/http.(*Transport).dialConn
    /usr/local/go/src/pkg/net/http/transport.go:529 +0x61e

goroutine 8 [runnable]:
net/http.(*persistConn).readLoop(0xc210066580)
    /usr/local/go/src/pkg/net/http/transport.go:778 +0x68f
created by net/http.(*Transport).dialConn
    /usr/local/go/src/pkg/net/http/transport.go:528 +0x607

Any help is appreciated!

finferflu avatar Apr 20 '15 15:04 finferflu

I'm having the same error:

May 05 10:55:37 core-01 systemd[1]: Starting redis-dyn-amb.service...
May 05 10:55:37 core-01 systemd[1]: Started redis-dyn-amb.service.
May 05 10:55:37 core-01 docker[9450]: warn: a namespace pid or path is required to setns, listening in this namespace
May 05 10:55:37 core-01 docker[9450]: 2015/05/05 10:55:37 Proxying for keys in /services/redis-A on host 0.0.0.0:6379
May 05 10:55:37 core-01 docker[9450]: 2015/05/05 10:55:37 Proxying for keys in /services/redis-A on host 0.0.0.0:6379 in namespace %!d(string=)
May 05 10:57:52 core-01 systemd[1]: Stopping redis-dyn-amb.service...
May 05 10:57:55 core-01 docker[9587]: redis-dyn-amb.service
May 05 10:57:55 core-01 systemd[1]: redis-dyn-amb.service: main process exited, code=exited, status=137/n/a

ruudk avatar May 05 '15 11:05 ruudk