basho-labs / riak-docker

Riak in Docker
19 stars 32 forks source link

Version of this image that listens on localhost #5

Open genericProgramming opened 7 years ago

genericProgramming commented 7 years ago

Our team is migrating to drone.io and had a bit of a tough time getting riak to play nicely since the basho/riak-kv image doesn't listen on localhost. It'd be awesome to get an image that listens on localhost for quick integration testing.

Example of the issue: https://github.com/genericProgramming/DroneServiceContainerWeirdness

How drone.io service containers work; http://readme.drone.io/0.5/usage/services/

alanbrent commented 7 years ago

@genericProgramming You might find the following useful:

Script to add into a new riak container. (e.g. via docker run -v script.sh:/etc/riak/prestart.d/script.sh):

#!/usr/bin/env bash
set -eux

# Make sure the Riak coordinator listens on all interfaces, otherwise it only listens on the docker-compose default network
## Reference: https://github.com/basho-labs/riak-docker/blob/master/riak-cluster.sh#L36-L40
## Unfortunately, as of this writing the naive `find` invocation in the above script means the scripts don't run in the
## intended prefix-filename order. A PR has been opened to fix this:
### https://github.com/basho-labs/riak-docker/pull/7
## In the meantime, we'll need to use our own custom builds that incorporate this fix.

for i in $HTTP_PORT $PB_PORT; do
  sed -i s/=.*:"$i"/"= 0.0.0.0:$i"/g $RIAK_CONF
done

Dockerfile for the custom build referenced in the above script:

FROM basho/riak-kv

RUN sed -i s/'-print'/'-print | sort'/g $RIAK_HOME/riak-cluster.sh
jbrisbin commented 7 years ago

FWIW you can just add settings to the end of riak.conf and those will override the early settings, no sed required.

alanbrent commented 7 years ago

I thought that was the case, but I wasn't sure. I was originally doing that via echo blahblah >>/etc/riak/user.conf, and at some point down the rabbit hole of figuring out why I realized the find output was unsorted. Thanks!