QubitProducts / bamboo

HAProxy auto configuration and auto service discovery for Mesos Marathon
Apache License 2.0
794 stars 214 forks source link

Trying to run bamboo in docker container - getting errors #132

Closed akamalov closed 9 years ago

akamalov commented 9 years ago

Greetings

I am trying to run bamboo in a docker container. Built bamboo as per instructions in 'readme' file. Build has gone fine without errors. However, trying to run it in a container, passing a configuration to json file and container erroring out. Here is my configuration file:

production.example.json

{
    "Marathon": {
        "Endpoint": "http://wwserver60.alphalocal.net:8080,http://wwserver61.alphalocal.net:8080,http://wwserver62.alphalocal.net:8080"
    },
    "Bamboo": {
        "Endpoint": "http://wwserver60.alphalocal.net:8000",
        "Zookeeper": {
            "Host": " wwserver60.alphalocal.net:2812,wwserver61.alphalocal.net:2812,wwserver62.alphalocal.net:2812",
            "Path": "/marathon-haproxy/state",
            "ReportingDelay": 5
        }
    },
    "HAProxy": {
        "TemplatePath": /var/lib/bamboo/etc/haproxy_template.cfg",
        "OutputPath": "/etc/haproxy/haproxy.cfg",
        "ReloadCommand": "haproxy -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid -D -sf $(cat /var/run/haproxy.pid)"
    },
    "StatsD": {
        "Enabled": false,
        "Host": "localhost:8125",
        "Prefix": "bamboo-server.production.n1."
    }
}

Attempting to run bamboo in a docker container:

wwserver204 etc # docker run -d --env-file=/var/lib/bamboo/etc/production.example.json  akamalov/qubit_bamboo

Display docker logs for bamboo:

/usr/lib/python2.7/dist-packages/supervisor/options.py:295: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
  'Supervisord is running as root and it is searching '
2015-06-05 14:19:46,964 CRIT Supervisor running as root (no user in config file)
2015-06-05 14:19:46,964 WARN Included extra file "/etc/supervisor/conf.d/supervisord.conf" during parsing
Unlinking stale socket /var/run/supervisor.sock
2015-06-05 14:19:47,283 INFO RPC interface 'supervisor' initialized
2015-06-05 14:19:47,283 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2015-06-05 14:19:47,284 INFO supervisord started with pid 8
2015-06-05 14:19:48,287 INFO spawned: 'bamboo' with pid 11
2015-06-05 14:19:48,299 DEBG 'bamboo' stdout output:
panic: open :config/production.example.json: no such file or directory

goroutine 1 [running]:
runtime.panic(0x6c5640, 0xc21000ad80)
        /usr/lib/go/src/pkg/runtime/panic.c:266 +0xb6

2015-06-05 14:19:48,299 DEBG 'bamboo' stdout output:
github.com/QubitProducts/bamboo/configuration.(*Configuration).FromFile(0xc210051420, 0x7ffe9b3cdb83, 0x1f, 0x0, 0x422a92)
        /opt/go/src/github.com/QubitProducts/bamboo/configuration/configuration.go:39 +0xa4
github.com/QubitProducts/bamboo/configuration.FromFile(0x7ffe9b3cdb83, 0x1f, 0x0, 0x42b0d5, 0x656ac0, ...)
        /opt/go/src/github.com/QubitProducts/bamboo/configuration/configuration.go:46 +0x6c
main.main()
        /opt/go/src/github.com/QubitProducts/bamboo/bamboo.go:44 +0x66

goroutine 3 [runnable]:
github.com/QubitProducts/bamboo/services/event_bus.func·001()
        /opt/go/src/github.com/QubitProducts/bamboo/services/event_bus/event_handler.go:49
created by github.com/QubitProducts/bamboo/services/event_bus.init·1
        /opt/go/src/github.com/QubitProducts/bamboo/services/event_bus/event_handler.go:55 +0x21

goroutine 4 [runnable]:
os/signal.loop()
        /usr/lib/go/src/pkg/os/signal/signal_unix.go:19
created by os/signal.init·1
        /usr/lib/go/src/pkg/os/signal/signal_unix.go:27 +0x31

