diff --git a/Makefile b/Makefile index 12699f026..1bffaeb16 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ PKG_REVISION ?= $(shell git describe --tags 2>/dev/null) PKG_BUILD = 1 BASE_DIR = $(shell pwd) ERLANG_BIN = $(shell dirname $(shell which erl 2>/dev/null) 2>/dev/null) -OTP_VER = $(shell echo $(ERLANG_BIN) | rev | cut -d "/" -f 2 | rev) +OTP_VER = $(shell erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell) REBAR ?= $(BASE_DIR)/rebar3 OVERLAY_VARS ?= TEST_IGNORE ?= lager riak basho_bench @@ -30,12 +30,12 @@ compile: deps: $(if $(HEAD_REVISION),$(warning "Warning: you have checked out a tag ($(HEAD_REVISION)) and should use the compile target")) - $(REBAR) upgrade + $(REBAR) upgrade --all clean: testclean $(REBAR) clean -distclean: clean devclean relclean ballclean +distclean: clean devclean relclean @rm -rf _build ## @@ -74,20 +74,35 @@ test : testclean eunit test-deps ## Release targets ## rel: compile - $(REBAR) as rel release - cp -a _build/rel/rel/riak rel/ + @$(REBAR) as rel release +# freebsd tar won't write to stdout, so: + @tar -c -f rel.tar --exclude '*/.git/*' -C _build/rel/rel riak && tar -x -f rel.tar -C rel && rm rel.tar rel-rpm: compile - $(REBAR) as rpm release - cp -a _build/rpm/rel/riak rel/ + @$(REBAR) as rpm release + @tar --exclude-vcs -c -C _build/rpm/rel riak | tar -x -C rel rel-deb: compile - $(REBAR) as deb release - cp -a _build/deb/rel/riak rel/ + @$(REBAR) as deb release + @tar --exclude=vcs -c -C _build/deb/rel riak | tar -x -C rel + +rel-osx: compile + @$(REBAR) as osx release + @tar --exclude=vcs -c -C _build/osx/rel riak | tar -x -C rel + +# this one is to be called from an external make (not from rel/pkg/Makefile) +rel-alpine: compile + @$(REBAR) as alpine release + @(cd _build/alpine/rel/riak/usr/bin && mv riak-nosu riak) + @tar --exclude=vcs -c -C _build/alpine/rel riak | tar -x -C rel + +rel-fbsdng: compile + @$(REBAR) as fbsdng release + @tar -c -f rel.tar --exclude '*/.git/*' -C _build/fbsdng/rel riak && tar -x -f rel.tar -C rel && rm rel.tar relclean: - rm -rf $(REL_DIR) - rm -rf rel/riak + @rm -rf $(REL_DIR) + @rm -rf rel/riak rel/.libs rel/.deps ## ## Developer targets @@ -231,7 +246,7 @@ PKG_ID := "$(REPO_TAG)-OTP$(OTP_VER)" PKG_VERSION = $(shell echo $(PKG_ID) | sed -e 's/^$(REPO)-//') package: - mkdir rel/pkg/out/riak-$(PKG_ID) + mkdir -p rel/pkg/out/$(PKG_ID) git archive --format=tar HEAD | gzip >rel/pkg/out/$(PKG_ID).tar.gz $(MAKE) -f rel/pkg/Makefile diff --git a/config/vm.args b/config/vm.args new file mode 100644 index 000000000..e65cd3f49 --- /dev/null +++ b/config/vm.args @@ -0,0 +1,2 @@ +-setcookie riak +-name riak@127.0.0.1 diff --git a/pkg.vars.config b/pkg.vars.config deleted file mode 100644 index 2339cf38f..000000000 --- a/pkg.vars.config +++ /dev/null @@ -1,37 +0,0 @@ -%% -*- tab-width: 4;erlang-indent-level: 4;indent-tabs-mode: nil -*- -%% ex: ts=4 sw=4 et - -%% -%% Packaging -%% -{package_name, "riak"}. -{package_install_name, "riak"}. -{package_install_user, "riak"}. -{package_install_group, "riak"}. -{package_install_user_desc, "Riak user"}. -{package_commands, {list, [[{name, "riak"}], [{name, "riak-admin"}], [{name, "riak-repl"}], [{name, "riak-debug"}]]}}. -{package_shortdesc, "Riak is a distributed data store"}. -{package_desc, "Riak is a distributed data store"}. -{bin_or_sbin, "sbin"}. -{package_patch_dir, "basho-patches"}. -{solaris_pkgname, "BASHOriak"}. -{license_type, "Apache 2"}. -{copyright, "2013 Basho Technologies, Inc"}. -{vendor_name, "Basho Technologies, Inc"}. -{vendor_url, "http://basho.com"}. -{vendor_contact_name, "Basho Package Maintainer"}. -{vendor_contact_email, "packaging@basho.com"}. -{cuttlefish_conf, "riak.conf"}. -{license_full_text, "This file is provided to you under the Apache License,\n" -"Version 2.0 (the \"License\"); you may not use this file\n" -"except in compliance with the License. You may obtain\n" -"a copy of the License at\n" -"\n" -" http://www.apache.org/licenses/LICENSE-2.0\n" -"\n" -"Unless required by applicable law or agreed to in writing,\n" -"software distributed under the License is distributed on an\n" -"\"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n" -"KIND, either express or implied. See the License for the\n" -"specific language governing permissions and limitations\n" -"under the License."}. diff --git a/rebar.config b/rebar.config index 51e22aa09..11b3c2d95 100644 --- a/rebar.config +++ b/rebar.config @@ -9,19 +9,19 @@ {eunit_opts, [nowarn_export_all, verbose]}. {deps, [ - {lager_syslog, {git, "https://github.com/basho/lager_syslog.git", {tag, "3.1.0"}}}, - {cluster_info, {git, "https://github.com/basho/cluster_info.git", {tag, "2.1.0"}}}, - {riak_kv, {git, "https://github.com/basho/riak_kv.git", {tag, "riak_kv-3.0.9"}}}, - {riak_auth_mods, {git, "https://github.com/basho/riak_auth_mods.git", {tag, "riak_kv-3.0.0"}}}, - {riaknostic, {git, "https://github.com/basho/riaknostic.git", {tag, "riak_kv-3.0.2"}}}, + {lager_syslog, {git, "https://github.com/basho/lager_syslog.git", {branch, "develop-3.0"}}}, + {cluster_info, {git, "https://github.com/basho/cluster_info.git", {branch, "develop-3.0"}}}, + {riak_kv, {git, "https://github.com/basho/riak_kv.git", {branch, "develop-3.0"}}}, + {riak_auth_mods, {git, "https://github.com/basho/riak_auth_mods.git", {branch, "develop-3.0"}}}, + {riaknostic, {git, "https://github.com/basho/riaknostic.git", {branch, "develop-3.0"}}}, % {yokozuna, {git, "https://github.com/basho/yokozuna.git", {branch, "develop-3.0"}}}, - {riak_repl, {git, "https://github.com/basho/riak_repl.git", {tag, "riak_kv-3.0.9"}}} + {riak_repl, {git, "https://github.com/basho/riak_repl", {branch, "develop-3.0"}}} ]}. {project_plugins, [ - {rebar3_cuttlefish, {git, "https://github.com/basho/rebar3_cuttlefish", {tag, "0.2.0"}}} + {rebar3_cuttlefish, {git, "https://github.com/basho/rebar3_cuttlefish", {branch, "develop-3.0"}}} ]}. {cuttlefish, [ @@ -46,7 +46,7 @@ ]} ]}. -{relx, [{release, {riak, "3.0.9"}, +{relx, [{release, {riak, git}, [kernel, stdlib, lager, @@ -82,6 +82,7 @@ {overlay, [ {mkdir, "lib/patches"}, {mkdir, "data/ring"}, + {mkdir, "log"}, {template, "rel/files/advanced.config", "etc/advanced.config"}, @@ -92,12 +93,11 @@ {template, "rel/files/riak-repl", "bin/riak-repl"}, {template, "rel/files/riak", "usr/bin/riak"}, - {copy, "rel/files/check_ulimit", "bin/hooks/check_ulimit"}, - {copy, "rel/files/erl_maxlogsize", "bin/hooks/erl_maxlogsize"}, - {copy, "rel/files/erl_codeloadingmode","bin/hooks/erl_codeloadingmode"}, - {copy, "rel/files/riak_not_running", "bin/hooks/riak_not_running"}, - {copy, "rel/files/app_epath.sh", "lib/app_epath.sh"} - + {copy, "rel/files/hooks/check_ulimit", "bin/hooks/check_ulimit"}, + {copy, "rel/files/hooks/erl_maxlogsize", "bin/hooks/erl_maxlogsize"}, + {copy, "rel/files/hooks/erl_codeloadingmode","bin/hooks/erl_codeloadingmode"}, + {template, "rel/files/hooks/riak_not_running", "bin/hooks/riak_not_running"}, + {copy, "rel/files/app_epath.sh", "lib/app_epath.sh"} ]}, {generate_start_script, true}, @@ -105,6 +105,7 @@ {extended_start_script_extensions, [ {admin, "riak-admin"}, {repl, "riak-repl"}, + {debug, "riak-debug"}, {chkconfig, "riak-chkconfig"} ]} @@ -112,70 +113,121 @@ {dialyzer, [{plt_apps, all_deps}]}. -{profiles, [ - {rel, [ - {relx, [ - {overlay_vars, "rel/vars.config"}, - {extended_start_script_hooks, - [{pre_start, - [{custom, "hooks/riak_not_running"}, - {custom, "hooks/check_ulimit"}, - {custom, "hooks/erl_maxlogsize"}, - {custom, "hooks/erl_codeloadingmode"}]}, - {post_start, - [{wait_for_process, riak_core_node_watcher}]} - ]} - ]} - ]}, - {dev, [{relx, [ - {dev_mode, true}, - {extended_start_script_hooks, - [{pre_start, - [{custom, "hooks/riak_not_running"}, - {custom, "hooks/check_ulimit"}, - {custom, "hooks/erl_maxlogsize"}, - {custom, "hooks/erl_codeloadingmode"}]}, - {post_start, - [{wait_for_process, riak_core_node_watcher}]} - ]} - ]} - ]}, - {rpm, [ - {relx, [ - {overlay_vars, "rel/pkg/rpm/vars.config"}, - {overlay, [ - {template, "rel/files/riak", "usr/sbin/riak"}, - {template, "rel/pkg/rpm/init.script", "etc/init.d/init.script"} - ]}, - {extended_start_script_hooks, - [{pre_start, - [{custom, "hooks/riak_not_running"}, - {custom, "hooks/check_ulimit"}, - {custom, "hooks/erl_maxlogsize"}, - {custom, "hooks/erl_codeloadingmode"}]}, - {post_start, - [{pid, "/var/run/riak/riak.pid"}, - {wait_for_process, riak_core_node_watcher}]} - ]} - ]} - ]}, - {deb, [ - {relx, [ - {overlay_vars, "debian/vars.config"}, - {overlay, [ - {template, "rel/files/riak", "usr/bin/riak"} - ]}, - {extended_start_script_hooks, - [{pre_start, - [{custom, "hooks/riak_not_running"}, - {custom, "hooks/check_ulimit"}, - {custom, "hooks/erl_maxlogsize"}, - {custom, "hooks/erl_codeloadingmode"}]}, - {post_start, - [wait_for_vm_start, - {pid, "/run/riak/riak.pid"}, - {wait_for_process, riak_core_node_watcher}]} - ]} - ]} - ]} +{profiles, + [{rel, + [{relx, + [{overlay_vars, "rel/vars.config"}, + {extended_start_script_hooks, + [{pre_start, + [{custom, "hooks/riak_not_running"}, + {custom, "hooks/check_ulimit"}, + {custom, "hooks/erl_maxlogsize"}, + {custom, "hooks/erl_codeloadingmode"}]}, + {post_start, + [{wait_for_process, riak_core_node_watcher} + ]} + ]} + ]} + ]}, + + {dev, + [{relx, + [{dev_mode, true}, + {extended_start_script_hooks, + [{pre_start, + [{custom, "hooks/riak_not_running"}, + {custom, "hooks/check_ulimit"}, + {custom, "hooks/erl_maxlogsize"}, + {custom, "hooks/erl_codeloadingmode"} + ]}, + {post_start, + [{wait_for_process, riak_core_node_watcher}]} + ]} + ]} + ]}, + + {rpm, + [{relx, + [{overlay_vars, "rel/pkg/rpm/vars.config"}, + {overlay, + [{template, "rel/files/riak", "usr/sbin/riak"}, + {template, "rel/pkg/rpm/init.script", "etc/init.d/init.script"} + ]}, + {extended_start_script_hooks, + [{pre_start, + [{custom, "hooks/riak_not_running"}, + {custom, "hooks/check_ulimit"}, + {custom, "hooks/erl_maxlogsize"}, + {custom, "hooks/erl_codeloadingmode"} + ]}, + {post_start, + [{pid, "/var/run/riak/riak.pid"}, + {wait_for_process, riak_core_node_watcher}]} + ]} + ]} + ]}, + + {deb, + [{relx, + [{overlay_vars, "rel/pkg/deb/vars.config"}, + {overlay, + [{template, "rel/files/riak", "usr/bin/riak"} + ]}, + {extended_start_script_hooks, + [{pre_start, + [{custom, "hooks/riak_not_running"}, + {custom, "hooks/check_ulimit"}, + {custom, "hooks/erl_maxlogsize"}, + {custom, "hooks/erl_codeloadingmode"} + ]}, + {post_start, + [wait_for_vm_start, + {pid, "/run/riak/riak.pid"}, + {wait_for_process, riak_core_node_watcher}]} + ]} + ]} + ]}, + + {alpine, + [{relx, + [{overlay_vars, "rel/pkg/alpine/vars.config"}, + {overlay, + [{template, "rel/pkg/alpine/riak-nosu", "usr/bin/riak-nosu"} %% to be renamed to riak in Makefile + ]}, + {extended_start_script_hooks, + [{pre_start, + [{custom, "hooks/riak_not_running"}, + {custom, "hooks/check_ulimit"}, + {custom, "hooks/erl_maxlogsize"}, + {custom, "hooks/erl_codeloadingmode"}]}, + {post_start, + [wait_for_vm_start, + {pid, "/run/riak/riak.pid"}, + {wait_for_process, riak_core_node_watcher}]} + ]} + ]} + ]}, + + {osx, + [{relx, + [{overlay_vars, "rel/pkg/osx/vars.config"} + ]} + ]}, + + {fbsdng, + [{relx, + [{overlay_vars, "rel/pkg/fbsdng/vars.config"}, + {extended_start_script_hooks, + [{pre_start, + [{custom, "hooks/riak_not_running"}, + {custom, "hooks/check_ulimit"}, + {custom, "hooks/erl_maxlogsize"}, + {custom, "hooks/erl_codeloadingmode"}]}, + {post_start, + [wait_for_vm_start, + {pid, "/var/run/riak/riak.pid"}, + {wait_for_process, riak_core_node_watcher}]} + ]} + ]} + ]} ]}. diff --git a/rebar.lock b/rebar.lock deleted file mode 100644 index 1fca129c5..000000000 --- a/rebar.lock +++ /dev/null @@ -1,184 +0,0 @@ -{"1.1.0", -[{<<"basho_stats">>, - {git,"https://github.com/basho/basho_stats.git", - {ref,"c5b7ecb92af7b050bc62d08c6fbf1aafd6bdeff0"}}, - 2}, - {<<"bear">>,{pkg,<<"bear">>,<<"0.8.7">>},4}, - {<<"bitcask">>, - {git,"https://github.com/basho/bitcask.git", - {ref,"dd96f6dd84a1cad68ccc21959ba56b0426434d85"}}, - 1}, - {<<"canola">>, - {git,"git://github.com/basho/canola.git", - {ref,"2cd39378442f3dc727de22289243b3c4d56f25fd"}}, - 1}, - {<<"clique">>, - {git,"https://github.com/basho/clique.git", - {ref,"4014357e4e677164b890fdad08a45cfa54b3e8f3"}}, - 2}, - {<<"cluster_info">>, - {git,"https://github.com/basho/cluster_info.git", - {ref,"389d43af7ac1550b3c01cd55b8147bcc0e20022f"}}, - 0}, - {<<"cuttlefish">>, - {git,"https://github.com/basho/cuttlefish.git", - {ref,"e84070b6cf08196ece2ae54083eefae4dc4e4ecc"}}, - 3}, - {<<"ebloom">>, - {git,"git://github.com/basho/ebloom.git", - {ref,"3c25f9ef61a73d5f1d2c2601da464dd03975721d"}}, - 1}, - {<<"eleveldb">>, - {git,"https://github.com/basho/eleveldb.git", - {ref,"3dee1dd7173507a4ad29df1ceb99cb70d6142478"}}, - 2}, - {<<"exometer_core">>, - {git,"https://github.com/Feuerlabs/exometer_core.git", - {ref,"547f28bc93c7cb3d3f1174fb4c510667a4ebb645"}}, - 2}, - {<<"folsom">>,{pkg,<<"folsom">>,<<"0.8.7">>},3}, - {<<"getopt">>, - {git,"git://github.com/jcomellas/getopt.git", - {ref,"fbd210550677114a6c96cdf66e340eb248908d93"}}, - 1}, - {<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.9">>},2}, - {<<"hut">>,{pkg,<<"hut">>,<<"1.2.1">>},3}, - {<<"hyper">>, - {git,"https://github.com/basho/hyper", - {ref,"d0bf3d67fd17b8ed2610b266aebd54b1027ea916"}}, - 1}, - {<<"ibrowse">>, - {git,"https://github.com/basho/ibrowse.git", - {ref,"cdde6fe5e80ce71e7b5570e40a45d9f862721499"}}, - 2}, - {<<"kv_index_tictactree">>, - {git,"https://github.com/martinsumner/kv_index_tictactree.git", - {ref,"a3787dbf7c556cd323ae00849c1926b6dfcf15dc"}}, - 1}, - {<<"lager">>, - {git,"git://github.com/erlang-lager/lager.git", - {ref,"22e62f28e5afabe90a6f31bcde367a2b5799fc94"}}, - 1}, - {<<"lager_syslog">>, - {git,"https://github.com/basho/lager_syslog.git", - {ref,"152bb8eb254c225ebd8c579f9603f44b50df44ec"}}, - 0}, - {<<"leveled">>, - {git,"https://github.com/martinsumner/leveled", - {ref,"086e06979e6f6d0d37b15df883c0ce2eb3c15892"}}, - 2}, - {<<"lz4">>, - {git,"https://github.com/martinsumner/erlang-lz4", - {ref,"d407af5de71303b8e381df718d2e5d05eb775c59"}}, - 3}, - {<<"meck">>, - {git,"https://github.com/eproxus/meck.git", - {ref,"4ecc1ae9089edc6977e8c8c4cd41081513cc5590"}}, - 4}, - {<<"mochiweb">>, - {git,"https://github.com/basho/mochiweb.git", - {ref,"8471d2197afd412fcec239dd9ad5cbe90e64eefa"}}, - 2}, - {<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.0">>},3}, - {<<"pbkdf2">>, - {git,"https://github.com/basho/erlang-pbkdf2.git", - {ref,"681494c3ea03625c909a16b1b3ca295edf892057"}}, - 2}, - {<<"poolboy">>, - {git,"https://github.com/basho/poolboy.git", - {ref,"032ea3186fda78b4913deb8932af318ebb9b1258"}}, - 2}, - {<<"protobuffs">>, - {git,"https://github.com/basho/erlang_protobuffs.git", - {ref,"098efad8f85dfe556d64e2cf6ce31f2075808f67"}}, - 3}, - {<<"ranch">>, - {git,"git://github.com/ninenines/ranch.git", - {ref,"d0fad24657711cf584da61b5163c29fdafbd9201"}}, - 1}, - {<<"recon">>, - {git,"https://github.com/ferd/recon", - {ref,"34194da6d9f8ed25f274e0ebb098dc9e95bcf547"}}, - 1}, - {<<"redbug">>, - {git,"https://github.com/massemanet/redbug", - {ref,"c466ddc4f05a34c47bcf0666899c50e40c5223d2"}}, - 1}, - {<<"riak_api">>, - {git,"https://github.com/basho/riak_api.git", - {ref,"85994688946d9c201d08981e756dec564458eeb9"}}, - 1}, - {<<"riak_auth_mods">>, - {git,"https://github.com/basho/riak_auth_mods.git", - {ref,"1eccaef8e9e6200f0b75ea9312f0a731c8d572bf"}}, - 0}, - {<<"riak_core">>, - {git,"https://github.com/basho/riak_core.git", - {ref,"7e0aa310ecf5ec7b9fd03df61b996c2823591950"}}, - 1}, - {<<"riak_dt">>, - {git,"https://github.com/basho/riak_dt.git", - {ref,"d0de4694f1423dc942844fbc494604a3c6df17d6"}}, - 1}, - {<<"riak_ensemble">>, - {git,"https://github.com/basho/riak_ensemble", - {ref,"573a271aa546dcdcaeaaf09b3de6949a3130e021"}}, - 2}, - {<<"riak_kv">>, - {git,"https://github.com/basho/riak_kv.git", - {ref,"0af857d57d0206b100db59043a926df2ada8f7db"}}, - 0}, - {<<"riak_pb">>, - {git,"https://github.com/basho/riak_pb.git", - {ref,"b7abca90e4c708073021d2c4e18c896f1a10b838"}}, - 2}, - {<<"riak_pipe">>, - {git,"https://github.com/basho/riak_pipe.git", - {ref,"899e26181daa0fe2590d7502652c577412140fe1"}}, - 1}, - {<<"riak_repl">>, - {git,"https://github.com/basho/riak_repl.git", - {ref,"c7b4fc2ae1a24b9476c297fe077f5a19c8d30a44"}}, - 0}, - {<<"riak_sysmon">>, - {git,"https://github.com/basho/riak_sysmon.git", - {ref,"726df1f4c31108bb9366fb767b480f286e51f7fc"}}, - 2}, - {<<"riakc">>, - {git,"https://github.com/basho/riak-erlang-client", - {ref,"d9fa46335fda4704fda71cbc011ab6a11e50e3f3"}}, - 2}, - {<<"riakhttpc">>, - {git,"https://github.com/basho/riak-erlang-http-client", - {ref,"fd7255150967245195105f4437904538c17614b1"}}, - 1}, - {<<"riaknostic">>, - {git,"https://github.com/basho/riaknostic.git", - {ref,"8aef63a89d719b22754683cce187eaeeecdd789c"}}, - 0}, - {<<"setup">>,{pkg,<<"setup">>,<<"2.0.2">>},3}, - {<<"sext">>, - {git,"https://github.com/uwiger/sext.git", - {ref,"615eebcf975ec4b4561c6f2b2bc433dabdb2be0f"}}, - 1}, - {<<"sidejob">>, - {git,"https://github.com/basho/sidejob.git", - {ref,"d5e8f8450b92ab30610496ffb58f560d6a8bad6b"}}, - 1}, - {<<"syslog">>, - {git,"git://github.com/Vagabond/erlang-syslog", - {ref,"4a6c6f2c996483e86c1320e9553f91d337bcb6aa"}}, - 1}, - {<<"webmachine">>, - {git,"https://github.com/webmachine/webmachine.git", - {ref,"92225b82fc702f78cf9d23248023ec841272df80"}}, - 2}]}. -[ -{pkg_hash,[ - {<<"bear">>, <<"16264309AE5D005D03718A5C82641FCC259C9E8F09ADEB6FD79CA4271168656F">>}, - {<<"folsom">>, <<"A885F0AEEE4C84270954C88A55A5A473D6B2C7493E32FFDC5765412DD555A951">>}, - {<<"goldrush">>, <<"F06E5D5F1277DA5C413E84D5A2924174182FB108DABB39D5EC548B27424CD106">>}, - {<<"hut">>, <<"08D46679523043424870723923971889E8A34D63B2F946A35B46CF921D1236E7">>}, - {<<"parse_trans">>, <<"09765507A3C7590A784615CFD421D101AEC25098D50B89D7AA1D66646BC571C1">>}, - {<<"setup">>, <<"1203F4CDA11306C2E34434244576DED0A7BBFB0908D9A572356C809BD0CDF085">>}]} -]. diff --git a/rebar3 b/rebar3 index e550663ab..c1597bbc5 100755 Binary files a/rebar3 and b/rebar3 differ diff --git a/rel/.gitignore b/rel/.gitignore new file mode 100644 index 000000000..e615c91bc --- /dev/null +++ b/rel/.gitignore @@ -0,0 +1,2 @@ +.deps/ +.libs/ diff --git a/rel/files/advanced.config b/rel/files/advanced.config index cd3c19fa8..1b1caa4aa 100644 --- a/rel/files/advanced.config +++ b/rel/files/advanced.config @@ -7,7 +7,7 @@ %% cluster_leader will service requests. This can change as nodes %% enter and leave the cluster. {cluster_mgr, {"{{cluster_manager_ip}}", {{cluster_manager_port}} } }, - {schema_dirs, ["./share/schema"]} + {schema_dirs, ["{{platform_lib_dir}}/../share/schema"]} ]}, {riak_repl, diff --git a/rel/files/check_ulimit b/rel/files/hooks/check_ulimit similarity index 100% rename from rel/files/check_ulimit rename to rel/files/hooks/check_ulimit diff --git a/rel/files/erl_codeloadingmode b/rel/files/hooks/erl_codeloadingmode old mode 100644 new mode 100755 similarity index 100% rename from rel/files/erl_codeloadingmode rename to rel/files/hooks/erl_codeloadingmode diff --git a/rel/files/erl_maxlogsize b/rel/files/hooks/erl_maxlogsize old mode 100644 new mode 100755 similarity index 100% rename from rel/files/erl_maxlogsize rename to rel/files/hooks/erl_maxlogsize diff --git a/rel/files/riak_not_running b/rel/files/hooks/riak_not_running old mode 100644 new mode 100755 similarity index 64% rename from rel/files/riak_not_running rename to rel/files/hooks/riak_not_running index b63ca8278..5ee75f109 --- a/rel/files/riak_not_running +++ b/rel/files/hooks/riak_not_running @@ -2,7 +2,9 @@ # -*- tab-width:4;indent-tabs-mode:nil -*- # ex: ts=4 sw=4 et -if relx_nodetool "ping" > /dev/null; then +RIAK="{{platform_bin_dir}}/riak" + +if $RIAK "ping" > /dev/null; then echo "Node is already running!" exit 1 fi diff --git a/rel/files/riak b/rel/files/riak index a04281509..e667130f8 100755 --- a/rel/files/riak +++ b/rel/files/riak @@ -1,57 +1,63 @@ #!/bin/bash -RUNNER_GEN_DIR="${RUNNER_GEN_DIR:-{{ platform_gen_dir }}}" -RELEASE_ROOT_DIR="${RELEASE_ROOT_DIR:-{{ runner_base_dir }}}" -PID_DIR={{pid_dir}} -COMMAND={{platform_bin_dir}}/riak -DEBUG_COMMAND={{platform_bin_dir}}/riak-debug -RUNNER_LOG_DIR={{platform_log_dir}} -RELX_CONFIG_PATH=${RUNNER_GEN_DIR}/sys.config -VMARGS_PATH=${RUNNER_GEN_DIR}/vm.args +RUNNER_GEN_DIR={{platform_gen_dir}} +RELX_RIAK={{platform_bin_dir}}/riak +export PID_DIR={{pid_dir}} +export PIPE_DIR={{pipe_dir}}/ # / is required, see https://www.erlang.org/doc/man/run_erl.html#export +export RUNNER_LOG_DIR={{platform_log_dir}} +mkdir -p $PID_DIR $PIPE_DIR +chown riak:riak $PID_DIR $PIPE_DIR -# On first running the sys.config and vm.args will not be a link -# as cfconfig has not yet been run as a pre_start hook. If there's no -# link use the default for now -if [ ! -L $RELX_CONFIG_PATH ]; then - cp $RELEASE_ROOT_DIR/releases/{{release_version}}/sys.config $RELX_CONFIG_PATH -fi -if [ ! -L $VMARGS_PATH ]; then - cp $RELEASE_ROOT_DIR/releases/{{release_version}}/vm.args $VMARGS_PATH -fi -# When running as a service, running as riak not as root, and systemd has created PID folder -if [[ $EUID -ne 0 ]]; then - case "$1" in - start|console|foreground) - RELX_CONFIG_PATH=${RELX_CONFIG_PATH} VMARGS_PATH=${VMARGS_PATH} RUNNER_LOG_DIR=${RUNNER_LOG_DIR} PIPE_DIR=${PIPE_DIR} ${COMMAND} ${*} -pa {{platform_lib_dir}}/patches - ;; - *) - RELX_CONFIG_PATH=${RELX_CONFIG_PATH} VMARGS_PATH=${VMARGS_PATH} RUNNER_LOG_DIR=${RUNNER_LOG_DIR} PIPE_DIR=${PIPE_DIR} ${COMMAND} ${*} - ;; - esac +# centos7-based distros have a su that contacts pam and prints the "Last logged in" message +if [ "`cat /etc/redhat-release 2>&1`" = "CentOS Stream release 8" ] || + [ "`cat /etc/system-release 2>&1`" = "Amazon Linux release 2 (Karoo)" ]; then + SU="su --session-command" else - # In this case we're running sudo riak - so have root access, but cannot rely - # systemd having created the PID dir, and need to sudo to the riak user - if [ ! -d $PID_DIR ]; then - mkdir $PID_DIR - chown riak:riak $PID_DIR - fi - case "$1" in - start|console|foreground) - su - riak -c "NODETOOL_NODE_PREFIX=${NODETOOL_NODE_PREFIX} RELX_CONFIG_PATH=${RELX_CONFIG_PATH} VMARGS_PATH=${VMARGS_PATH} RUNNER_LOG_DIR=${RUNNER_LOG_DIR} PIPE_DIR=${PIPE_DIR} ${COMMAND} ${*} -pa {{platform_lib_dir}}/patches" - ;; - debug) - # Drop the "debug" from the args as we're going to directly call riak-debug now - shift - # Debug may fail if run via relx script due to use of relative start location, and also need for root access - NODETOOL_NODE_PREFIX=${NODETOOL_NODE_PREFIX} RELX_CONFIG_PATH=${RELX_CONFIG_PATH} VMARGS_PATH=${VMARGS_PATH} RUNNER_LOG_DIR=${RUNNER_LOG_DIR} PIPE_DIR=${PIPE_DIR} ${DEBUG_COMMAND} ${*} - ;; - *) - ESCAPED_ARGS=`echo "$@" | sed -e 's/\([\\\(\\\){}"\x27]\)/\\\\\1/g'` - su - riak -c "NODETOOL_NODE_PREFIX=${NODETOOL_NODE_PREFIX} RELX_CONFIG_PATH=${RELX_CONFIG_PATH} VMARGS_PATH=${VMARGS_PATH} RUNNER_LOG_DIR=${RUNNER_LOG_DIR} PIPE_DIR=${PIPE_DIR} ${COMMAND} ${ESCAPED_ARGS}" - ;; - esac + SU=su fi +function maybe_su { + if [[ $EUID -ne 0 ]]; then + $* + else + # if we are executing an admin command that spins up a + # (hidden) node to then execute custom erlang code via -eval, + # we need to cd to a dir containing the erlang cookie + # (previously implicitly done by su -, which option we have + # removed in order to allow any env vars to be available for + # the ultimate invocation of riak/riak-cs/stanchion) + cd "{{platform_base_dir}}" + # freebsd su is fairly limited, so: + mkdir -p "$RUNNER_GEN_DIR" + chown riak:riak "$RUNNER_GEN_DIR" + f=`mktemp "$RUNNER_GEN_DIR"/su_piggy-XXXXXXX` + cat >"$f" < /dev/null | cut -d = -f 2 | tr -d ' '` + +NODE={{node}} +HOST=${NODE#*@} + +BOOT_FILE="${PLATFORM_BASE_DIR}/releases/{{release_version}}/start_clean" usage() { echo "Usage: $SCRIPT { cluster | join | leave | backup | restore | test | " - echo " reip | js-reload | erl-reload | wait-for-service | " + echo " reip | erl-reload | wait-for-service | " echo " ringready | transfers | force-remove | down |" echo " cluster-info | member-status | ring-status | vnode-status |" echo " aae-status | diag | stat | status | transfer-limit | reformat-indexes |" echo " top [-interval N] [-sort reductions|memory|msg_q] [-lines N] |" echo " downgrade-objects | security | bucket-type | repair-2i |" - echo " search | services | ensemble-status | handoff | set |" + echo " services | ensemble-status | handoff | set |" echo " show | describe }" } @@ -33,23 +52,23 @@ stat_admin() case "$1" in show) shift - relx_nodetool rpc riak_core_console stat_show "$*" + $RPC_HOP riak_core_console stat_show "$*" ;; - info) + info) shift - relx_nodetool rpc riak_core_console stat_info "$*" + $RPC_HOP riak_core_console stat_info "$*" ;; enable) shift - relx_nodetool rpc riak_core_console stat_enable "$*" + $RPC_HOP riak_core_console stat_enable "$*" ;; disable) shift - relx_nodetool rpc riak_core_console stat_disable "$*" + $RPC_HOP riak_core_console stat_disable "$*" ;; reset) shift - relx_nodetool rpc riak_core_console stat_reset "$*" + $RPC_HOP riak_core_console stat_reset "$*" ;; help) shift @@ -235,13 +254,13 @@ cluster_admin() echo "Usage: $SCRIPT cluster join " exit 1 fi - relx_nodetool rpc riak_kv_console staged_join "$2" + $RPC_HOP riak_kv_console staged_join "$2" ;; leave) if [ $# -eq 1 ]; then - relx_nodetool rpc riak_core_console stage_leave + $RPC_HOP riak_core_console stage_leave elif [ $# -eq 2 ]; then - relx_nodetool rpc riak_core_console stage_leave "$2" + $RPC_HOP riak_core_console stage_leave "$2" else echo "Usage: $SCRIPT cluster leave []" exit 1 @@ -252,21 +271,21 @@ cluster_admin() echo "Usage: $SCRIPT cluster force-remove " exit 1 fi - relx_nodetool rpc riak_core_console stage_remove "$2" + $RPC_HOP riak_core_console stage_remove "$2" ;; replace) if [ $# -ne 3 ]; then echo "Usage: $SCRIPT cluster replace " exit 1 fi - relx_nodetool rpc riak_core_console stage_replace "$2" "$3" + $RPC_HOP riak_core_console stage_replace "$2" "$3" ;; force-replace) if [ $# -ne 3 ]; then echo "Usage: $SCRIPT cluster force-replace " exit 1 fi - relx_nodetool rpc riak_core_console stage_force_replace "$2" "$3" + $RPC_HOP riak_core_console stage_force_replace "$2" "$3" ;; resize-ring) if [ $# -ne 2 ]; then @@ -274,30 +293,30 @@ cluster_admin() echo " $SCRIPT cluster resize-ring abort" exit 1 fi - relx_nodetool rpc riak_core_console stage_resize_ring "$2" + $RPC_HOP riak_core_console stage_resize_ring "$2" ;; plan) - relx_nodetool rpc riak_core_console print_staged + $RPC_HOP riak_core_console print_staged ;; commit) - relx_nodetool rpc riak_core_console commit_staged + $RPC_HOP riak_core_console commit_staged ;; clear) - relx_nodetool rpc riak_core_console clear_staged + $RPC_HOP riak_core_console clear_staged ;; status) - relx_nodetool rpc riak_core_console command $SCRIPT cluster $@ + $RPC_HOP riak_core_console command $SCRIPT cluster $@ ;; partitions|partition) - relx_nodetool rpc riak_core_console command $SCRIPT cluster $@ + $RPC_HOP riak_core_console command $SCRIPT cluster $@ ;; partition[_-]count) shift - relx_nodetool rpc riak_core_console command $SCRIPT cluster partition-count $@ + $RPC_HOP riak_core_console command $SCRIPT cluster partition-count $@ ;; location) shift - relx_nodetool rpc riak_core_console command $SCRIPT cluster location $@ + $RPC_HOP riak_core_console command $SCRIPT cluster location $@ ;; *) echo "\ @@ -360,9 +379,9 @@ security_admin() echo "Usage: $SCRIPT security add-user [