basho / riak-erlang-client

The Riak client for Erlang.
Apache License 2.0
311 stars 188 forks source link

Support for OTP20+ #399

Open SserwangaV opened 3 years ago

SserwangaV commented 3 years ago

@martinsumner how can we be able to use rebar2 in rebar.config {deps,[]} for riak-erlang-client to compile on OTP20 and later ? Right now the edoc states this {riakc, "2.5.*", {git, "https://github.com/basho/riak-erlang-client", {tag, "2.5.1"}}}, which is only supported on not later than OTP19.

martinsumner commented 3 years ago

The latest release - https://github.com/basho/riak-erlang-client/tree/riak_kv-3.0.1 is OTP 20 + - so the tag riak_kv-3.0.1 should work in your rebar.config.

Apologies the edocs, readme and release notes aren't up to date with the recent release history.

I've not tried this with rebar2 though, so I don't know if this will cause issues - everything in riak is now using rebar3.

SserwangaV commented 3 years ago

riak-erlang-client is used as a dependency in a Nitrogen web framework application that uses rebar2 currently. We are also connecting to Riak-KV 2.2.5. We are failing to upgrade the application to OTP20+ because of this dependency problem. Can the branch https://github.com/basho/riak-erlang-client/tree/develop-3.0-higherotp provide a workaround?

martinsumner commented 3 years ago

A OTP 20+ riak erlang client pointing at riak_kv 2.2.5 is not something I've tried to get working yet - there may be some issues with the riak_pb dependancy. I will have a look at this tomorrow.

martinsumner commented 3 years ago

I didn't get chance to look at this today, in terms of actually proving anything, but having thought about it there shouldn't be any issues pointing the up-to-date riak erlang client (with OTP 20+ support) at an older version of Riak (e.g. 2.2.5). The PB API has been updated, but only with new additions, so using old functionality should not be changed.

SserwangaV commented 3 years ago

It worked - able to make CRUD operations, but I had to compile it independently (without including it to rebar.config) and then copy all the contents of its /lib directory to /lib of the application ~/myapp/lib.

This is exactly what I did: ~$ git clone git://github.com/basho/riak-erlang-client.git ~$ cd riak-erlang-client ~$ make Then I copied the contents thusly ~$ cp ~/riak-erlang-client/_build/default/lib/* ~/myapp/lib/

When added to rebar.config: It failed to compile when added as a dependency from the rebar.config file. This is the error Pulling riakc from {git,"git://github.com/basho/riak-erlang-client", {tag,"riak_kv-3.0.1"}} Cloning into 'riakc'... ==> riakc (get-deps) Pulling riak_pb from {git,"https://github.com/basho/riak_pb", {tag,"riak_kv-3.0.1"}} Cloning into 'riak_pb'... Uncaught error in rebar_core: {'EXIT', {function_clause, [{code,which, [{rebar3_gpb_plugin, {git, "https://github.com/basho/rebar3_gpb_plugin", {tag,"riak-3.0.1"}}}], [{file,"code.erl"},{line,790}]}, {rebar_core,'-plugin_modules/3-lc$^0/1-0-', 1, [{file,"src/rebar_core.erl"},{line,573}]}, {rebar_core,plugin_modules,3, [{file,"src/rebar_core.erl"},{line,573}]}, {rebar_core,process_dir1,7, [{file,"src/rebar_core.erl"},{line,244}]}, {rebar_core,process_each,5, [{file,"src/rebar_core.erl"},{line,351}]}, {rebar_core,process_dir1,7, [{file,"src/rebar_core.erl"},{line,271}]}, {rebar_core,process_each,5, [{file,"src/rebar_core.erl"},{line,351}]}, {rebar_core,process_dir1,7, [{file,"src/rebar_core.erl"},{line,271}]}]}} make: *** [Makefile:15: get-deps] Error 1

I'm running a Nitrogen web framework application which is still built on rebar2. Running on OTP 23.

lgmfred commented 2 years ago

This was very useful for setting up my development environment (.... after scratching my chin a few times and going "Hmmm..."). Thanks.