2015-06-05 14:19:48,299 DEBG fd 7 closed, stopped monitoring <POutputDispatcher at 140145742947680 for <Subprocess at 140145743195240 with name bamboo in state STARTING> (stdout)>
2015-06-05 14:19:48,299 INFO exited: bamboo (exit status 2; not expected)
2015-06-05 14:19:48,299 DEBG received SIGCLD indicating a child quit
2015-06-05 14:19:49,301 INFO spawned: 'bamboo' with pid 16
2015-06-05 14:19:49,310 DEBG 'bamboo' stdout output:
panic: open :config/production.example.json: no such file or directory

goroutine 1 [running]:
runtime.panic(0x6c5640, 0xc21000ad80)
        /usr/lib/go/src/pkg/runtime/panic.c:266 +0xb6
github.com/QubitProducts/bamboo/configuration.(*Configuration).FromFile(0xc210051370, 0x7ffe8855fb83, 0x1f, 0x0, 0x422a92)
        /opt/go/src/github.com/QubitProducts/bamboo/configuration/configuration.go:39 +0xa4
github.com/QubitProducts/bamboo/configuration.FromFile(0x7ffe8855fb83, 0x1f, 0x0, 0x42b0d5, 0x656ac0, ...)
        /opt/go/src/github.com/QubitProducts/bamboo/configuration/configuration.go:46 +
2015-06-05 14:19:49,310 DEBG 'bamboo' stdout output:
0x6c
main.main()
        /opt/go/src/github.com/QubitProducts/bamboo/bamboo.go:44 +0x66

goroutine 3 [runnable]:
github.com/QubitProducts/bamboo/services/event_bus.func·001()
        /opt/go/src/github.com/QubitProducts/bamboo/services/event_bus/event_handler.go:49
created by github.com/QubitProducts/bamboo/services/event_bus.init·1
        /opt/go/src/github.com/QubitProducts/bamboo/services/event_bus/event_handler.go:55 +0x21

goroutine 4 [runnable]:
os/signal.loop()
        /usr/lib/go/src/pkg/os/signal/signal_unix.go:19
created by os/signal.init·1
        /usr/lib/go/src/pkg/os/signal/signal_unix.go:27 +0x31

2015-06-05 14:19:49,310 DEBG fd 7 closed, stopped monitoring <POutputDispatcher at 140145742947680 for <Subprocess at 140145743195240 with name bamboo in state STARTING> (stdout)>
2015-06-05 14:19:49,310 INFO exited: bamboo (exit status 2; not expected)
2015-06-05 14:19:49,310 DEBG received SIGCLD indicating a child quit
2015-06-05 14:19:51,313 INFO spawned: 'bamboo' with pid 21
2015-06-05 14:19:51,319 DEBG 'bamboo' stdout output:
panic: open :config/production.example.json: no such file or directory

goroutine 1 [running]:
runtime.panic(0x6c5640, 0xc21000ad80)
        /usr/lib/go/src/pkg/runtime/panic.c:266 +0xb6
github.com/QubitProducts/bamboo/configuration.(*Configuration).FromFile(0xc210051420, 0x7ffc0bd36b83, 0x1f, 0x0, 0x422a92)
        /opt/go/src/github.com/QubitProducts/bamboo/configuration/configuration.go:39 +0xa4
github.com/QubitProducts/bamboo/configuration.FromFile(0x7ffc0bd36b83, 0x1f, 0x0, 0x42b0d5, 0x656ac0, ...
2015-06-05 14:19:51,319 DEBG 'bamboo' stdout output:
)
        /opt/go/src/github.com/QubitProducts/bamboo/configuration/configuration.go:46 +0x6c
main.main()
        /opt/go/src/github.com/QubitProducts/bamboo/bamboo.go:44 +0x66

goroutine 3 [runnable]:
github.com/QubitProducts/bamboo/services/event_bus.func·001()
        /opt/go/src/github.com/QubitProducts/bamboo/services/event_bus/event_handler.go:49
created by github.com/QubitProducts/bamboo/services/event_bus.init·1
        /opt/go/src/github.com/QubitProducts/bamboo/services/event_bus/event_handler.go:55 +0x21

