Skip to content

Use Khepri to store vhosts, users and runtime parameters #4703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions BUILD.khepri
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
load("@rules_erlang//:erlang_app.bzl", "erlang_app", "DEFAULT_ERLC_OPTS")

erlang_app(
app_name = "khepri",
app_description = "ZooKeeper-inspired database library",
app_version = "main",
app_module = "khepri_app",
erlc_opts = ["-I", "external/khepri"] + DEFAULT_ERLC_OPTS,
extra_apps = [
"sasl",
],
deps = [
"@ra//:erlang_app",
],
)
13 changes: 13 additions & 0 deletions deps/rabbit/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ _APP_ENV = """[
DEPS = [
"//deps/amqp10_common:erlang_app",
"//deps/rabbit_common:erlang_app",
"@khepri//:erlang_app",
"@ra//:erlang_app",
"@ranch//:erlang_app",
"@stdout_formatter//:erlang_app",
Expand Down Expand Up @@ -504,6 +505,18 @@ suites = [
":rabbit_ha_test_producer",
],
),
rabbitmq_integration_suite(
PACKAGE,
name = "metadata_store_phase1_SUITE",
size = "small",
deps = [
"@khepri//:erlang_app",
],
runtime_deps = [
"@meck//:erlang_app",
"@ra//:erlang_app",
],
),
rabbitmq_integration_suite(
PACKAGE,
name = "message_size_limit_SUITE",
Expand Down
3 changes: 2 additions & 1 deletion deps/rabbit/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ APPS_DIR := $(CURDIR)/apps
LOCAL_DEPS = sasl rabbitmq_prelaunch os_mon inets compiler public_key crypto ssl syntax_tools xmerl

BUILD_DEPS = rabbitmq_cli
DEPS = ranch rabbit_common ra sysmon_handler stdout_formatter recon redbug observer_cli osiris amqp10_common syslog systemd seshat
DEPS = ranch rabbit_common ra sysmon_handler stdout_formatter recon redbug observer_cli osiris amqp10_common syslog systemd seshat khepri
TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers amqp_client meck proper

PLT_APPS += mnesia
Expand All @@ -148,6 +148,7 @@ dep_syslog = git https://github.com/schlagert/syslog 4.0.0
dep_osiris = git https://github.com/rabbitmq/osiris main
dep_systemd = hex 0.6.1
dep_seshat = hex 0.3.2
dep_khepri = git https://github.com/rabbitmq/khepri.git 15721dc37b84e14d9820b74b106cd56f763acd1c

define usage_xml_to_erl
$(subst __,_,$(patsubst $(DOCS_DIR)/rabbitmq%.1.xml, src/rabbit_%_usage.erl, $(subst -,_,$(1))))
Expand Down
13 changes: 13 additions & 0 deletions deps/rabbit/include/internal_user.hrl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
%% This Source Code Form is subject to the terms of the Mozilla Public
%% License, v. 2.0. If a copy of the MPL was not distributed with this
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
%%
%% Copyright (c) 2021 VMware, Inc. or its affiliates. All rights reserved.
%%

-define(is_internal_user(V),
(?is_internal_user_v2(V) orelse
?is_internal_user_v1(V))).

-define(is_internal_user_v1(V), is_record(V, internal_user, 5)).
-define(is_internal_user_v2(V), is_record(V, internal_user, 6)).
4 changes: 4 additions & 0 deletions deps/rabbit/src/rabbit.erl
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,10 @@ run_prelaunch_second_phase() ->

ok = rabbit_ra_systems:setup(Context),

%% Khepri requires the "coordination" Ra system to be started by the
%% previous call, but will ensure it runs anyway.
ok = rabbit_khepri:setup(Context),

?LOG_DEBUG(""),
?LOG_DEBUG("== Prelaunch DONE =="),

Expand Down
Loading