Setting up RiakCS from source

In preparation for my talk at the
Munich Rubyshift about Riak I decided that one
topic I will talk about should be
RiakCS, since running S3 locally is just
so useful, be it for development purposes or production moving away from S3
towards a self hosted service. Setup can be really simple, just clone
the vagrant setup and run

    $ vagrant up

and be done with it.

But I still think to really explore something, I need to run it from source. Ok
so here we go, I did this on my Macbook with Erlang R15B01 installed via

Get the source, and build it

Ok this is easy, just clone the repos needed

    $ git clone
    $ git clone
    $ git clone

Ok now to build it, since I am running erlang via kerl, I first need to make
sure the right version is activated

    $ source /path/to/erlang/activate

Now build all three projects

    $ cd riak && make rel
    $ cd riak_cs && make rel
    $ cd stanchion && make rel

This might take some time, since all dependencies need to be downloaded and
compiled as well but rebar (the Erlang build tool) will take care of this.


For this I closely followed
this guide
the only thing to do really is to ajust the paths in the config files as needed,
so for /path/to/riak/rel/riak/etc/riak/app.config I followed the guide in step
3 but adjusted the paths to look like this

    {add_paths, ["/path/to/riak_cs/rel/riak-cs/lib/riak_cs-1.4.0/ebin"]},
    {storage_backend, riak_cs_kv_multi_backend},
    {multi_backend_prefix_list, [{>, be_blocks}]},
    {multi_backend_default, be_default},
    {multi_backend, [
        {be_default, riak_kv_eleveldb_backend, [
            {max_open_files, 50},
            {data_root, "/path/to/riak/rel/riak/data/leveldb"}
        {be_blocks, riak_kv_bitcask_backend, [
            {data_root, "/path/to/riak/rel/riak/data/bitcask"}

For the IPs to listen to I decided to use which binds it to every interface,
just to make sure I don’t run into trouble there. The guide suggest setting it to
the external interface IP which is probably the wiser choice.

Otherwise all settings apply here as given by the guide.


Ok with this little change everything is ready, and we can start each service

    $ /path/to/riak/rel/riak/bin/riak start
    $ /path/to/stanchion/rel/stanchion/bin/stanchion start
    $ /path/to/riak_cs/rel/riak-cs/bin/riak-cs start

order is important so.

Next Steps

Now it’s back to
this guide
and create a user and have fun with your own local S3.

Interested in more things Riak, and located in Munich?
Checkout Riak München

Setting up Riak with Vagrant and Puppet

Setting up Riak is pretty easy and straight forward,
but depending on my needs there is the need to change configuration
depending on the current use case. This means that having one instance of it on
my development machine just doesn’t cut it. Luckily there is
Vagrant which provides a quick way to setup VMs as
needed for a given project, along with Puppet this allows me to bundle all the
configuration for a given project.

Basho provides a nice module to setup Riak with puppet, but is pretty complex
to handle all the different use cases. Since I just need it for development I
decided to make it easier for me and other devs by providing an easy to setup and
a quickly understandable module for my needs. It just installs the most recent
version of Riak from the debian-pkg provided for Ubuntu 12.04 LTS 64Bits. So here we go

Vagrant configuration is short and simple, puppet folder setup as well.

while for riak_precise64 I just add a submodule via git

$ git submodule add

and here we go a simple

$ vagrant up

will give us a nice VM with riak ready to use, and any config nicely contained in app.config.