goroutine 4 [runnable]:
os/signal.loop()
        /usr/lib/go/src/pkg/os/signal/signal_unix.go:19
created by os/signal.init·1
        /usr/lib/go/src/pkg/os/signal/signal_unix.go:27 +0x31

2015-06-05 14:19:51,319 DEBG fd 7 closed, stopped monitoring <POutputDispatcher at 140145742947680 for <Subprocess at 140145743195240 with name bamboo in state STARTING> (stdout)>
2015-06-05 14:19:51,319 INFO exited: bamboo (exit status 2; not expected)
2015-06-05 14:19:51,319 DEBG received SIGCLD indicating a child quit
2015-06-05 14:19:54,324 INFO spawned: 'bamboo' with pid 26
2015-06-05 14:19:54,330 DEBG 'bamboo' stdout output:
panic: open :config/production.example.json: no such file or directory

goroutine 1 [running]:
runtime.panic(0x6c5640, 0xc21000ad80)
        /usr/lib/go/src/pkg/runtime/panic.c:266 +0xb6
github.com/QubitProducts/bamboo/configuration.(*Configuration).FromFile(0xc210052420, 0x7fffdabdcb83, 0x1f, 0x0, 0x422a92)
        /opt/go/src/github.com/QubitProducts/bamboo/configuration/configuration.go:39 +0xa4
github.com/QubitProducts/bamboo/configuration.FromFile(0x7fffdabdcb83, 0x1f, 0x0, 0x42b0d5, 0x656ac0, ...)
        /opt/go/src/github.com/QubitProducts/bamboo/configuration/configuration.go:46 +0x6c
main.main()
        /opt/go/src/github.com/QubitProducts/bamboo/bamboo.go:44 +0x66

2015-06-05 14:19:54,331 DEBG 'bamboo' stdout output:

goroutine 3 [runnable]:
github.com/QubitProducts/bamboo/services/event_bus.func·001()
        /opt/go/src/github.com/QubitProducts/bamboo/services/event_bus/event_handler.go:49
created by github.com/QubitProducts/bamboo/services/event_bus.init·1
        /opt/go/src/github.com/QubitProducts/bamboo/services/event_bus/event_handler.go:55 +0x21

goroutine 4 [runnable]:
os/signal.loop()
        /usr/lib/go/src/pkg/os/signal/signal_unix.go:19
created by os/signal.init·1
        /usr/lib/go/src/pkg/os/signal/signal_unix.go:27 +0x31

2015-06-05 14:19:54,332 INFO exited: bamboo (exit status 2; not expected)
2015-06-05 14:19:54,332 DEBG received SIGCLD indicating a child quit
2015-06-05 14:19:55,333 INFO gave up: bamboo entered FATAL state, too many start retries too quickly

If you see about 12 lines down, there is a message:

panic: open :config/production.example.json: no such file or directory

I thought I was passing a parameter with -env-file= but for some reason it is not reading? Any thoughts ?

Thanks!!!!

Alex

timoreimann commented 9 years ago

The --env-file file parameter is part of docker run, not Bamboo itself. It just expects a list of environment variables and passes it to the Docker container.

The Bamboo dockerfile starts via the config/run.sh and processes a CONFIG_FILE environment variable. This is the variable you want to specify, most simply via an -e flag. Note that it defaults to the production example file that comes with Bamboo.

Hope this helps!

akamalov commented 9 years ago

Thanks Timo. Will re-try it and keep you posted.

bateau84 commented 9 years ago

I Belive its CONFIG_PATH not CONFIG_FILE.

akamalov commented 9 years ago

Yep. Got it to work.

  1. Created a directory on docker host: /var/lib/bamboo/etc with two configuration files:
bamboo.json
haproxy_template.cfg
  1. Deployed Bamboo container with the following command:
docker run -d -P --name bamboo  -v /var/lib/bamboo/etc:/var/lib/bamboo/etc -e CONFIG_PATH=/var/lib/bamboo/etc/bamboo.json -e BAMBOO_DOCKER_AUTO_HOST=true akamalov/qubit_bamboo

Thanks so much for everyone responded.

Alex