From ae9e7397079733992e0a2f00dc8db6acf1112866 Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Thu, 22 May 2025 15:50:27 +0300 Subject: [PATCH 01/13] Upgrades to dmt-client v2 --- apps/hellgate/src/hg_domain.erl | 72 ++++++++---------- .../src/hg_invoice_payment_refund.erl | 2 +- apps/hellgate/test/hg_ct_helper.erl | 5 +- apps/hellgate/test/hg_invoice_tests_SUITE.erl | 12 +-- apps/hellgate/test/hg_limiter_helper.erl | 19 +++-- apps/hellgate/test/hg_mock_helper.erl | 6 +- .../test/hg_route_rules_tests_SUITE.erl | 44 ++++++----- compose.tracing.yaml | 2 +- compose.yaml | 50 ++++++++++--- rebar.config | 31 +++----- rebar.lock | 65 ++++++++-------- test/dominant/sys.config | 74 +++++++++++++++++++ test/machinegun/config.yaml | 4 - 13 files changed, 238 insertions(+), 148 deletions(-) create mode 100644 test/dominant/sys.config diff --git a/apps/hellgate/src/hg_domain.erl b/apps/hellgate/src/hg_domain.erl index df2586a5..35b1c0cf 100644 --- a/apps/hellgate/src/hg_domain.erl +++ b/apps/hellgate/src/hg_domain.erl @@ -6,28 +6,23 @@ -module(hg_domain). --include_lib("damsel/include/dmsl_domain_thrift.hrl"). --include_lib("damsel/include/dmsl_domain_conf_thrift.hrl"). +-include_lib("damsel/include/dmsl_domain_conf_v2_thrift.hrl"). %% -export([head/0]). -export([get/1]). -export([get/2]). --export([find/2]). --export([exists/2]). --export([commit/2]). -export([reset/1]). -export([insert/1]). -export([update/1]). -export([upsert/1]). --export([remove/1]). -export([cleanup/0]). %% --type revision() :: dmt_client:version(). +-type revision() :: dmt_client:vsn(). -type ref() :: dmsl_domain_thrift:'Reference'(). -type object() :: dmsl_domain_thrift:'DomainObject'(). -type data() :: _. @@ -39,7 +34,7 @@ -spec head() -> revision(). head() -> - dmt_client:get_last_version(). + dmt_client:get_latest_version(). -spec get(ref()) -> data() | no_return(). get(Ref) -> @@ -50,60 +45,55 @@ get(Revision, Ref) -> try extract_data(dmt_client:checkout_object(Revision, Ref)) catch - throw:#domain_conf_ObjectNotFound{} -> + throw:#domain_conf_v2_ObjectNotFound{} -> error({object_not_found, {Revision, Ref}}) end. --spec find(revision(), ref()) -> data() | notfound. -find(Revision, Ref) -> - try - extract_data(dmt_client:checkout_object(Revision, Ref)) - catch - throw:#domain_conf_ObjectNotFound{} -> - notfound - end. - --spec exists(revision(), ref()) -> boolean(). -exists(Revision, Ref) -> - try - _ = dmt_client:checkout_object(Revision, Ref), - true - catch - throw:#domain_conf_ObjectNotFound{} -> - false - end. - -extract_data({_Tag, {_Name, _Ref, Data}}) -> +extract_data(#domain_conf_v2_VersionedObject{object = {_Tag, {_Name, _Ref, Data}}}) -> Data. --spec commit(revision(), dmt_client:commit()) -> revision() | no_return(). -commit(Revision, Commit) -> - dmt_client:commit(Revision, Commit). - -spec reset(revision()) -> revision() | no_return(). reset(ToRevision) -> - #domain_conf_Snapshot{domain = Domain} = dmt_client:checkout(ToRevision), - upsert(maps:values(Domain)). + Objects = dmt_client:checkout_all(ToRevision), + upsert(unwrap_versioned_objects(Objects)). %% convenience shortcuts, use carefully -spec insert(object() | [object()]) -> revision() | no_return(). insert(ObjectOrMany) -> - dmt_client:insert(ObjectOrMany). + dmt_client:insert(ObjectOrMany, ensure_stub_author()). -spec update(object() | [object()]) -> revision() | no_return(). update(NewObjectOrMany) -> - dmt_client:update(NewObjectOrMany). + dmt_client:update(NewObjectOrMany, ensure_stub_author()). -spec upsert(object() | [object()]) -> revision() | no_return(). upsert(NewObjectOrMany) -> - dmt_client:upsert(NewObjectOrMany). + dmt_client:upsert(NewObjectOrMany, ensure_stub_author()). -spec remove(object() | [object()]) -> revision() | no_return(). remove(ObjectOrMany) -> - dmt_client:remove(ObjectOrMany). + dmt_client:remove(ObjectOrMany, ensure_stub_author()). -spec cleanup() -> revision() | no_return(). cleanup() -> - #domain_conf_Snapshot{domain = Domain} = dmt_client:checkout(latest), - remove(maps:values(Domain)). + Objects = dmt_client:checkout_all(latest), + remove(unwrap_versioned_objects(Objects)). + +ensure_stub_author() -> + %% TODO DISCUSS Stubs and fallback authors + ensure_author(~b"unknown", ~b"unknown@local"). + +ensure_author(Name, Email) -> + try + #domain_conf_v2_Author{id = ID} = dmt_client:get_author_by_email(Email), + ID + catch + throw:#domain_conf_v2_AuthorNotFound{} -> + dmt_client:create_author(Name, Email) + end. + +%% + +unwrap_versioned_objects(VersionedObjects) -> + lists:map(fun(#domain_conf_v2_VersionedObject{object = Object}) -> Object end, VersionedObjects). diff --git a/apps/hellgate/src/hg_invoice_payment_refund.erl b/apps/hellgate/src/hg_invoice_payment_refund.erl index c6c589bb..61d7d680 100644 --- a/apps/hellgate/src/hg_invoice_payment_refund.erl +++ b/apps/hellgate/src/hg_invoice_payment_refund.erl @@ -88,7 +88,7 @@ -type session() :: hg_session:t(). -type trx_info() :: dmsl_domain_thrift:'TransactionInfo'(). -type failure() :: dmsl_domain_thrift:'OperationFailure'(). --type revision() :: dmt_client:version(). +-type revision() :: dmt_client:vsn(). -type cash() :: dmsl_domain_thrift:'Cash'(). -type timestamp() :: dmsl_base_thrift:'Timestamp'(). -type route() :: dmsl_domain_thrift:'PaymentRoute'(). diff --git a/apps/hellgate/test/hg_ct_helper.erl b/apps/hellgate/test/hg_ct_helper.erl index c8d1375d..293f353f 100644 --- a/apps/hellgate/test/hg_ct_helper.erl +++ b/apps/hellgate/test/hg_ct_helper.erl @@ -110,8 +110,9 @@ start_app(dmt_client = AppName) -> }} ]}, {service_urls, #{ - 'Repository' => <<"http://dominant:8022/v1/domain/repository">>, - 'RepositoryClient' => <<"http://dominant:8022/v1/domain/repository_client">> + 'AuthorManagement' => <<"http://dmt:8022/v1/domain/author">>, + 'Repository' => <<"http://dmt:8022/v1/domain/repository">>, + 'RepositoryClient' => <<"http://dmt:8022/v1/domain/repository_client">> }} ]), #{} diff --git a/apps/hellgate/test/hg_invoice_tests_SUITE.erl b/apps/hellgate/test/hg_invoice_tests_SUITE.erl index d6652cd1..70a7048e 100644 --- a/apps/hellgate/test/hg_invoice_tests_SUITE.erl +++ b/apps/hellgate/test/hg_invoice_tests_SUITE.erl @@ -1218,7 +1218,7 @@ payment_shop_limit_success(C) -> #domain_TurnoverLimit{ id = ?SHOPLIMIT_ID, upper_boundary = ?LIMIT_UPPER_BOUNDARY, - domain_revision = dmt_client:get_last_version() + domain_revision = dmt_client:get_latest_version() } ], ShopID = hg_ct_helper:create_shop(PartyID, ?cat(1), <<"RUB">>, ?tmpl(1), ?pinst(1), TurnoverLimits, PartyClient), @@ -1239,7 +1239,7 @@ payment_shop_limit_overflow(C) -> #domain_TurnoverLimit{ id = ?SHOPLIMIT_ID, upper_boundary = ?LIMIT_UPPER_BOUNDARY, - domain_revision = dmt_client:get_last_version() + domain_revision = dmt_client:get_latest_version() } ]), ShopID = hg_ct_helper:create_shop(PartyID, ?cat(1), <<"RUB">>, ?tmpl(1), ?pinst(1), TurnoverLimits, PartyClient), @@ -1262,7 +1262,7 @@ payment_shop_limit_more_overflow(C) -> #domain_TurnoverLimit{ id = ?SHOPLIMIT_ID, upper_boundary = ?LIMIT_UPPER_BOUNDARY, - domain_revision = dmt_client:get_last_version() + domain_revision = dmt_client:get_latest_version() } ]), ShopID = hg_ct_helper:create_shop(PartyID, ?cat(1), <<"RUB">>, ?tmpl(1), ?pinst(1), TurnoverLimits, PartyClient), @@ -9960,7 +9960,7 @@ construct_domain_fixture() -> #domain_TurnoverLimit{ id = ?LIMIT_ID, upper_boundary = ?LIMIT_UPPER_BOUNDARY, - domain_revision = dmt_client:get_last_version() + domain_revision = dmt_client:get_latest_version() } ]} } @@ -10013,7 +10013,7 @@ construct_domain_fixture() -> #domain_TurnoverLimit{ id = ?LIMIT_ID2, upper_boundary = ?LIMIT_UPPER_BOUNDARY, - domain_revision = dmt_client:get_last_version() + domain_revision = dmt_client:get_latest_version() } ]} } @@ -10058,7 +10058,7 @@ construct_domain_fixture() -> #domain_TurnoverLimit{ id = ?LIMIT_ID3, upper_boundary = ?LIMIT_UPPER_BOUNDARY, - domain_revision = dmt_client:get_last_version() + domain_revision = dmt_client:get_latest_version() } ]} } diff --git a/apps/hellgate/test/hg_limiter_helper.erl b/apps/hellgate/test/hg_limiter_helper.erl index 79f141e1..b0b8b83c 100644 --- a/apps/hellgate/test/hg_limiter_helper.erl +++ b/apps/hellgate/test/hg_limiter_helper.erl @@ -29,13 +29,18 @@ -spec init_per_suite(config()) -> dmt_client:vsn(). init_per_suite(_Config) -> - dmt_client:upsert([ - {limit_config, mk_config_object(?LIMIT_ID)}, - {limit_config, mk_config_object(?LIMIT_ID2)}, - {limit_config, mk_config_object(?LIMIT_ID3)}, - {limit_config, mk_config_object(?LIMIT_ID4)}, - {limit_config, mk_config_object(?SHOPLIMIT_ID)} - ]). + dmt_client:upsert( + latest, + [ + {limit_config, mk_config_object(?LIMIT_ID)}, + {limit_config, mk_config_object(?LIMIT_ID2)}, + {limit_config, mk_config_object(?LIMIT_ID3)}, + {limit_config, mk_config_object(?LIMIT_ID4)}, + {limit_config, mk_config_object(?SHOPLIMIT_ID)} + ], + dmt_client:create_author(genlib:unique(), genlib:unique()), + #{} + ). -spec get_amount(_) -> pos_integer(). get_amount(#limiter_Limit{amount = Amount}) -> diff --git a/apps/hellgate/test/hg_mock_helper.erl b/apps/hellgate/test/hg_mock_helper.erl index eb743fe9..b4648c7f 100644 --- a/apps/hellgate/test/hg_mock_helper.erl +++ b/apps/hellgate/test/hg_mock_helper.erl @@ -59,10 +59,12 @@ mock_services(Services, SupPid) -> mock_dominant(Services0, SupPid) -> Services1 = lists:map( fun + ({'AuthorManagement', Fun}) -> + {'AuthorManagement', {dmsl_domain_conf_v2_thrift, 'AuthorManagement'}, Fun}; ({'Repository', Fun}) -> - {'Repository', {dmsl_domain_conf_thrift, 'Repository'}, Fun}; + {'Repository', {dmsl_domain_conf_v2_thrift, 'Repository'}, Fun}; ({'RepositoryClient', Fun}) -> - {'RepositoryClient', {dmsl_domain_conf_thrift, 'RepositoryClient'}, Fun} + {'RepositoryClient', {dmsl_domain_conf_v2_thrift, 'RepositoryClient'}, Fun} end, Services0 ), diff --git a/apps/hellgate/test/hg_route_rules_tests_SUITE.erl b/apps/hellgate/test/hg_route_rules_tests_SUITE.erl index 28692884..2f81c9c4 100644 --- a/apps/hellgate/test/hg_route_rules_tests_SUITE.erl +++ b/apps/hellgate/test/hg_route_rules_tests_SUITE.erl @@ -4,7 +4,7 @@ -include("hg_ct_domain.hrl"). -include_lib("common_test/include/ct.hrl"). --include_lib("damsel/include/dmsl_domain_conf_thrift.hrl"). +-include_lib("damsel/include/dmsl_domain_conf_v2_thrift.hrl"). -include_lib("damsel/include/dmsl_payproc_thrift.hrl"). -include_lib("fault_detector_proto/include/fd_proto_fault_detector_thrift.hrl"). -include_lib("stdlib/include/assert.hrl"). @@ -149,24 +149,34 @@ mock_dominant(SupPid) -> Domain = construct_domain_fixture(), RoutingWithFailRateDomain = routing_with_risk_score_fixture(Domain, false), RoutingWithRiskCoverageSetDomain = routing_with_risk_score_fixture(Domain, true), + Getter = fun(Version, Ref, Objects) -> + case maps:get(Ref, Objects, undefined) of + undefined -> + woody_error:raise(business, #domain_conf_v2_ObjectNotFound{}); + Object -> + {ok, #domain_conf_v2_VersionedObject{ + object = Object, + info = #domain_conf_v2_VersionedObjectInfo{ + version = Version, + changed_at = hg_datetime:format_now(), + changed_by = #domain_conf_v2_Author{ + id = ~b"42", + name = ~b"Whoever", + email = ~b"whoever@whereever" + } + } + }} + end + end, _ = hg_mock_helper:mock_dominant( [ - {'Repository', fun - ('Checkout', {{version, ?routing_with_fail_rate_domain_revision}}) -> - {ok, #'domain_conf_Snapshot'{ - version = ?routing_with_fail_rate_domain_revision, - domain = RoutingWithFailRateDomain - }}; - ('Checkout', {{version, ?routing_with_risk_coverage_set_domain_revision}}) -> - {ok, #'domain_conf_Snapshot'{ - version = ?routing_with_risk_coverage_set_domain_revision, - domain = RoutingWithRiskCoverageSetDomain - }}; - ('Checkout', {{version, Version}}) -> - {ok, #'domain_conf_Snapshot'{ - version = Version, - domain = Domain - }} + {'RepositoryClient', fun + ('CheckoutObject', {{version, ?routing_with_fail_rate_domain_revision = Version}, ObjectRef}) -> + Getter(Version, ObjectRef, RoutingWithFailRateDomain); + ('CheckoutObject', {{version, ?routing_with_risk_coverage_set_domain_revision = Version}, ObjectRef}) -> + Getter(Version, ObjectRef, RoutingWithRiskCoverageSetDomain); + ('CheckoutObject', {{version, Version}, ObjectRef}) -> + Getter(Version, ObjectRef, Domain) end} ], SupPid diff --git a/compose.tracing.yaml b/compose.tracing.yaml index 9894d88c..e55c1ff7 100644 --- a/compose.tracing.yaml +++ b/compose.tracing.yaml @@ -1,6 +1,6 @@ services: - dominant: + dmt: environment: &otlp_enabled OTEL_TRACES_EXPORTER: otlp OTEL_TRACES_SAMPLER: parentbased_always_off diff --git a/compose.yaml b/compose.yaml index 86afe3b1..d1559264 100644 --- a/compose.yaml +++ b/compose.yaml @@ -13,7 +13,7 @@ services: depends_on: machinegun: condition: service_healthy - dominant: + dmt: condition: service_healthy party-management: condition: service_healthy @@ -28,17 +28,39 @@ services: working_dir: $PWD command: /sbin/init - dominant: - image: ghcr.io/valitydev/dominant:sha-fae8726 - command: /opt/dominant/bin/dominant foreground + dmt: + image: ghcr.io/valitydev/dominant-v2:sha-d939dec-epic-fixes_for_client + command: /opt/dmt/bin/dmt foreground + healthcheck: + test: "/opt/dmt/bin/dmt ping" + interval: 5s + timeout: 3s + retries: 12 + ports: + - 8022:8022 + hostname: dmt + environment: + POSTGRES_HOST: dmt-db + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: dmt depends_on: - machinegun: + dmt-db: condition: service_healthy + volumes: + - ./test/dominant/sys.config:/opt/dmt/releases/0.1/sys.config + + dmt-db: + image: postgres + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: dmt healthcheck: - test: "/opt/dominant/bin/dominant ping" - interval: 10s + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 5s timeout: 5s - retries: 10 + retries: 5 machinegun: image: ghcr.io/valitydev/mg2:sha-436f723 @@ -116,7 +138,8 @@ services: - --spring.flyway.password=postgres - --service.skipExistedHoldOps=false depends_on: - - liminator-db + liminator-db: + condition: service_healthy healthcheck: test: "curl http://localhost:8022/actuator/health" interval: 5s @@ -129,6 +152,11 @@ services: - POSTGRES_DB=liminator - POSTGRES_USER=vality - POSTGRES_PASSWORD=postgres + healthcheck: + test: ["CMD-SHELL", "pg_isready -U vality -d liminator"] + interval: 5s + timeout: 5s + retries: 5 party-management: image: ghcr.io/valitydev/party-management:sha-b78d0f5 @@ -136,7 +164,7 @@ services: depends_on: machinegun: condition: service_healthy - dominant: + dmt: condition: service_started shumway: condition: service_started @@ -163,8 +191,6 @@ services: PGDATA: "/tmp/postgresql/data/pgdata" volumes: - progressor-data:/tmp/postgresql/data - ports: - - "5432:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U progressor -d progressor_db"] interval: 10s diff --git a/rebar.config b/rebar.config index e8e0a505..402a37a4 100644 --- a/rebar.config +++ b/rebar.config @@ -29,27 +29,27 @@ {recon, "2.5.2"}, {cache, "2.3.3"}, {gproc, "0.9.0"}, - {genlib, {git, "https://github.com/valitydev/genlib.git", {branch, "master"}}}, - {woody, {git, "https://github.com/valitydev/woody_erlang.git", {branch, "master"}}}, - {damsel, {git, "https://github.com/valitydev/damsel.git", {branch, "master"}}}, + {genlib, {git, "https://github.com/valitydev/genlib.git", {tag, "v1.1.0"}}}, + {woody, {git, "https://github.com/valitydev/woody_erlang.git", {tag, "v1.1.0"}}}, + {damsel, {git, "https://github.com/valitydev/damsel.git", {tag, "v2.0.0"}}}, {payproc_errors, {git, "https://github.com/valitydev/payproc-errors-erlang.git", {branch, "master"}}}, {mg_proto, {git, "https://github.com/valitydev/machinegun-proto.git", {branch, "master"}}}, - {dmt_client, {git, "https://github.com/valitydev/dmt-client.git", {branch, "master"}}}, - {scoper, {git, "https://github.com/valitydev/scoper.git", {branch, "master"}}}, + {dmt_client, {git, "https://github.com/valitydev/dmt-client.git", {branch, "v2"}}}, + {scoper, {git, "https://github.com/valitydev/scoper.git", {tag, "v1.1.0"}}}, {party_client, {git, "https://github.com/valitydev/party-client-erlang.git", {branch, "master"}}}, - {bender_client, {git, "https://github.com/valitydev/bender-client-erlang.git", {branch, "master"}}}, + {bender_client, {git, "https://github.com/valitydev/bender-client-erlang.git", {tag, "v1.1.0"}}}, {erl_health, {git, "https://github.com/valitydev/erlang-health.git", {branch, "master"}}}, {fault_detector_proto, {git, "https://github.com/valitydev/fault-detector-proto.git", {branch, "master"}}}, {limiter_proto, {git, "https://github.com/valitydev/limiter-proto.git", {branch, "master"}}}, {herd, {git, "https://github.com/wgnet/herd.git", {tag, "1.3.4"}}}, {progressor, {git, "https://github.com/valitydev/progressor.git", {tag, "v1.0.0"}}}, - {prometheus, "4.8.1"}, - {prometheus_cowboy, "0.1.8"}, + {prometheus, "4.11.0"}, + {prometheus_cowboy, "0.1.9"}, %% OpenTelemetry deps - {opentelemetry_api, "1.2.1"}, - {opentelemetry, "1.3.0"}, - {opentelemetry_exporter, "1.3.0"} + {opentelemetry_api, "1.4.0"}, + {opentelemetry, "1.5.0"}, + {opentelemetry_exporter, "1.8.0"} ]}. {xref_checks, [ @@ -68,7 +68,6 @@ % mandatory unmatched_returns, error_handling, - % race_conditions, unknown ]}, {plt_apps, all_deps} @@ -134,14 +133,6 @@ ]} ]}. -%% NOTE -%% It is needed to use rebar3 lint plugin -{overrides, [ - {del, accept, [{plugins, [{rebar3_archive_plugin, "0.0.2"}]}]}, - {del, prometheus_cowboy, [{plugins, [{rebar3_archive_plugin, "0.0.1"}]}]}, - {del, prometheus_httpd, [{plugins, [{rebar3_archive_plugin, "0.0.1"}]}]} -]}. - {shell, [ {config, "config/sys.config"}, {apps, [hellgate, hg_client, hg_progressor, hg_proto, routing, recon]} diff --git a/rebar.lock b/rebar.lock index 2b636cd5..add7fee4 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,9 +1,9 @@ {"1.2.0", -[{<<"accept">>,{pkg,<<"accept">>,<<"0.3.5">>},2}, +[{<<"accept">>,{pkg,<<"accept">>,<<"0.3.7">>},2}, {<<"acceptor_pool">>,{pkg,<<"acceptor_pool">>,<<"1.0.0">>},2}, {<<"bender_client">>, {git,"https://github.com/valitydev/bender-client-erlang.git", - {ref,"d8837617c8dc36216ce8c4ffc9a56a34e423ca5e"}}, + {ref,"2fceffde5deac85d3bd3f071187041d84c8c3af4"}}, 0}, {<<"bender_proto">>, {git,"https://github.com/valitydev/bender-proto.git", @@ -27,11 +27,11 @@ {<<"ctx">>,{pkg,<<"ctx">>,<<"0.6.0">>},2}, {<<"damsel">>, {git,"https://github.com/valitydev/damsel.git", - {ref,"24932cdc557a75bfb3a4aeb1738638366003aba4"}}, + {ref,"35a8abf6c006d744617d770aef5948a0322f2bd5"}}, 0}, {<<"dmt_client">>, {git,"https://github.com/valitydev/dmt-client.git", - {ref,"d8a4f490d49c038d96f1cbc2a279164c6f4039f9"}}, + {ref,"e178110d2e30a3abcffcb65fec33c9b918e22bc3"}}, 0}, {<<"dmt_core">>, {git,"https://github.com/valitydev/dmt-core.git", @@ -55,7 +55,7 @@ 0}, {<<"genlib">>, {git,"https://github.com/valitydev/genlib.git", - {ref,"f6074551d6586998e91a97ea20acb47241254ff3"}}, + {ref,"d2324089afbbd9630e85fac554620f1de0b33dfe"}}, 0}, {<<"gproc">>,{pkg,<<"gproc">>,<<"0.9.0">>},0}, {<<"grpcbox">>,{pkg,<<"grpcbox">>,<<"0.17.1">>},1}, @@ -83,14 +83,11 @@ {git,"https://github.com/valitydev/msgpack-proto.git", {ref,"7e447496aa5df4a5f1ace7ef2e3c31248b2a3ed0"}}, 2}, - {<<"opentelemetry">>,{pkg,<<"opentelemetry">>,<<"1.3.0">>},0}, - {<<"opentelemetry_api">>,{pkg,<<"opentelemetry_api">>,<<"1.2.1">>},0}, + {<<"opentelemetry">>,{pkg,<<"opentelemetry">>,<<"1.5.0">>},0}, + {<<"opentelemetry_api">>,{pkg,<<"opentelemetry_api">>,<<"1.4.0">>},0}, {<<"opentelemetry_exporter">>, - {pkg,<<"opentelemetry_exporter">>,<<"1.3.0">>}, + {pkg,<<"opentelemetry_exporter">>,<<"1.8.0">>}, 0}, - {<<"opentelemetry_semantic_conventions">>, - {pkg,<<"opentelemetry_semantic_conventions">>,<<"0.2.0">>}, - 1}, {<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.1">>},2}, {<<"party_client">>, {git,"https://github.com/valitydev/party-client-erlang.git", @@ -104,15 +101,15 @@ {git,"https://github.com/valitydev/progressor.git", {ref,"e2fdf9d11a69e239d3f4dc51aa2dd122d44ee1b0"}}, 0}, - {<<"prometheus">>,{pkg,<<"prometheus">>,<<"4.8.1">>},0}, - {<<"prometheus_cowboy">>,{pkg,<<"prometheus_cowboy">>,<<"0.1.8">>},0}, - {<<"prometheus_httpd">>,{pkg,<<"prometheus_httpd">>,<<"2.1.11">>},1}, + {<<"prometheus">>,{pkg,<<"prometheus">>,<<"4.11.0">>},0}, + {<<"prometheus_cowboy">>,{pkg,<<"prometheus_cowboy">>,<<"0.1.9">>},0}, + {<<"prometheus_httpd">>,{pkg,<<"prometheus_httpd">>,<<"2.1.15">>},1}, {<<"quantile_estimator">>,{pkg,<<"quantile_estimator">>,<<"0.2.1">>},1}, {<<"ranch">>,{pkg,<<"ranch">>,<<"1.8.0">>},2}, {<<"recon">>,{pkg,<<"recon">>,<<"2.5.2">>},0}, {<<"scoper">>, {git,"https://github.com/valitydev/scoper.git", - {ref,"55a2a32ee25e22fa35f583a18eaf38b2b743429b"}}, + {ref,"0e7aa01e9632daa39727edd62d4656ee715b4569"}}, 0}, {<<"snowflake">>, {git,"https://github.com/valitydev/snowflake.git", @@ -124,16 +121,16 @@ {ref,"3a60e5dc5bbd709495024f26e100b041c3547fd9"}}, 1}, {<<"tls_certificate_check">>, - {pkg,<<"tls_certificate_check">>,<<"1.24.0">>}, + {pkg,<<"tls_certificate_check">>,<<"1.27.0">>}, 1}, {<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.7.0">>},2}, {<<"woody">>, {git,"https://github.com/valitydev/woody_erlang.git", - {ref,"072825ee7179825a4078feb0649df71303c74157"}}, + {ref,"cc983a9423325ba1d6a509775eb6ff7ace721539"}}, 0}]}. [ {pkg_hash,[ - {<<"accept">>, <<"B33B127ABCA7CC948BBE6CAA4C263369ABF1347CFA9D8E699C6D214660F10CD1">>}, + {<<"accept">>, <<"CD6E34A2D7E28CA38B2D3CB233734CA0C221EFBC1F171F91FEC5F162CC2D18DA">>}, {<<"acceptor_pool">>, <<"43C20D2ACAE35F0C2BCD64F9D2BDE267E459F0F3FD23DAB26485BF518C281B21">>}, {<<"brod">>, <<"51F4DFF17ED43A806558EBD62CC88E7B35AED336D1BA1F3DE2D010F463D49736">>}, {<<"cache">>, <<"B23A5FE7095445A88412A6E614C933377E0137B44FFED77C9B3FEF1A731A20B2">>}, @@ -153,22 +150,21 @@ {<<"kafka_protocol">>, <<"F917B6C90C8DF0DE2B40A87D6B9AE1CFCE7788E91A65818E90E40CF76111097A">>}, {<<"metrics">>, <<"25F094DEA2CDA98213CECC3AEFF09E940299D950904393B2A29D191C346A8486">>}, {<<"mimerl">>, <<"D0CD9FC04B9061F82490F6581E0128379830E78535E017F7780F37FEA7545726">>}, - {<<"opentelemetry">>, <<"988AC3C26ACAC9720A1D4FB8D9DC52E95B45ECFEC2D5B5583276A09E8936BC5E">>}, - {<<"opentelemetry_api">>, <<"7B69ED4F40025C005DE0B74FCE8C0549625D59CB4DF12D15C32FE6DC5076FF42">>}, - {<<"opentelemetry_exporter">>, <<"1D8809C0D4F4ACF986405F7700ED11992BCBDB6A4915DD11921E80777FFA7167">>}, - {<<"opentelemetry_semantic_conventions">>, <<"B67FE459C2938FCAB341CB0951C44860C62347C005ACE1B50F8402576F241435">>}, + {<<"opentelemetry">>, <<"7DDA6551EDFC3050EA4B0B40C0D2570423D6372B97E9C60793263EF62C53C3C2">>}, + {<<"opentelemetry_api">>, <<"63CA1742F92F00059298F478048DFB826F4B20D49534493D6919A0DB39B6DB04">>}, + {<<"opentelemetry_exporter">>, <<"5D546123230771EF4174E37BEDFD77E3374913304CD6EA3CA82A2ADD49CD5D56">>}, {<<"parse_trans">>, <<"16328AB840CC09919BD10DAB29E431DA3AF9E9E7E7E6F0089DD5A2D2820011D8">>}, - {<<"prometheus">>, <<"FA76B152555273739C14B06F09F485CF6D5D301FE4E9D31B7FF803D26025D7A0">>}, - {<<"prometheus_cowboy">>, <<"CFCE0BC7B668C5096639084FCD873826E6220EA714BF60A716F5BD080EF2A99C">>}, - {<<"prometheus_httpd">>, <<"F616ED9B85B536B195D94104063025A91F904A4CFC20255363F49A197D96C896">>}, + {<<"prometheus">>, <<"B95F8DE8530F541BD95951E18E355A840003672E5EDA4788C5FA6183406BA29A">>}, + {<<"prometheus_cowboy">>, <<"D9D5B300516A61ED5AE31391F8EEEEB202230081D32A1813F2D78772B6F274E1">>}, + {<<"prometheus_httpd">>, <<"8F767D819A5D36275EAB9264AFF40D87279151646776069BF69FBDBBD562BD75">>}, {<<"quantile_estimator">>, <<"EF50A361F11B5F26B5F16D0696E46A9E4661756492C981F7B2229EF42FF1CD15">>}, {<<"ranch">>, <<"8C7A100A139FD57F17327B6413E4167AC559FBC04CA7448E9BE9057311597A1D">>}, {<<"recon">>, <<"CBA53FA8DB83AD968C9A652E09C3ED7DDCC4DA434F27C3EAA9CA47FFB2B1FF03">>}, {<<"ssl_verify_fun">>, <<"354C321CF377240C7B8716899E182CE4890C5938111A1296ADD3EC74CF1715DF">>}, - {<<"tls_certificate_check">>, <<"D00E2887551FF8CDAE4D0340D90D9FCBC4943C7B5F49D32ED4BC23AFF4DB9A44">>}, + {<<"tls_certificate_check">>, <<"2C1C7FC922A329B9EB45DDF39113C998BBDEB28A534219CD884431E2AEE1811E">>}, {<<"unicode_util_compat">>, <<"BC84380C9AB48177092F43AC89E4DFA2C6D62B40B8BD132B1059ECC7232F9A78">>}]}, {pkg_hash_ext,[ - {<<"accept">>, <<"11B18C220BCC2EAB63B5470C038EF10EB6783BCB1FCDB11AA4137DEFA5AC1BB8">>}, + {<<"accept">>, <<"CA69388943F5DAD2E7232A5478F16086E3C872F48E32B88B378E1885A59F5649">>}, {<<"acceptor_pool">>, <<"0CBCD83FDC8B9AD2EEE2067EF8B91A14858A5883CB7CD800E6FCD5803E158788">>}, {<<"brod">>, <<"88584FDEBA746AA6729E2A1826416C10899954F68AF93659B3C2F38A2DCAA27C">>}, {<<"cache">>, <<"44516CE6FA03594D3A2AF025DD3A87BFE711000EB730219E1DDEFC816E0AA2F4">>}, @@ -188,18 +184,17 @@ {<<"kafka_protocol">>, <<"DF680A3706EAD8695F8B306897C0A33E8063C690DA9308DB87B462CFD7029D04">>}, {<<"metrics">>, <<"69B09ADDDC4F74A40716AE54D140F93BEB0FB8978D8636EADED0C31B6F099F16">>}, {<<"mimerl">>, <<"A1E15A50D1887217DE95F0B9B0793E32853F7C258A5CD227650889B38839FE9D">>}, - {<<"opentelemetry">>, <<"8E09EDC26AAD11161509D7ECAD854A3285D88580F93B63B0B1CF0BAC332BFCC0">>}, - {<<"opentelemetry_api">>, <<"6D7A27B7CAD2AD69A09CABF6670514CAFCEC717C8441BEB5C96322BAC3D05350">>}, - {<<"opentelemetry_exporter">>, <<"2B40007F509D38361744882FD060A8841AF772AB83BB542AA5350908B303AD65">>}, - {<<"opentelemetry_semantic_conventions">>, <<"D61FA1F5639EE8668D74B527E6806E0503EFC55A42DB7B5F39939D84C07D6895">>}, + {<<"opentelemetry">>, <<"CDF4F51D17B592FC592B9A75F86A6F808C23044BA7CF7B9534DEBBCC5C23B0EE">>}, + {<<"opentelemetry_api">>, <<"3DFBBFAA2C2ED3121C5C483162836C4F9027DEF469C41578AF5EF32589FCFC58">>}, + {<<"opentelemetry_exporter">>, <<"A1F9F271F8D3B02B81462A6BFEF7075FD8457FDB06ADFF5D2537DF5E2264D9AF">>}, {<<"parse_trans">>, <<"07CD9577885F56362D414E8C4C4E6BDF10D43A8767ABB92D24CBE8B24C54888B">>}, - {<<"prometheus">>, <<"6EDFBE928D271C7F657A6F2C46258738086584BD6CAE4A000B8B9A6009BA23A5">>}, - {<<"prometheus_cowboy">>, <<"BA286BECA9302618418892D37BCD5DC669A6CC001F4EB6D6AF85FF81F3F4F34C">>}, - {<<"prometheus_httpd">>, <<"0BBE831452CFDF9588538EB2F570B26F30C348ADAE5E95A7D87F35A5910BCF92">>}, + {<<"prometheus">>, <<"719862351AABF4DF7079B05DC085D2BBCBE3AC0AC3009E956671B1D5AB88247D">>}, + {<<"prometheus_cowboy">>, <<"5F71C039DEB9E9FF9DD6366BC74C907A463872B85286E619EFF0BDA15111695A">>}, + {<<"prometheus_httpd">>, <<"67736D000745184D5013C58A63E947821AB90CB9320BC2E6AE5D3061C6FFE039">>}, {<<"quantile_estimator">>, <<"282A8A323CA2A845C9E6F787D166348F776C1D4A41EDE63046D72D422E3DA946">>}, {<<"ranch">>, <<"49FBCFD3682FAB1F5D109351B61257676DA1A2FDBE295904176D5E521A2DDFE5">>}, {<<"recon">>, <<"2C7523C8DEE91DFF41F6B3D63CBA2BD49EB6D2FE5BF1EEC0DF7F87EB5E230E1C">>}, {<<"ssl_verify_fun">>, <<"FE4C190E8F37401D30167C8C405EDA19469F34577987C76DDE613E838BBC67F8">>}, - {<<"tls_certificate_check">>, <<"90B25A58EE433D91C17F036D4D354BF8859A089BFDA60E68A86F8EECAE45EF1B">>}, + {<<"tls_certificate_check">>, <<"51A5AD3DBD72D4694848965F3B5076E8B55D70EB8D5057FCDDD536029AB8A23C">>}, {<<"unicode_util_compat">>, <<"25EEE6D67DF61960CF6A794239566599B09E17E668D3700247BC498638152521">>}]} ]. diff --git a/test/dominant/sys.config b/test/dominant/sys.config new file mode 100644 index 00000000..6d78eab1 --- /dev/null +++ b/test/dominant/sys.config @@ -0,0 +1,74 @@ +[ + {kernel, [ + {log_level, debug}, + {logger, [ + {handler, default, logger_std_h, #{ + level => all, + config => #{ + type => standard_io + } + %% formatter => + %% {logger_logstash_formatter, #{}} + }} + ]} + ]}, + + {dmt, [ + {host, <<"dmt">>}, + {port, 8022}, + {scoper_event_handler_options, #{ + event_handler_opts => #{ + formatter_opts => #{ + max_length => 1000 + } + } + }}, + {services, #{ + repository => #{ + url => <<"http://dmt:8022/v1/domain/repository">> + }, + repository_client => #{ + url => <<"http://dmt:8022/v1/domain/repository_client">> + }, + author => #{ + url => <<"http://dmt:8022/v1/domain/author">> + } + }} + ]}, + + {woody, [ + {acceptors_pool_size, 4} + ]}, + + {epg_connector, [ + {databases, #{ + default_db => #{ + host => "dmt-db", + port => 5432, + username => "postgres", + password => "postgres", + database => "dmt" + } + }}, + {pools, #{ + default_pool => #{ + database => default_db, + size => 10 + }, + author_pool => #{ + database => default_db, + size => 10 + } + }} + ]}, + + {scoper, [ + {storage, scoper_storage_logger} + ]}, + + {prometheus, [ + {collectors, [ + default + ]} + ]} +]. diff --git a/test/machinegun/config.yaml b/test/machinegun/config.yaml index 3a55dce2..1bea8b92 100644 --- a/test/machinegun/config.yaml +++ b/test/machinegun/config.yaml @@ -22,10 +22,6 @@ namespaces: processor: url: http://party-management:8022/v1/stateproc/party pool_size: 300 - domain-config: - processor: - url: http://dominant:8022/v1/stateproc - pool_size: 300 lim/config_v1: processor: url: http://limiter:8022/v1/stateproc/lim/config_v1 From 361af7a8be604c532f3e13ae40b78ce5e2c44e47 Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Thu, 22 May 2025 15:58:00 +0300 Subject: [PATCH 02/13] Reverts service renaming and updates dominant urls --- apps/hellgate/test/hg_ct_helper.erl | 6 +++--- compose.tracing.yaml | 2 +- compose.yaml | 10 +++++----- test/dominant/sys.config | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/apps/hellgate/test/hg_ct_helper.erl b/apps/hellgate/test/hg_ct_helper.erl index 293f353f..bb149037 100644 --- a/apps/hellgate/test/hg_ct_helper.erl +++ b/apps/hellgate/test/hg_ct_helper.erl @@ -110,9 +110,9 @@ start_app(dmt_client = AppName) -> }} ]}, {service_urls, #{ - 'AuthorManagement' => <<"http://dmt:8022/v1/domain/author">>, - 'Repository' => <<"http://dmt:8022/v1/domain/repository">>, - 'RepositoryClient' => <<"http://dmt:8022/v1/domain/repository_client">> + 'AuthorManagement' => <<"http://dominant:8022/v1/domain/author">>, + 'Repository' => <<"http://dominant:8022/v1/domain/repository">>, + 'RepositoryClient' => <<"http://dominant:8022/v1/domain/repository_client">> }} ]), #{} diff --git a/compose.tracing.yaml b/compose.tracing.yaml index e55c1ff7..9894d88c 100644 --- a/compose.tracing.yaml +++ b/compose.tracing.yaml @@ -1,6 +1,6 @@ services: - dmt: + dominant: environment: &otlp_enabled OTEL_TRACES_EXPORTER: otlp OTEL_TRACES_SAMPLER: parentbased_always_off diff --git a/compose.yaml b/compose.yaml index d1559264..1182762a 100644 --- a/compose.yaml +++ b/compose.yaml @@ -13,7 +13,7 @@ services: depends_on: machinegun: condition: service_healthy - dmt: + dominant: condition: service_healthy party-management: condition: service_healthy @@ -28,7 +28,7 @@ services: working_dir: $PWD command: /sbin/init - dmt: + dominant: image: ghcr.io/valitydev/dominant-v2:sha-d939dec-epic-fixes_for_client command: /opt/dmt/bin/dmt foreground healthcheck: @@ -45,12 +45,12 @@ services: POSTGRES_PASSWORD: postgres POSTGRES_DB: dmt depends_on: - dmt-db: + dominant-db: condition: service_healthy volumes: - ./test/dominant/sys.config:/opt/dmt/releases/0.1/sys.config - dmt-db: + dominant-db: image: postgres environment: POSTGRES_USER: postgres @@ -164,7 +164,7 @@ services: depends_on: machinegun: condition: service_healthy - dmt: + dominant: condition: service_started shumway: condition: service_started diff --git a/test/dominant/sys.config b/test/dominant/sys.config index 6d78eab1..c598aa9f 100644 --- a/test/dominant/sys.config +++ b/test/dominant/sys.config @@ -25,13 +25,13 @@ }}, {services, #{ repository => #{ - url => <<"http://dmt:8022/v1/domain/repository">> + url => <<"http://dominant:8022/v1/domain/repository">> }, repository_client => #{ - url => <<"http://dmt:8022/v1/domain/repository_client">> + url => <<"http://dominant:8022/v1/domain/repository_client">> }, author => #{ - url => <<"http://dmt:8022/v1/domain/author">> + url => <<"http://dominant:8022/v1/domain/author">> } }} ]}, @@ -43,7 +43,7 @@ {epg_connector, [ {databases, #{ default_db => #{ - host => "dmt-db", + host => "dominant-db", port => 5432, username => "postgres", password => "postgres", From d87e0cd62e4e04eb179f743826180690ad4f388c Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Thu, 22 May 2025 17:43:54 +0300 Subject: [PATCH 03/13] Adopts dominant-v2 with upgraded party-management --- apps/hellgate/test/hg_ct_helper.erl | 8 +- compose.tracing.yaml | 2 +- compose.yaml | 50 +++++++--- config/sys.config | 7 +- test/{dominant => dmt}/sys.config | 8 +- test/party-management/sys.config | 140 ++++++++++++++++++++++++++++ 6 files changed, 188 insertions(+), 27 deletions(-) rename test/{dominant => dmt}/sys.config (85%) create mode 100644 test/party-management/sys.config diff --git a/apps/hellgate/test/hg_ct_helper.erl b/apps/hellgate/test/hg_ct_helper.erl index bb149037..fcd11675 100644 --- a/apps/hellgate/test/hg_ct_helper.erl +++ b/apps/hellgate/test/hg_ct_helper.erl @@ -110,9 +110,9 @@ start_app(dmt_client = AppName) -> }} ]}, {service_urls, #{ - 'AuthorManagement' => <<"http://dominant:8022/v1/domain/author">>, - 'Repository' => <<"http://dominant:8022/v1/domain/repository">>, - 'RepositoryClient' => <<"http://dominant:8022/v1/domain/repository_client">> + 'AuthorManagement' => <<"http://dmt:8022/v1/domain/author">>, + 'Repository' => <<"http://dmt:8022/v1/domain/repository">>, + 'RepositoryClient' => <<"http://dmt:8022/v1/domain/repository_client">> }} ]), #{} @@ -278,7 +278,7 @@ start_app(epg_connector = AppName) -> start_app(AppName, [ {databases, #{ default_db => #{ - host => "postgres", + host => "hellgate-db", port => 5432, database => "progressor_db", username => "progressor", diff --git a/compose.tracing.yaml b/compose.tracing.yaml index 9894d88c..e55c1ff7 100644 --- a/compose.tracing.yaml +++ b/compose.tracing.yaml @@ -1,6 +1,6 @@ services: - dominant: + dmt: environment: &otlp_enabled OTEL_TRACES_EXPORTER: otlp OTEL_TRACES_SAMPLER: parentbased_always_off diff --git a/compose.yaml b/compose.yaml index 1182762a..dc6ceef3 100644 --- a/compose.yaml +++ b/compose.yaml @@ -13,7 +13,7 @@ services: depends_on: machinegun: condition: service_healthy - dominant: + dmt: condition: service_healthy party-management: condition: service_healthy @@ -23,12 +23,12 @@ services: condition: service_started bender: condition: service_healthy - postgres: + hellgate-db: condition: service_healthy working_dir: $PWD command: /sbin/init - dominant: + dmt: image: ghcr.io/valitydev/dominant-v2:sha-d939dec-epic-fixes_for_client command: /opt/dmt/bin/dmt foreground healthcheck: @@ -36,21 +36,18 @@ services: interval: 5s timeout: 3s retries: 12 - ports: - - 8022:8022 - hostname: dmt environment: POSTGRES_HOST: dmt-db POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: dmt depends_on: - dominant-db: + dmt-db: condition: service_healthy volumes: - - ./test/dominant/sys.config:/opt/dmt/releases/0.1/sys.config + - ./test/dmt/sys.config:/opt/dmt/releases/0.1/sys.config - dominant-db: + dmt-db: image: postgres environment: POSTGRES_USER: postgres @@ -107,8 +104,6 @@ services: restart: unless-stopped depends_on: - shumway-db - ports: - - "8022" entrypoint: - java - -Xmx512m @@ -159,12 +154,12 @@ services: retries: 5 party-management: - image: ghcr.io/valitydev/party-management:sha-b78d0f5 + image: ghcr.io/valitydev/party-management:sha-cbd2ce1-epic-dmt-client-v2 command: /opt/party-management/bin/party-management foreground depends_on: - machinegun: + party-management-db: condition: service_healthy - dominant: + dmt: condition: service_started shumway: condition: service_started @@ -173,6 +168,8 @@ services: interval: 10s timeout: 5s retries: 10 + volumes: + - ./test/party-management/sys.config:/opt/party-management/releases/0.1/sys.config shumway-db: image: docker.io/library/postgres:13.10 @@ -181,7 +178,30 @@ services: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres - postgres: + party-management-db: + image: postgres:15-bookworm + command: -c 'max_connections=300' + environment: + POSTGRES_DB: "progressor_db" + POSTGRES_USER: "progressor" + POSTGRES_PASSWORD: "progressor" + PGDATA: "/tmp/postgresql/data/pgdata" + volumes: + - progressor-data:/tmp/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U progressor -d progressor_db"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 10s + restart: unless-stopped + deploy: + resources: + limits: + cpus: '2' + memory: 4G + + hellgate-db: image: postgres:15-bookworm command: -c 'max_connections=300' environment: diff --git a/config/sys.config b/config/sys.config index d50a3eae..07964c34 100644 --- a/config/sys.config +++ b/config/sys.config @@ -146,8 +146,9 @@ }} ]}, {service_urls, #{ - 'Repository' => <<"http://dominant:8022/v1/domain/repository">>, - 'RepositoryClient' => <<"http://dominant:8022/v1/domain/repository_client">> + 'AuthorManagement' => <<"http://dmt:8022/v1/domain/author">>, + 'Repository' => <<"http://dmt:8022/v1/domain/repository">>, + 'RepositoryClient' => <<"http://dmt:8022/v1/domain/repository_client">> }} ]}, @@ -270,7 +271,7 @@ {epg_connector, [ {databases, #{ hellgate_db => #{ - host => "postgres", + host => "hellgate-db", port => 5432, database => "progressor_db", username => "progressor", diff --git a/test/dominant/sys.config b/test/dmt/sys.config similarity index 85% rename from test/dominant/sys.config rename to test/dmt/sys.config index c598aa9f..6d78eab1 100644 --- a/test/dominant/sys.config +++ b/test/dmt/sys.config @@ -25,13 +25,13 @@ }}, {services, #{ repository => #{ - url => <<"http://dominant:8022/v1/domain/repository">> + url => <<"http://dmt:8022/v1/domain/repository">> }, repository_client => #{ - url => <<"http://dominant:8022/v1/domain/repository_client">> + url => <<"http://dmt:8022/v1/domain/repository_client">> }, author => #{ - url => <<"http://dominant:8022/v1/domain/author">> + url => <<"http://dmt:8022/v1/domain/author">> } }} ]}, @@ -43,7 +43,7 @@ {epg_connector, [ {databases, #{ default_db => #{ - host => "dominant-db", + host => "dmt-db", port => 5432, username => "postgres", password => "postgres", diff --git a/test/party-management/sys.config b/test/party-management/sys.config new file mode 100644 index 00000000..ac331164 --- /dev/null +++ b/test/party-management/sys.config @@ -0,0 +1,140 @@ +%% -*- mode: erlang -*- +[ + {kernel, [ + {logger_level, info}, + {logger, [ + {handler, default, logger_std_h, #{ + config => #{ + type => standard_io, + sync_mode_qlen => 20 + }, + formatter => {logger_logstash_formatter, #{ + log_level_map => #{ + emergency => 'ERROR', + alert => 'ERROR', + critical => 'ERROR', + error => 'ERROR', + warning => 'WARN', + notice => 'INFO', + info => 'INFO', + debug => 'DEBUG' + } + }} + }} + ]} + ]}, + + {scoper, [ + {storage, scoper_storage_logger} + ]}, + + {party_management, [ + {machinery_backend, progressor}, + {scoper_event_handler_options, #{ + event_handler_opts => #{ + formatter_opts => #{ + max_length => 1000 + } + } + }}, + {services, #{ + automaton => "http://machinegun-ha:8022/v1/automaton", + accounter => "http://shumway:8022/accounter" + }}, + {cache_options, #{ %% see `pm_party_cache:cache_options/0` + memory => 209715200, % 200Mb, cache memory quota in bytes + ttl => 3600, + size => 3000 + }}, + {health_check, #{ + memory => {erl_health, cg_memory, [70]}, + dmt_client => {dmt_client, health_check, []} + }} + ]}, + + {epg_connector, [ + {databases, #{ + default_db => #{ + host => "party-management-db", + port => 5432, + database => "progressor_db", + username => "progressor", + password => "progressor" + } + }}, + {pools, #{ + default_pool => #{ + database => default_db, + size => 30 + } + }} + ]}, + + {progressor, [ + {call_wait_timeout, 20}, + {defaults, #{ + storage => #{ + client => prg_pg_backend, + options => #{ + pool => default_pool + } + }, + retry_policy => #{ + initial_timeout => 5, + backoff_coefficient => 1.0, + %% seconds + max_timeout => 180, + max_attempts => 3, + non_retryable_errors => [] + }, + task_scan_timeout => 1, + worker_pool_size => 100, + process_step_timeout => 30 + }}, + {namespaces, #{ + 'party' => #{ + processor => #{ + client => machinery_prg_backend, + options => #{ + namespace => 'party', + handler => {pm_party_machine, #{}}, + schema => party_management_machinery_schema + } + } + } + }} + ]}, + + {dmt_client, [ + {cache_update_interval, 5000}, % milliseconds + {cache_server_call_timeout, 30000}, % milliseconds + {max_cache_size, #{ + elements => 20, + memory => 52428800 % 50Mb + }}, + {woody_event_handlers, [ + {scoper_woody_event_handler, #{ + event_handler_opts => #{ + formatter_opts => #{ + max_length => 1000 + } + } + }} + ]}, + {service_urls, #{ + 'AuthorManagement' => <<"http://dmt:8022/v1/domain/author">>, + 'Repository' => <<"http://dmt:8022/v1/domain/repository">>, + 'RepositoryClient' => <<"http://dmt:8022/v1/domain/repository_client">> + }} + ]}, + + {snowflake, [{machine_id, 1}]}, + + {prometheus, [ + {collectors, [default]} + ]}, + + {hackney, [ + {mod_metrics, woody_hackney_prometheus} + ]} +]. From 28df66d80855d38b1538873d71f6694176384e50 Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Thu, 22 May 2025 20:16:08 +0300 Subject: [PATCH 04/13] Refactors postgres in compose --- apps/hellgate/test/hg_ct_helper.erl | 8 +- compose.yaml | 105 +++--------------- config/sys.config | 8 +- test/dmt/sys.config | 4 +- test/party-management/sys.config | 22 +--- .../create-multiple-postgresql-databases.sh | 25 +++++ 6 files changed, 56 insertions(+), 116 deletions(-) create mode 100644 test/postgres/docker-entrypoint-initdb.d/create-multiple-postgresql-databases.sh diff --git a/apps/hellgate/test/hg_ct_helper.erl b/apps/hellgate/test/hg_ct_helper.erl index fcd11675..614babca 100644 --- a/apps/hellgate/test/hg_ct_helper.erl +++ b/apps/hellgate/test/hg_ct_helper.erl @@ -278,11 +278,11 @@ start_app(epg_connector = AppName) -> start_app(AppName, [ {databases, #{ default_db => #{ - host => "hellgate-db", + host => "db", port => 5432, - database => "progressor_db", - username => "progressor", - password => "progressor" + database => "hellgate", + username => "hellgate", + password => "postgres" } }}, {pools, #{ diff --git a/compose.yaml b/compose.yaml index dc6ceef3..c6282ac5 100644 --- a/compose.yaml +++ b/compose.yaml @@ -11,7 +11,7 @@ services: - .:$PWD hostname: hellgate depends_on: - machinegun: + db: condition: service_healthy dmt: condition: service_healthy @@ -23,8 +23,6 @@ services: condition: service_started bender: condition: service_healthy - hellgate-db: - condition: service_healthy working_dir: $PWD command: /sbin/init @@ -36,29 +34,12 @@ services: interval: 5s timeout: 3s retries: 12 - environment: - POSTGRES_HOST: dmt-db - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: dmt depends_on: - dmt-db: + db: condition: service_healthy volumes: - ./test/dmt/sys.config:/opt/dmt/releases/0.1/sys.config - dmt-db: - image: postgres - environment: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: dmt - healthcheck: - test: ["CMD-SHELL", "pg_isready -U postgres"] - interval: 5s - timeout: 5s - retries: 5 - machinegun: image: ghcr.io/valitydev/mg2:sha-436f723 command: /opt/machinegun/bin/machinegun foreground @@ -103,14 +84,15 @@ services: image: ghcr.io/valitydev/shumway:sha-658587c restart: unless-stopped depends_on: - - shumway-db + db: + condition: service_healthy entrypoint: - java - -Xmx512m - -jar - /opt/shumway/shumway.jar - - --spring.datasource.url=jdbc:postgresql://shumway-db:5432/shumway - - --spring.datasource.username=postgres + - --spring.datasource.url=jdbc:postgresql://db:5432/shumway + - --spring.datasource.username=shumway - --spring.datasource.password=postgres - --management.endpoint.metrics.enabled=false - --management.endpoint.prometheus.enabled=false @@ -118,22 +100,19 @@ services: disable: true liminator: - image: ghcr.io/valitydev/liminator:sha-fc6546f + image: ghcr.io/valitydev/liminator:sha-63b164d restart: unless-stopped entrypoint: - java - -Xmx512m - -jar - /opt/liminator/liminator.jar - - --spring.datasource.url=jdbc:postgresql://liminator-db:5432/liminator - - --spring.datasource.username=vality + - --spring.datasource.url=jdbc:postgresql://db:5432/liminator + - --spring.datasource.username=liminator - --spring.datasource.password=postgres - - --spring.flyway.url=jdbc:postgresql://liminator-db:5432/liminator - - --spring.flyway.username=vality - - --spring.flyway.password=postgres - --service.skipExistedHoldOps=false depends_on: - liminator-db: + db: condition: service_healthy healthcheck: test: "curl http://localhost:8022/actuator/health" @@ -141,23 +120,11 @@ services: timeout: 1s retries: 20 - liminator-db: - image: docker.io/library/postgres:13.10 - environment: - - POSTGRES_DB=liminator - - POSTGRES_USER=vality - - POSTGRES_PASSWORD=postgres - healthcheck: - test: ["CMD-SHELL", "pg_isready -U vality -d liminator"] - interval: 5s - timeout: 5s - retries: 5 - party-management: image: ghcr.io/valitydev/party-management:sha-cbd2ce1-epic-dmt-client-v2 command: /opt/party-management/bin/party-management foreground depends_on: - party-management-db: + db: condition: service_healthy dmt: condition: service_started @@ -171,58 +138,18 @@ services: volumes: - ./test/party-management/sys.config:/opt/party-management/releases/0.1/sys.config - shumway-db: - image: docker.io/library/postgres:13.10 - environment: - - POSTGRES_DB=shumway - - POSTGRES_USER=postgres - - POSTGRES_PASSWORD=postgres - - party-management-db: + db: image: postgres:15-bookworm command: -c 'max_connections=300' environment: - POSTGRES_DB: "progressor_db" - POSTGRES_USER: "progressor" - POSTGRES_PASSWORD: "progressor" - PGDATA: "/tmp/postgresql/data/pgdata" + POSTGRES_MULTIPLE_DATABASES: "hellgate,dmt,party_management,shumway,liminator" + POSTGRES_PASSWORD: "postgres" volumes: - - progressor-data:/tmp/postgresql/data + - ./test/postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d healthcheck: - test: ["CMD-SHELL", "pg_isready -U progressor -d progressor_db"] + test: ["CMD-SHELL", "pg_isready -U hellgate"] interval: 10s timeout: 5s retries: 5 start_period: 10s restart: unless-stopped - deploy: - resources: - limits: - cpus: '2' - memory: 4G - - hellgate-db: - image: postgres:15-bookworm - command: -c 'max_connections=300' - environment: - POSTGRES_DB: "progressor_db" - POSTGRES_USER: "progressor" - POSTGRES_PASSWORD: "progressor" - PGDATA: "/tmp/postgresql/data/pgdata" - volumes: - - progressor-data:/tmp/postgresql/data - healthcheck: - test: ["CMD-SHELL", "pg_isready -U progressor -d progressor_db"] - interval: 10s - timeout: 5s - retries: 5 - start_period: 10s - restart: unless-stopped - deploy: - resources: - limits: - cpus: '2' - memory: 4G - -volumes: - progressor-data: diff --git a/config/sys.config b/config/sys.config index 07964c34..f6646e66 100644 --- a/config/sys.config +++ b/config/sys.config @@ -271,11 +271,11 @@ {epg_connector, [ {databases, #{ hellgate_db => #{ - host => "hellgate-db", + host => "db", port => 5432, - database => "progressor_db", - username => "progressor", - password => "progressor" + database => "hellgate", + username => "hellgate", + password => "postgres" } }}, {pools, #{ diff --git a/test/dmt/sys.config b/test/dmt/sys.config index 6d78eab1..f1c50ed7 100644 --- a/test/dmt/sys.config +++ b/test/dmt/sys.config @@ -43,9 +43,9 @@ {epg_connector, [ {databases, #{ default_db => #{ - host => "dmt-db", + host => "db", port => 5432, - username => "postgres", + username => "dmt", password => "postgres", database => "dmt" } diff --git a/test/party-management/sys.config b/test/party-management/sys.config index ac331164..2020a20e 100644 --- a/test/party-management/sys.config +++ b/test/party-management/sys.config @@ -7,19 +7,7 @@ config => #{ type => standard_io, sync_mode_qlen => 20 - }, - formatter => {logger_logstash_formatter, #{ - log_level_map => #{ - emergency => 'ERROR', - alert => 'ERROR', - critical => 'ERROR', - error => 'ERROR', - warning => 'WARN', - notice => 'INFO', - info => 'INFO', - debug => 'DEBUG' - } - }} + } }} ]} ]}, @@ -55,11 +43,11 @@ {epg_connector, [ {databases, #{ default_db => #{ - host => "party-management-db", + host => "db", port => 5432, - database => "progressor_db", - username => "progressor", - password => "progressor" + database => "party_management", + username => "party_management", + password => "postgres" } }}, {pools, #{ diff --git a/test/postgres/docker-entrypoint-initdb.d/create-multiple-postgresql-databases.sh b/test/postgres/docker-entrypoint-initdb.d/create-multiple-postgresql-databases.sh new file mode 100644 index 00000000..83e34fd7 --- /dev/null +++ b/test/postgres/docker-entrypoint-initdb.d/create-multiple-postgresql-databases.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -e +set -u + +function create_user_and_database() { + local database=$1 + echo " Creating user and database '$database'" + psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL + CREATE DATABASE $database; + \c $database; + CREATE USER $database; + ALTER USER $database WITH ENCRYPTED PASSWORD '$POSTGRES_PASSWORD'; + GRANT ALL ON SCHEMA public TO $database; + GRANT ALL PRIVILEGES ON DATABASE $database TO $database; +EOSQL +} + +if [ -n "$POSTGRES_MULTIPLE_DATABASES" ]; then + echo "Multiple database creation requested: $POSTGRES_MULTIPLE_DATABASES" + for db in $(echo $POSTGRES_MULTIPLE_DATABASES | tr ',' ' '); do + create_user_and_database $db + done + echo "Multiple databases created" +fi From 402752daa312badd3f84505138f3c9670c029d6c Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Fri, 23 May 2025 10:48:22 +0300 Subject: [PATCH 05/13] Adds makefile recipe to psql into one of a composed databases --- Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Makefile b/Makefile index b1ca4cdf..21d03436 100644 --- a/Makefile +++ b/Makefile @@ -64,6 +64,16 @@ wdeps-%: dev-image $(DOCKERCOMPOSE_W_ENV) down; \ exit $$res +# Database tasks + +ifeq (db,$(firstword $(MAKECMDGOALS))) + DATABASE_NAME := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) + $(eval $(DATABASE_NAME):;@:) +endif + +db: + $(DOCKERCOMPOSE_W_ENV) exec db bash -c "PGPASSWORD=postgres psql -U $(DATABASE_NAME) -d $(DATABASE_NAME)" + # Rebar tasks rebar-shell: From 28045010375d7f2122a1a339afaa04e282350e31 Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Wed, 28 May 2025 14:29:57 +0300 Subject: [PATCH 06/13] Adds limiter w/ dmt-v2 support --- apps/hellgate/src/hg_domain.erl | 6 +++++- compose.yaml | 8 ++++---- rebar.lock | 22 +++++++++++----------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/apps/hellgate/src/hg_domain.erl b/apps/hellgate/src/hg_domain.erl index 35b1c0cf..4ed80bad 100644 --- a/apps/hellgate/src/hg_domain.erl +++ b/apps/hellgate/src/hg_domain.erl @@ -69,7 +69,11 @@ update(NewObjectOrMany) -> -spec upsert(object() | [object()]) -> revision() | no_return(). upsert(NewObjectOrMany) -> - dmt_client:upsert(NewObjectOrMany, ensure_stub_author()). + %% NOTE Checkout all objects from target version to ensure it all + %% cached before operations preparation. + Version = dmt_client:get_latest_version(), + _ = dmt_client:checkout_all(Version), + dmt_client:upsert(Version, NewObjectOrMany, ensure_stub_author()). -spec remove(object() | [object()]) -> revision() | no_return(). remove(ObjectOrMany) -> diff --git a/compose.yaml b/compose.yaml index c6282ac5..da7dc73a 100644 --- a/compose.yaml +++ b/compose.yaml @@ -27,7 +27,7 @@ services: command: /sbin/init dmt: - image: ghcr.io/valitydev/dominant-v2:sha-d939dec-epic-fixes_for_client + image: ghcr.io/valitydev/dominant-v2:sha-ba60639-epic-fixes_for_client command: /opt/dmt/bin/dmt foreground healthcheck: test: "/opt/dmt/bin/dmt ping" @@ -65,7 +65,7 @@ services: retries: 10 limiter: - image: ghcr.io/valitydev/limiter:sha-2271094 + image: ghcr.io/valitydev/limiter:sha-2150901-epic-dmt-client-v2 command: /opt/limiter/bin/limiter foreground depends_on: machinegun: @@ -121,7 +121,7 @@ services: retries: 20 party-management: - image: ghcr.io/valitydev/party-management:sha-cbd2ce1-epic-dmt-client-v2 + image: ghcr.io/valitydev/party-management:sha-1455452-epic-dmt-client-v2 command: /opt/party-management/bin/party-management foreground depends_on: db: @@ -140,7 +140,7 @@ services: db: image: postgres:15-bookworm - command: -c 'max_connections=300' + command: -c 'max_connections=1000' environment: POSTGRES_MULTIPLE_DATABASES: "hellgate,dmt,party_management,shumway,liminator" POSTGRES_PASSWORD: "postgres" diff --git a/rebar.lock b/rebar.lock index ccee470a..3da1a242 100644 --- a/rebar.lock +++ b/rebar.lock @@ -31,7 +31,7 @@ 0}, {<<"dmt_client">>, {git,"https://github.com/valitydev/dmt-client.git", - {ref,"e178110d2e30a3abcffcb65fec33c9b918e22bc3"}}, + {ref,"94eb03710a4a879b508306a4851cb766616b1015"}}, 0}, {<<"dmt_core">>, {git,"https://github.com/valitydev/dmt-core.git", @@ -71,14 +71,14 @@ {<<"kafka_protocol">>,{pkg,<<"kafka_protocol">>,<<"4.1.10">>},2}, {<<"limiter_proto">>, {git,"https://github.com/valitydev/limiter-proto.git", - {ref,"efeb7d4a05bd13c95fada18514509b34b107fcb9"}}, + {ref,"d4cdf0f6328125996ee705c3da87461f99dde7f4"}}, 0}, {<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2}, {<<"mg_proto">>, {git,"https://github.com/valitydev/machinegun-proto.git", {ref,"3decc8f8b13c9cd1701deab47781aacddd7dbc92"}}, 0}, - {<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.3.0">>},2}, + {<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.4.0">>},2}, {<<"msgpack_proto">>, {git,"https://github.com/valitydev/msgpack-proto.git", {ref,"7e447496aa5df4a5f1ace7ef2e3c31248b2a3ed0"}}, @@ -121,9 +121,9 @@ {ref,"3a60e5dc5bbd709495024f26e100b041c3547fd9"}}, 1}, {<<"tls_certificate_check">>, - {pkg,<<"tls_certificate_check">>,<<"1.27.0">>}, + {pkg,<<"tls_certificate_check">>,<<"1.28.0">>}, 1}, - {<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.7.0">>},2}, + {<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.7.1">>},2}, {<<"woody">>, {git,"https://github.com/valitydev/woody_erlang.git", {ref,"cc983a9423325ba1d6a509775eb6ff7ace721539"}}, @@ -149,7 +149,7 @@ {<<"jsx">>, <<"D12516BAA0BB23A59BB35DCCAF02A1BD08243FCBB9EFE24F2D9D056CCFF71268">>}, {<<"kafka_protocol">>, <<"F917B6C90C8DF0DE2B40A87D6B9AE1CFCE7788E91A65818E90E40CF76111097A">>}, {<<"metrics">>, <<"25F094DEA2CDA98213CECC3AEFF09E940299D950904393B2A29D191C346A8486">>}, - {<<"mimerl">>, <<"D0CD9FC04B9061F82490F6581E0128379830E78535E017F7780F37FEA7545726">>}, + {<<"mimerl">>, <<"3882A5CA67FBBE7117BA8947F27643557ADEC38FA2307490C4C4207624CB213B">>}, {<<"opentelemetry">>, <<"7DDA6551EDFC3050EA4B0B40C0D2570423D6372B97E9C60793263EF62C53C3C2">>}, {<<"opentelemetry_api">>, <<"63CA1742F92F00059298F478048DFB826F4B20D49534493D6919A0DB39B6DB04">>}, {<<"opentelemetry_exporter">>, <<"5D546123230771EF4174E37BEDFD77E3374913304CD6EA3CA82A2ADD49CD5D56">>}, @@ -161,8 +161,8 @@ {<<"ranch">>, <<"8C7A100A139FD57F17327B6413E4167AC559FBC04CA7448E9BE9057311597A1D">>}, {<<"recon">>, <<"CBA53FA8DB83AD968C9A652E09C3ED7DDCC4DA434F27C3EAA9CA47FFB2B1FF03">>}, {<<"ssl_verify_fun">>, <<"354C321CF377240C7B8716899E182CE4890C5938111A1296ADD3EC74CF1715DF">>}, - {<<"tls_certificate_check">>, <<"2C1C7FC922A329B9EB45DDF39113C998BBDEB28A534219CD884431E2AEE1811E">>}, - {<<"unicode_util_compat">>, <<"BC84380C9AB48177092F43AC89E4DFA2C6D62B40B8BD132B1059ECC7232F9A78">>}]}, + {<<"tls_certificate_check">>, <<"C39BF21F67C2D124AE905454FAD00F27E625917E8AB1009146E916E1DF6AB275">>}, + {<<"unicode_util_compat">>, <<"A48703A25C170EEDADCA83B11E88985AF08D35F37C6F664D6DCFB106A97782FC">>}]}, {pkg_hash_ext,[ {<<"accept">>, <<"CA69388943F5DAD2E7232A5478F16086E3C872F48E32B88B378E1885A59F5649">>}, {<<"acceptor_pool">>, <<"0CBCD83FDC8B9AD2EEE2067EF8B91A14858A5883CB7CD800E6FCD5803E158788">>}, @@ -183,7 +183,7 @@ {<<"jsx">>, <<"0C5CC8FDC11B53CC25CF65AC6705AD39E54ECC56D1C22E4ADB8F5A53FB9427F3">>}, {<<"kafka_protocol">>, <<"DF680A3706EAD8695F8B306897C0A33E8063C690DA9308DB87B462CFD7029D04">>}, {<<"metrics">>, <<"69B09ADDDC4F74A40716AE54D140F93BEB0FB8978D8636EADED0C31B6F099F16">>}, - {<<"mimerl">>, <<"A1E15A50D1887217DE95F0B9B0793E32853F7C258A5CD227650889B38839FE9D">>}, + {<<"mimerl">>, <<"13AF15F9F68C65884ECCA3A3891D50A7B57D82152792F3E19D88650AA126B144">>}, {<<"opentelemetry">>, <<"CDF4F51D17B592FC592B9A75F86A6F808C23044BA7CF7B9534DEBBCC5C23B0EE">>}, {<<"opentelemetry_api">>, <<"3DFBBFAA2C2ED3121C5C483162836C4F9027DEF469C41578AF5EF32589FCFC58">>}, {<<"opentelemetry_exporter">>, <<"A1F9F271F8D3B02B81462A6BFEF7075FD8457FDB06ADFF5D2537DF5E2264D9AF">>}, @@ -195,6 +195,6 @@ {<<"ranch">>, <<"49FBCFD3682FAB1F5D109351B61257676DA1A2FDBE295904176D5E521A2DDFE5">>}, {<<"recon">>, <<"2C7523C8DEE91DFF41F6B3D63CBA2BD49EB6D2FE5BF1EEC0DF7F87EB5E230E1C">>}, {<<"ssl_verify_fun">>, <<"FE4C190E8F37401D30167C8C405EDA19469F34577987C76DDE613E838BBC67F8">>}, - {<<"tls_certificate_check">>, <<"51A5AD3DBD72D4694848965F3B5076E8B55D70EB8D5057FCDDD536029AB8A23C">>}, - {<<"unicode_util_compat">>, <<"25EEE6D67DF61960CF6A794239566599B09E17E668D3700247BC498638152521">>}]} + {<<"tls_certificate_check">>, <<"3AB058C3F9457FFFCA916729587415F0DDC822048A0E5B5E2694918556D92DF1">>}, + {<<"unicode_util_compat">>, <<"B3A917854CE3AE233619744AD1E0102E05673136776FB2FA76234F3E03B23642">>}]} ]. From 342b1f5509072da1c17e46cd186d7ddf035fa86e Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Wed, 28 May 2025 19:58:17 +0300 Subject: [PATCH 07/13] Fixes route-cascading test group --- apps/hellgate/test/hg_invoice_tests_SUITE.erl | 18 ++++++++++-------- config/sys.config | 1 + rebar.lock | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/apps/hellgate/test/hg_invoice_tests_SUITE.erl b/apps/hellgate/test/hg_invoice_tests_SUITE.erl index 70a7048e..35c04d60 100644 --- a/apps/hellgate/test/hg_invoice_tests_SUITE.erl +++ b/apps/hellgate/test/hg_invoice_tests_SUITE.erl @@ -1218,7 +1218,7 @@ payment_shop_limit_success(C) -> #domain_TurnoverLimit{ id = ?SHOPLIMIT_ID, upper_boundary = ?LIMIT_UPPER_BOUNDARY, - domain_revision = dmt_client:get_latest_version() + domain_revision = hg_domain:head() } ], ShopID = hg_ct_helper:create_shop(PartyID, ?cat(1), <<"RUB">>, ?tmpl(1), ?pinst(1), TurnoverLimits, PartyClient), @@ -1239,7 +1239,7 @@ payment_shop_limit_overflow(C) -> #domain_TurnoverLimit{ id = ?SHOPLIMIT_ID, upper_boundary = ?LIMIT_UPPER_BOUNDARY, - domain_revision = dmt_client:get_latest_version() + domain_revision = hg_domain:head() } ]), ShopID = hg_ct_helper:create_shop(PartyID, ?cat(1), <<"RUB">>, ?tmpl(1), ?pinst(1), TurnoverLimits, PartyClient), @@ -1262,7 +1262,7 @@ payment_shop_limit_more_overflow(C) -> #domain_TurnoverLimit{ id = ?SHOPLIMIT_ID, upper_boundary = ?LIMIT_UPPER_BOUNDARY, - domain_revision = dmt_client:get_latest_version() + domain_revision = hg_domain:head() } ]), ShopID = hg_ct_helper:create_shop(PartyID, ?cat(1), <<"RUB">>, ?tmpl(1), ?pinst(1), TurnoverLimits, PartyClient), @@ -6530,7 +6530,8 @@ cascade_fixture(Revision, C) -> init_route_cascading_group(C1) -> PartyID = cfg(party_id, C1), PartyClient = cfg(party_client, C1), - _ = override_domain_fixture(fun cascade_fixture_pre_shop_create/2, undefined, C1), + Revision = hg_domain:head(), + _ = hg_domain:upsert(cascade_fixture_pre_shop_create(Revision, C1)), C2 = [ { {shop_id, ?PAYMENT_CASCADE_SUCCESS_ID}, @@ -6616,7 +6617,8 @@ init_route_cascading_group(C1) -> } | C1 ], - override_domain_fixture(fun cascade_fixture/2, undefined, C2). + _ = hg_domain:upsert(cascade_fixture(Revision, C2)), + [{base_limits_domain_revision, Revision}|C2]. init_per_cascade_case(payment_cascade_success, C) -> ShopID = cfg({shop_id, ?PAYMENT_CASCADE_SUCCESS_ID}, C), @@ -9960,7 +9962,7 @@ construct_domain_fixture() -> #domain_TurnoverLimit{ id = ?LIMIT_ID, upper_boundary = ?LIMIT_UPPER_BOUNDARY, - domain_revision = dmt_client:get_latest_version() + domain_revision = hg_domain:head() } ]} } @@ -10013,7 +10015,7 @@ construct_domain_fixture() -> #domain_TurnoverLimit{ id = ?LIMIT_ID2, upper_boundary = ?LIMIT_UPPER_BOUNDARY, - domain_revision = dmt_client:get_latest_version() + domain_revision = hg_domain:head() } ]} } @@ -10058,7 +10060,7 @@ construct_domain_fixture() -> #domain_TurnoverLimit{ id = ?LIMIT_ID3, upper_boundary = ?LIMIT_UPPER_BOUNDARY, - domain_revision = dmt_client:get_latest_version() + domain_revision = hg_domain:head() } ]} } diff --git a/config/sys.config b/config/sys.config index f6646e66..8865a8e4 100644 --- a/config/sys.config +++ b/config/sys.config @@ -19,6 +19,7 @@ {hg_proto, [ {services, #{ + limiter => "http://limiter:8022/v1/limiter", automaton => "http://machinegun:8022/v1/automaton", eventsink => "http://machinegun:8022/v1/event_sink", accounter => "http://shumway:8022/accounter", diff --git a/rebar.lock b/rebar.lock index 3da1a242..bad5abef 100644 --- a/rebar.lock +++ b/rebar.lock @@ -31,7 +31,7 @@ 0}, {<<"dmt_client">>, {git,"https://github.com/valitydev/dmt-client.git", - {ref,"94eb03710a4a879b508306a4851cb766616b1015"}}, + {ref,"ec1f8c8dcf1e7a9ef39328a91da3949bd89770cf"}}, 0}, {<<"dmt_core">>, {git,"https://github.com/valitydev/dmt-core.git", From 35991034efdb228cf4bda73de5fd8c8e0aa78461 Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Wed, 28 May 2025 20:03:40 +0300 Subject: [PATCH 08/13] Fixes formatting --- apps/hellgate/test/hg_invoice_tests_SUITE.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/hellgate/test/hg_invoice_tests_SUITE.erl b/apps/hellgate/test/hg_invoice_tests_SUITE.erl index 35c04d60..d790b5f2 100644 --- a/apps/hellgate/test/hg_invoice_tests_SUITE.erl +++ b/apps/hellgate/test/hg_invoice_tests_SUITE.erl @@ -6618,7 +6618,7 @@ init_route_cascading_group(C1) -> | C1 ], _ = hg_domain:upsert(cascade_fixture(Revision, C2)), - [{base_limits_domain_revision, Revision}|C2]. + [{base_limits_domain_revision, Revision} | C2]. init_per_cascade_case(payment_cascade_success, C) -> ShopID = cfg({shop_id, ?PAYMENT_CASCADE_SUCCESS_ID}, C), From 2a9100414d22e76858bd5ebf667b802629438d6e Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Wed, 28 May 2025 23:33:17 +0300 Subject: [PATCH 09/13] Updates docker compose command and initdb script permissions --- Makefile | 2 +- .../create-multiple-postgresql-databases.sh | 0 2 files changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 test/postgres/docker-entrypoint-initdb.d/create-multiple-postgresql-databases.sh diff --git a/Makefile b/Makefile index 21d03436..86242248 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ DEV_IMAGE_TAG = $(TEST_CONTAINER_NAME)-dev DEV_IMAGE_ID = $(file < .image.dev) DOCKER ?= docker -DOCKERCOMPOSE ?= docker-compose +DOCKERCOMPOSE ?= docker compose DOCKERCOMPOSE_W_ENV = DEV_IMAGE_TAG=$(DEV_IMAGE_TAG) $(DOCKERCOMPOSE) -f compose.yaml -f compose.tracing.yaml REBAR ?= rebar3 TEST_CONTAINER_NAME ?= testrunner diff --git a/test/postgres/docker-entrypoint-initdb.d/create-multiple-postgresql-databases.sh b/test/postgres/docker-entrypoint-initdb.d/create-multiple-postgresql-databases.sh old mode 100644 new mode 100755 From fced5225cfd5bda1dcc0d3555868bebcf38a37bd Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Thu, 29 May 2025 14:34:32 +0300 Subject: [PATCH 10/13] Adds domain config reset after `route_cascading` group --- apps/hellgate/test/hg_invoice_tests_SUITE.erl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/hellgate/test/hg_invoice_tests_SUITE.erl b/apps/hellgate/test/hg_invoice_tests_SUITE.erl index d790b5f2..5fe3375f 100644 --- a/apps/hellgate/test/hg_invoice_tests_SUITE.erl +++ b/apps/hellgate/test/hg_invoice_tests_SUITE.erl @@ -670,7 +670,7 @@ end). -spec init_per_group(group_name(), config()) -> config(). init_per_group(route_cascading, C) -> - init_route_cascading_group(C); + [{pre_group_domain_revision, hg_domain:head()} | init_route_cascading_group(C)]; init_per_group(operation_limits, C) -> init_operation_limits_group(C); init_per_group(repair_preproc_w_limits, C) -> @@ -681,8 +681,14 @@ init_per_group(_, C) -> C. -spec end_per_group(group_name(), config()) -> _. -end_per_group(_Group, _C) -> - ok. +end_per_group(_Group, C) -> + case cfg(pre_group_domain_revision, C) of + Revision when is_integer(Revision) -> + _ = hg_domain:reset(Revision), + ok; + undefined -> + ok + end. -spec init_per_testcase(test_case_name(), config()) -> config(). init_per_testcase(Name, C) when From 7fe3e5d73c981418c6dcbdfac17dd8319a609256 Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Tue, 3 Jun 2025 14:57:11 +0300 Subject: [PATCH 11/13] Bumps limiter & party-management in compose env --- apps/hellgate/test/hg_invoice_tests_SUITE.erl | 2 ++ compose.yaml | 6 +++--- rebar.config | 6 +++--- rebar.lock | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/hellgate/test/hg_invoice_tests_SUITE.erl b/apps/hellgate/test/hg_invoice_tests_SUITE.erl index 3d44eef0..2a02baf4 100644 --- a/apps/hellgate/test/hg_invoice_tests_SUITE.erl +++ b/apps/hellgate/test/hg_invoice_tests_SUITE.erl @@ -6016,6 +6016,7 @@ init_route_cascading_group(C1) -> PartyID = cfg(party_id, C1), PartyClient = cfg(party_client, C1), Revision = hg_domain:head(), + ok = hg_context:save(hg_context:create()), _ = hg_domain:upsert(cascade_fixture_pre_shop_create(Revision, C1)), C2 = [ { @@ -6102,6 +6103,7 @@ init_route_cascading_group(C1) -> } | C1 ], + ok = hg_context:cleanup(), _ = hg_domain:upsert(cascade_fixture(Revision, C2)), [{base_limits_domain_revision, Revision} | C2]. diff --git a/compose.yaml b/compose.yaml index da7dc73a..c5c15af0 100644 --- a/compose.yaml +++ b/compose.yaml @@ -27,7 +27,7 @@ services: command: /sbin/init dmt: - image: ghcr.io/valitydev/dominant-v2:sha-ba60639-epic-fixes_for_client + image: ghcr.io/valitydev/dominant-v2:sha-fede605-epic-domain-party-support command: /opt/dmt/bin/dmt foreground healthcheck: test: "/opt/dmt/bin/dmt ping" @@ -65,7 +65,7 @@ services: retries: 10 limiter: - image: ghcr.io/valitydev/limiter:sha-2150901-epic-dmt-client-v2 + image: ghcr.io/valitydev/limiter:sha-5460b1e-epic-dmt-client-v2 command: /opt/limiter/bin/limiter foreground depends_on: machinegun: @@ -121,7 +121,7 @@ services: retries: 20 party-management: - image: ghcr.io/valitydev/party-management:sha-1455452-epic-dmt-client-v2 + image: ghcr.io/valitydev/party-management:sha-e34b394-epic-dmt-client-v2 command: /opt/party-management/bin/party-management foreground depends_on: db: diff --git a/rebar.config b/rebar.config index f8888501..31af384e 100644 --- a/rebar.config +++ b/rebar.config @@ -31,18 +31,18 @@ {gproc, "0.9.0"}, {genlib, {git, "https://github.com/valitydev/genlib.git", {tag, "v1.1.0"}}}, {woody, {git, "https://github.com/valitydev/woody_erlang.git", {tag, "v1.1.0"}}}, - {damsel, {git, "https://github.com/valitydev/damsel.git", {tag, "v2.0.0"}}}, + {damsel, {git, "https://github.com/valitydev/damsel.git", {tag, "v2.1.0"}}}, {payproc_errors, {git, "https://github.com/valitydev/payproc-errors-erlang.git", {branch, "master"}}}, {mg_proto, {git, "https://github.com/valitydev/machinegun-proto.git", {branch, "master"}}}, {dmt_client, {git, "https://github.com/valitydev/dmt-client.git", {branch, "v2"}}}, {scoper, {git, "https://github.com/valitydev/scoper.git", {tag, "v1.1.0"}}}, - {party_client, {git, "https://github.com/valitydev/party-client-erlang.git", {branch, "master"}}}, + {party_client, {git, "https://github.com/valitydev/party-client-erlang.git", {branch, "ft/dmt-client-v2"}}}, {bender_client, {git, "https://github.com/valitydev/bender-client-erlang.git", {tag, "v1.1.0"}}}, {erl_health, {git, "https://github.com/valitydev/erlang-health.git", {branch, "master"}}}, {fault_detector_proto, {git, "https://github.com/valitydev/fault-detector-proto.git", {branch, "master"}}}, {limiter_proto, {git, "https://github.com/valitydev/limiter-proto.git", {branch, "master"}}}, {herd, {git, "https://github.com/wgnet/herd.git", {tag, "1.3.4"}}}, - {progressor, {git, "https://github.com/valitydev/progressor.git", {tag, "v1.0.1"}}}, + {progressor, {git, "https://github.com/valitydev/progressor.git", {tag, "v1.0.2"}}}, {prometheus, "4.11.0"}, {prometheus_cowboy, "0.1.9"}, diff --git a/rebar.lock b/rebar.lock index d4fae974..c9a7f0fc 100644 --- a/rebar.lock +++ b/rebar.lock @@ -91,7 +91,7 @@ {<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.1">>},2}, {<<"party_client">>, {git,"https://github.com/valitydev/party-client-erlang.git", - {ref,"a82682b6f55f41ff4962b2666bbd12cb5f1ece25"}}, + {ref,"7dcf597b075c804c31fe7a8f4c8e2f1ef4d612e7"}}, 0}, {<<"payproc_errors">>, {git,"https://github.com/valitydev/payproc-errors-erlang.git", @@ -99,7 +99,7 @@ 0}, {<<"progressor">>, {git,"https://github.com/valitydev/progressor.git", - {ref,"6df2e447a867434ad45bfc3540c4681e10105e02"}}, + {ref,"4c44615f712ae8992ff1a654f227def9f44c8aa7"}}, 0}, {<<"prometheus">>,{pkg,<<"prometheus">>,<<"4.11.0">>},0}, {<<"prometheus_cowboy">>,{pkg,<<"prometheus_cowboy">>,<<"0.1.9">>},0}, From 07f5fe426c571128269549cd2442ebc5f9582099 Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Thu, 5 Jun 2025 23:39:27 +0300 Subject: [PATCH 12/13] Bump dmt-v2, limiter & party-management --- compose.yaml | 6 +++--- rebar.config | 6 +++--- rebar.lock | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/compose.yaml b/compose.yaml index c5c15af0..8b2af8d9 100644 --- a/compose.yaml +++ b/compose.yaml @@ -27,7 +27,7 @@ services: command: /sbin/init dmt: - image: ghcr.io/valitydev/dominant-v2:sha-fede605-epic-domain-party-support + image: ghcr.io/valitydev/dominant-v2:sha-109d2ea command: /opt/dmt/bin/dmt foreground healthcheck: test: "/opt/dmt/bin/dmt ping" @@ -65,7 +65,7 @@ services: retries: 10 limiter: - image: ghcr.io/valitydev/limiter:sha-5460b1e-epic-dmt-client-v2 + image: ghcr.io/valitydev/limiter:sha-8fd529e command: /opt/limiter/bin/limiter foreground depends_on: machinegun: @@ -121,7 +121,7 @@ services: retries: 20 party-management: - image: ghcr.io/valitydev/party-management:sha-e34b394-epic-dmt-client-v2 + image: ghcr.io/valitydev/party-management:sha-6b6d4a5 command: /opt/party-management/bin/party-management foreground depends_on: db: diff --git a/rebar.config b/rebar.config index 31af384e..adae26cc 100644 --- a/rebar.config +++ b/rebar.config @@ -31,12 +31,12 @@ {gproc, "0.9.0"}, {genlib, {git, "https://github.com/valitydev/genlib.git", {tag, "v1.1.0"}}}, {woody, {git, "https://github.com/valitydev/woody_erlang.git", {tag, "v1.1.0"}}}, - {damsel, {git, "https://github.com/valitydev/damsel.git", {tag, "v2.1.0"}}}, + {damsel, {git, "https://github.com/valitydev/damsel.git", {tag, "v2.2.0"}}}, {payproc_errors, {git, "https://github.com/valitydev/payproc-errors-erlang.git", {branch, "master"}}}, {mg_proto, {git, "https://github.com/valitydev/machinegun-proto.git", {branch, "master"}}}, - {dmt_client, {git, "https://github.com/valitydev/dmt-client.git", {branch, "v2"}}}, + {dmt_client, {git, "https://github.com/valitydev/dmt-client.git", {tag, "v2.0.0"}}}, {scoper, {git, "https://github.com/valitydev/scoper.git", {tag, "v1.1.0"}}}, - {party_client, {git, "https://github.com/valitydev/party-client-erlang.git", {branch, "ft/dmt-client-v2"}}}, + {party_client, {git, "https://github.com/valitydev/party-client-erlang.git", {tag, "v2.0.0"}}}, {bender_client, {git, "https://github.com/valitydev/bender-client-erlang.git", {tag, "v1.1.0"}}}, {erl_health, {git, "https://github.com/valitydev/erlang-health.git", {branch, "master"}}}, {fault_detector_proto, {git, "https://github.com/valitydev/fault-detector-proto.git", {branch, "master"}}}, diff --git a/rebar.lock b/rebar.lock index 1b49659b..fdbeb28e 100644 --- a/rebar.lock +++ b/rebar.lock @@ -27,11 +27,11 @@ {<<"ctx">>,{pkg,<<"ctx">>,<<"0.6.0">>},2}, {<<"damsel">>, {git,"https://github.com/valitydev/damsel.git", - {ref,"5ca4f4a2af6bd68ba4d255889c0e2c0c1c5479a4"}}, + {ref,"ba7414811590859d058817b8f22d2e9c22f627f8"}}, 0}, {<<"dmt_client">>, {git,"https://github.com/valitydev/dmt-client.git", - {ref,"ec1f8c8dcf1e7a9ef39328a91da3949bd89770cf"}}, + {ref,"fcfb028a041149caeebec8d9cef469c8cdbbc63e"}}, 0}, {<<"dmt_core">>, {git,"https://github.com/valitydev/dmt-core.git", @@ -91,7 +91,7 @@ {<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.1">>},2}, {<<"party_client">>, {git,"https://github.com/valitydev/party-client-erlang.git", - {ref,"7dcf597b075c804c31fe7a8f4c8e2f1ef4d612e7"}}, + {ref,"b10b102673d899f6661e0c1a9e70f04ebddc9263"}}, 0}, {<<"payproc_errors">>, {git,"https://github.com/valitydev/payproc-errors-erlang.git", From 8f97a31fbba51a8896fa1ba211003863464f9a91 Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Fri, 6 Jun 2025 11:38:50 +0300 Subject: [PATCH 13/13] Adds missing auto tag action --- .github/workflows/tag-action.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/tag-action.yml diff --git a/.github/workflows/tag-action.yml b/.github/workflows/tag-action.yml new file mode 100644 index 00000000..ec3faf40 --- /dev/null +++ b/.github/workflows/tag-action.yml @@ -0,0 +1,18 @@ +name: Create Tag + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + + - uses: valitydev/action-tagger@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + with-v: true