cnam / docker-riak-cs

Dockerised AWS S3 running on your machine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker Riak CS

Circle CI

Riak CS is an object storage software compatible with AWS S3 API. It's a perfect S3 alternative for local development and testing, which is the exact purpose of this image. It works as a single node to keep the resources to the minimum, something that Riak guys wouldn't recommend and certainly not suitable for production. There is hectcastro/docker-riak-cs project that allows to bring up a multi-node cluster, which might suite you better.

Running

Pull or build the image yourself and run it. When the container gets started it will setup the Riak admin and show you the credentials. Will also create optionally provided buckets.

# Build
docker build -t ianbytchek/riak-cs .

# Or pull
docker pull ianbytchek/riak-cs
 
# Run and create three buckets
docker run -d -P --name riak-cs -e "RIAK_CS_BUCKETS=foo,bar,baz" ianbytchek/riak-cs

Proxy

Riak CS should also be run behind a proxy, this is recommended by Basho and gives certain advantages, such as detailed DNS configuration and url rewriting. Besides Riak doesn't play well with SHA-256 and SSL overall, which will eventually be fixed, but until then you are better off with SSL termination. Below is a HAProxy config that you can use along with ianbytchek/docker-haproxy to get everything working.

# Make sure to replace <PRIVATE_KEY> with the actual path to relevant ssl key
# and <RIAK_CS_IP_PORT> with the IP and port of the container.

defaults
    mode                    http
    timeout connect         10s
    timeout client          1m
    timeout server          1m

frontend http
    bind *:80
    redirect scheme https code 301 if !{ ssl_fc }

frontend https
    bind *:443 ssl crt <PRIVATE_KEY>
    use_backend riak_cs

backend riak_cs
    balance leastconn
    option httpclose
    reqirep ^Host:\ (.+)?(s3).*(\.amazonaws\.dev)$ Host:\ \1\2\3
    server node01 <RIAK_CS_IP_PORT>

Issues

AWS Access Key Id does not exist

There is a known issue when the Docker host gets powered off in a non-graceful way. This might be due to the fact that Riak shouldn't be run as a one-node cluster or it doesn't get a chance to properly shut down. Starting a fresh container normally works, but there were many times when only rebuilding the container and restarting the host would work. This doesn't happen now as often as it used to, though.

Bonus

# Connect to an existing container.
docker exec -i -t riak-cs bash

# Remove exited containers.
docker ps -a | grep 'Exited' | awk '{print $1}' | xargs docker rm

# Remove intermediary and unused images.
docker rmi $(docker images -aq -f "dangling=true")

About

Dockerised AWS S3 running on your machine


Languages

Language:Shell 100.0%