Skip to content

Commit

Permalink
Merge branch 'release/1.0.0-rc.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
aramallo committed Sep 28, 2023
2 parents 5fdac0a + 8796e48 commit 6fa9d6f
Show file tree
Hide file tree
Showing 24 changed files with 948 additions and 408 deletions.
33 changes: 29 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ CODESPELL = $(shell which codespell)
SPELLCHECK = $(CODESPELL) -S _build -S doc -S .git -L applys,nd,accout,mattern,pres,fo
SPELLFIX = $(SPELLCHECK) -i 3 -w

# Architecture Auto configuration
UNAME_M := $(shell uname -m)
ifeq ($(UNAME_M), x86_64)
DOCKER_PLATFORM = amd64
else ifeq ($(UNAME_M), aarch64)
DOCKER_PLATFORM = arm64
else ifeq ($(UNAME_M), arm64)
DOCKER_PLATFORM = arm64
else ifeq ($(UNAME_M), armv7l)
DOCKER_PLATFORM = arm32v7
endif

.PHONY: genvars compile check test xref eunit dialyzer tar spellcheck spellfix

Expand All @@ -33,6 +44,10 @@ docs: xref
cp -r doc/assets/* apps/bondy/doc/assets/
cp -r doc/assets/* apps/bondy_broker_bridge/doc/assets/

clean: node1-clean node2-clean node3-clean
${REBAR} clean


clean-docs:
rm -rf apps/bondy/doc/*
rm -f apps/bondy/doc/.build
Expand Down Expand Up @@ -119,18 +134,28 @@ node1:
${REBAR} as node1 release
ERL_DIST_PORT=27781 _build/node1/rel/bondy/bin/bondy console

node1-clean:
${REBAR} as node1 clean

node2:
${REBAR} as node2 release
ERL_DIST_PORT=27782 _build/node2/rel/bondy/bin/bondy console

node2-clean:
${REBAR} as node2 clean

node3:
${REBAR} as node3 release
ERL_DIST_PORT=27783 _build/node3/rel/bondy/bin/bondy console

node3-clean:
${REBAR} as node3 clean

edge1:
${REBAR} as edge1 release
ERL_DIST_PORT=27784 _build/edge1/rel/bondy/bin/bondy console
EDGE1_DEVICE1_PRIVKEY=4ffddd896a530ce5ee8c86b83b0d31835490a97a9cd718cb2f09c9fd31c4a7d71766c9e6ec7d7b354fd7a2e4542753a23cae0b901228305621e5b8713299ccdd \
ERL_DIST_PORT=27784 \
_build/edge1/rel/bondy/bin/bondy console


run-node1:
Expand All @@ -155,7 +180,7 @@ docker-build:
docker rmi bondy-prod || true
docker build \
--pull \
--platform linux/amd64 \
--platform linux/$(DOCKER_PLATFORM) \
--load \
-t "bondy-prod" \
-f deployment/Dockerfile .
Expand All @@ -167,7 +192,7 @@ docker-build-alpine:
docker rmi bondy-prod || true
docker build \
--pull \
--platform linux/amd64 \
--platform linux/$(DOCKER_PLATFORM) \
--load \
-t "bondy-prod" \
-f deployment/alpine.Dockerfile .
Expand All @@ -179,7 +204,7 @@ docker-build-slim:
docker rmi bondy-prod || true
docker build \
--pull \
--platform linux/amd64 \
--platform linux/$(DOCKER_PLATFORM) \
--load \
-t "bondy-prod" \
-f deployment/slim.Dockerfile .
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
![Bondy logo](https://github.com/Leapsight/bondy/blob/develop/doc/assets/bondy_bg.png?raw=true)

![Version](https://img.shields.io/badge/version-1.0.0--beta.78-blue?style=for-the-badge)<br>
![Version](https://img.shields.io/badge/version-1.0.00-rc.1-blue?style=for-the-badge)<br>
![Docker Pulls](https://img.shields.io/docker/pulls/leapsight/bondy?style=for-the-badge)
![Docker Build (master)](https://img.shields.io/github/actions/workflow/status/bondy-io/bondy/docker_image_build.yaml?&branch=master&label=docker-master&style=for-the-badge)
![Docker Build (develop)](https://img.shields.io/github/actions/workflow/status/bondy-io/bondy/docker_image_build.yaml?&branch=develop&label=docker-develop&style=for-the-badge)
![Docker Build (latest-tag)](https://img.shields.io/github/actions/workflow/status/bondy-io/bondy/docker_image_build.yaml?&tag=version-1.0.0-beta.78&label=docker-1.0.0-beta.78&style=for-the-badge)
![Docker Build (latest-tag)](https://img.shields.io/github/actions/workflow/status/bondy-io/bondy/docker_image_build.yaml?&tag=version-1.0.0-rc.1&label=docker-1.0.0-rc.1&style=for-the-badge)
<br>![Architectures](https://img.shields.io/badge/architecture-linux%2Famd64%20%7C%20linux%2Farm64%20%7C%20macOS%2Fintel%20%7C%20macOS%2FM1-lightgrey?style=for-the-badge)


Expand Down Expand Up @@ -134,13 +134,14 @@ leapsight/bondy:master
### Building from source
#### Requirements
* macOS (Intel|Apple Silicon) or Linux (amd64|arm64)
* [Erlang](https://www.erlang.org/) 24 or later
* [Rebar3](https://rebar3.readme.io/) 3.17.0 or later
* [Erlang](https://www.erlang.org/) 26.0.2 or later
* [Rebar3](https://rebar3.readme.io/) 3.22.1 or later
* openssl
* libssl
* [Libsodium](https://github.com/jedisct1/libsodium)
* libsnappy
* liblz4
* libcrypto


#### Building
Expand All @@ -156,7 +157,7 @@ rebar3 as prod tar
Untar and copy the resulting tarball to the location where you want to install Bondy e.g. `~/tmp/bondy`.

```shell
tar -zxvf _build/prod/rel/bondy-1.0.0-beta.78.tar.qz -C ~/tmp/bondy
tar -zxvf _build/prod/rel/bondy-1.0.0-rc.1.tar.qz -C ~/tmp/bondy
```

#### Running
Expand Down
4 changes: 2 additions & 2 deletions apps/bondy/src/bondy.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
"Bondy implements the open Web Application Messaging Protocol (WAMP) "
"and is written in Erlang."
},
{vsn, "1.0.0-beta.78"},
{vsn, "1.0.0-rc.1"},
{registered, []},
%% We pass the version number in the bondy_app:start/2 arguments
{mod, {bondy_app, [{vsn, "1.0.0-beta.78"}]}},
{mod, {bondy_app, [{vsn, "1.0.0-rc.1"}]}},
{applications,[
%% Erlang/OTP
stdlib,
Expand Down
24 changes: 23 additions & 1 deletion apps/bondy/src/bondy_bridge_relay.erl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%% =============================================================================
%% bondy_bridge_relay_listener.erl -
%% bondy_bridge_relay.erl -
%%
%% Copyright (c) 2016-2023 Leapsight. All rights reserved.
%%
Expand Down Expand Up @@ -222,6 +222,28 @@
(_) -> false
end
},
hostname_verification => #{
alias => <<"hostname_verification">>,
%% We rename the prop
key => customize_hostname_check,
required => false,
datatype => {in, [
wildcard, none,
<<"wildcard">>, <<"none">>
]},
validator => fun
(V) when V == <<"wildcard">>; V == wildcard ->
%% tls_options will end up having
%% #{
%% ...
%% customize_hostname_check => [{match_fun, Match}]
%% }
Match = public_key:pkix_verify_hostname_match_fun(https),
{ok, [{match_fun, Match}]};
(_) ->
{ok, []}
end
},
versions => #{
alias => <<"versions">>,
required => true,
Expand Down
4 changes: 2 additions & 2 deletions apps/bondy/src/bondy_bridge_relay_client.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1217,8 +1217,8 @@ signer(_, #{cryptosign := #{privkey_env_var := Var}}) ->
end
end;

signer(_, _) ->
error(invalid_cryptosign_config).
signer(_, Conf) ->
error({invalid_cryptosign_config, Conf}).


%% @private
Expand Down
21 changes: 20 additions & 1 deletion apps/bondy/src/bondy_system_gc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ garbage_collect() ->


init([]) ->
ok = schedule_gc(),
{ok, #state{}}.


Expand All @@ -96,6 +97,10 @@ handle_cast(Event, State) ->
{noreply, State}.


handle_info(scheduled_gc, State) ->
ok = do_gc(),
ok = schedule_gc(),
{noreply, State};

handle_info(Info, State) ->
?LOG_DEBUG(#{
Expand Down Expand Up @@ -123,11 +128,25 @@ code_change(_OldVsn, State, _Extra) ->
%% =============================================================================



schedule_gc() ->
Interval = bondy_config:get(gc_interval, timer:minutes(5)),
erlang:send_after(Interval, self(), scheduled_gc),
ok.



do_gc() ->
L = [element(1, X) || X <- recon:proc_count(memory, 100)],
{process_count, Count} = erlang:system_info(process_count),
Ratio = bondy_config:get(gc_ratio, 0.3),
N = round(Count * Ratio),
L = [element(1, X) || X <- recon:proc_count(memory, N)],

[
erlang:garbage_collect(P)
|| P <- L, {status, waiting} == process_info(P, status)
],

%% We gc ourselves
erlang:garbage_collect(),
ok.
2 changes: 1 addition & 1 deletion apps/bondy/src/bondy_table_owner.erl
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ handle_call({add_and_claim, Name, Opts0}, {From, _Tag}, St) ->
handle_call({add_or_claim, Name, Opts0}, {From, _Tag}, St) ->
case lookup(Name) of
{ok, Tab} ->
ok = do_give_away(Tab, From),
true = do_give_away(Tab, From),
{reply, {ok, Tab}, St};
error ->
Opts1 = set_heir(Opts0),
Expand Down
49 changes: 26 additions & 23 deletions apps/bondy/test/bondy_ct.erl
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
-include_lib("common_test/include/ct.hrl").

-if(?OTP_RELEASE >= 25).
%% already defined by OTP
-define(TEST_SERVER, test_server).
-else.
-define(CT_PEER, ct_slave).
-define(TEST_SERVER, ct_slave).
-endif.

-define(KERNEL_ENV, [
Expand All @@ -45,11 +45,9 @@
[{remote_gl,{fun logger_filters:remote_gl/2,stop}},
{no_domain,
{fun logger_filters:domain/2,{log,undefined,[]}}},
{domain,
{fun logger_filters:domain/2,{stop,equal,[sasl]}}},
{domain,
{fun logger_filters:domain/2,
{log,super,[otp,bondy_audit]}}}],
{log,super,[otp, sasl, bondy_audit]}}}],
formatter =>
{bondy_logger_formatter,#{
colored => true,colored_alert => "\e[0;45m",
Expand Down Expand Up @@ -119,10 +117,15 @@
{tiered_slow_level,0}]},
{partisan,
[{exchange_tick_period,60000},
{tls_options,
[{cacertfile,"./etc/cacert.pem"},
{keyfile,"./etc/key.pem"},
{certfile,"./etc/cert.pem"},
{tls_server_options,
[{cacertfile,"./etc/ssl/server/cacert.pem"},
{keyfile,"./etc/ssl/server/key.pem"},
{certfile,"./etc/ssl/server/keycert.pem"},
{versions,['tlsv1.3']}]},
{tls_client_options,
[{cacertfile,"./etc/ssl/client/cacert.pem"},
{keyfile,"./etc/ssl/client/key.pem"},
{certfile,"./etc/ssl/client/keycert.pem"},
{versions,['tlsv1.3']}]},
{tls,false},
{peer_service_manager,partisan_pluggable_peer_service_manager},
Expand Down Expand Up @@ -166,9 +169,9 @@
{config_file,"./etc/oauth2_config.json"}]},
{bridge_relay_tls,
[{socket_opts,
[{cacertfile,"./etc/cacert.pem"},
{keyfile,"./etc/key.pem"},
{certfile,"./etc/cert.pem"},
[{cacertfile,"./etc/ssl/server/cacert.pem"},
{keyfile,"./etc/ssl/server/key.pem"},
{certfile,"./etc/ssl/server/keycert.pem"},
{nodelay,true},
{keepalive,true},
{versions,['tlsv1.3']}]},
Expand Down Expand Up @@ -206,9 +209,9 @@
{enabled,false}]},
{wamp_tls,
[{socket_opts,
[{cacertfile,"./etc/cacert.pem"},
{keyfile,"./etc/key.pem"},
{certfile,"./etc/cert.pem"},
[{cacertfile,"./etc/ssl/server/cacert.pem"},
{keyfile,"./etc/ssl/server/key.pem"},
{certfile,"./etc/ssl/server/keycert.pem"},
{nodelay,true},
{keepalive,true},
{versions,['tlsv1.2','tlsv1.3']}]},
Expand Down Expand Up @@ -240,9 +243,9 @@
{wamp_serializers,[{bert,4},{erl,15}]},
{api_gateway_https,
[{socket_opts,
[{cacertfile,"./etc/cacert.pem"},
{keyfile,"./etc/key.pem"},
{certfile,"./etc/cert.pem"},
[{cacertfile,"./etc/ssl/server/cacert.pem"},
{keyfile,"./etc/ssl/server/key.pem"},
{certfile,"./etc/ssl/server/keycert.pem"},
{nodelay,true},
{keepalive,false},
{versions,['tlsv1.3']}]},
Expand All @@ -261,9 +264,9 @@
{api_gateway,[{config_file,"./etc/api_gateway_config.json"}]},
{admin_api_https,
[{socket_opts,
[{cacertfile,"./etc/cacert.pem"},
{keyfile,"./etc/key.pem"},
{certfile,"./etc/cert.pem"},
[{cacertfile,"./etc/ssl/server/cacert.pem"},
{keyfile,"./etc/ssl/server/key.pem"},
{certfile,"./etc/ssl/server/keycert.pem"},
{nodelay,true},
{keepalive,false},
{versions,['tlsv1.3']}]},
Expand Down Expand Up @@ -424,7 +427,7 @@ stop_bondy() ->


%% -----------------------------------------------------------------------------
%% @doc Starts a set of CT_PEER nodes as per `Config' and joins them in a
%% @doc Starts a set of TEST_SERVER nodes as per `Config' and joins them in a
%% cluster.
%% @end
%% -----------------------------------------------------------------------------
Expand All @@ -438,7 +441,7 @@ start_cluster(_Case, _Config, _Options) ->
%% -----------------------------------------------------------------------------
stop_nodes(Nodes) ->
StopFun = fun({Name, _Node}) ->
case ?CT_PEER:stop(Name) of
case ?TEST_SERVER:stop(Name) of
{ok, _} ->
ok;
{error, stop_timeout, _} ->
Expand Down
2 changes: 1 addition & 1 deletion apps/bondy_broker_bridge/rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
%% Used by Kafka Bridge
{brod,
{git, "https://github.com/klarna/brod.git", {tag, "3.16.1"}}
{git, "https://github.com/klarna/brod.git", {tag, "3.17.0"}}
},
{hash, ".*",
{git, "https://github.com/leapsight/hash", {branch, master}}
Expand Down
4 changes: 2 additions & 2 deletions apps/bondy_broker_bridge/src/bondy_broker_bridge.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{description,
"Bondy Broker Bridge is an application that is part of Bondy and provides a way to integrate Events with external brokers and systems."
},
{vsn, "1.0.0-beta.78"},
{vsn, "1.0.0-rc.1"},
{registered, []},
{mod, {bondy_broker_bridge_app, []}},
{applications, [
Expand All @@ -26,4 +26,4 @@
{"Website", "https://getbondy.io"},
{"Docker", "https://hub.docker.com/r/leapsight/bondy"}
]}
]}.
]}.
Loading

0 comments on commit 6fa9d6f

Please sign in to comment.