From d31b4e620b04c8c79d65145da7fb6ec68057e057 Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Wed, 28 May 2025 11:10:54 +0300 Subject: [PATCH 1/5] Upgrades to dmt v2 --- apps/limiter/src/lim_config_machine.erl | 8 +- apps/limiter/test/lim_configurator_SUITE.erl | 5 +- apps/limiter/test/lim_turnover_SUITE.erl | 21 ++++- compose.tracing.yaml | 15 ++++ compose.yaml | 65 ++++++++------- rebar.config | 28 ++----- rebar.lock | 82 +++++++++---------- test/dmt/sys.config | 74 +++++++++++++++++ .../create-multiple-postgresql-databases.sh | 25 ++++++ 9 files changed, 222 insertions(+), 101 deletions(-) create mode 100644 test/dmt/sys.config create mode 100644 test/postgres/docker-entrypoint-initdb.d/create-multiple-postgresql-databases.sh diff --git a/apps/limiter/src/lim_config_machine.erl b/apps/limiter/src/lim_config_machine.erl index 4884c68..d0adf1a 100644 --- a/apps/limiter/src/lim_config_machine.erl +++ b/apps/limiter/src/lim_config_machine.erl @@ -2,7 +2,7 @@ -include_lib("limiter_proto/include/limproto_limiter_thrift.hrl"). -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"). %% Accessors @@ -372,11 +372,11 @@ get_config(ID, undefined, LimitContext) -> get_config(ID, Version, #{woody_context := WoodyContext}) -> LimitConfigRef = {limit_config, #domain_LimitConfigRef{id = ID}}, try - Object = dmt_client:checkout_versioned_object(Version, LimitConfigRef, #{woody_context => WoodyContext}), - #domain_conf_VersionedObject{object = {limit_config, ConfigObject}} = Object, + #domain_conf_v2_VersionedObject{object = {limit_config, ConfigObject}} = + dmt_client:checkout_object(Version, LimitConfigRef, #{woody_context => WoodyContext}), {ok, lim_config_codec:unmarshal('LimitConfigObject', ConfigObject)} catch - throw:#domain_conf_ObjectNotFound{} -> + throw:#domain_conf_v2_ObjectNotFound{} -> {error, notfound} end. diff --git a/apps/limiter/test/lim_configurator_SUITE.erl b/apps/limiter/test/lim_configurator_SUITE.erl index 6323b44..1c4d7c5 100644 --- a/apps/limiter/test/lim_configurator_SUITE.erl +++ b/apps/limiter/test/lim_configurator_SUITE.erl @@ -69,8 +69,9 @@ init_per_suite(Config) -> }} ]}, {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">> }} ]) ++ genlib_app:start_application_with(limiter, [ diff --git a/apps/limiter/test/lim_turnover_SUITE.erl b/apps/limiter/test/lim_turnover_SUITE.erl index 27ac719..a57f6db 100644 --- a/apps/limiter/test/lim_turnover_SUITE.erl +++ b/apps/limiter/test/lim_turnover_SUITE.erl @@ -4,6 +4,7 @@ -include_lib("common_test/include/ct.hrl"). -include_lib("damsel/include/dmsl_base_thrift.hrl"). -include_lib("damsel/include/dmsl_limiter_config_thrift.hrl"). +-include_lib("damsel/include/dmsl_domain_conf_v2_thrift.hrl"). -include("lim_ct_helper.hrl"). -export([all/0]). @@ -203,8 +204,9 @@ init_per_suite(Config) -> }} ]}, {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">> }} ]) ++ genlib_app:start_application_with(limiter, [ @@ -1126,7 +1128,7 @@ put_config_into_repository(legacy, #config_LimitConfigParams{id = ID} = CreatePa {ID, undefined}; put_config_into_repository(repository, #config_LimitConfigParams{id = ID} = CreateParams, _Client) -> LimitConfigObject = mk_limit_config_object(CreateParams), - Version = dmt_client:insert({limit_config, LimitConfigObject}), + Version = dmt_client:insert({limit_config, LimitConfigObject}, ensure_stub_author()), {ID, Version}. gen_unique_id(Prefix) -> @@ -1199,3 +1201,16 @@ change_record_name_prefix(Record, OldPrefix, NewPrefix) -> [OldPrefix, TypeName] = string:split(RecordName, "_", trailing), NewRecordName = list_to_existing_atom(NewPrefix ++ "_" ++ TypeName), setelement(1, Record, NewRecordName). + +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. diff --git a/compose.tracing.yaml b/compose.tracing.yaml index f712b3c..2e8e4a7 100644 --- a/compose.tracing.yaml +++ b/compose.tracing.yaml @@ -1,5 +1,20 @@ services: + + dmt: + environment: &otlp_enabled + OTEL_TRACES_EXPORTER: otlp + OTEL_TRACES_SAMPLER: parentbased_always_off + OTEL_EXPORTER_OTLP_PROTOCOL: http_protobuf + OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318 + + machinegun: + environment: *otlp_enabled + testrunner: + environment: + <<: *otlp_enabled + OTEL_SERVICE_NAME: limiter_testrunner + OTEL_TRACES_SAMPLER: parentbased_always_on depends_on: jaeger: condition: service_healthy diff --git a/compose.yaml b/compose.yaml index 70feb7b..27da1a2 100644 --- a/compose.yaml +++ b/compose.yaml @@ -14,7 +14,7 @@ services: working_dir: $PWD command: /sbin/init depends_on: - dominant: + dmt: condition: service_healthy machinegun: condition: service_healthy @@ -23,17 +23,19 @@ services: liminator: condition: service_healthy - dominant: - image: ghcr.io/valitydev/dominant:sha-2150eea - command: /opt/dominant/bin/dominant foreground + dmt: + 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" + interval: 5s + timeout: 3s + retries: 12 depends_on: - machinegun: + db: condition: service_healthy - healthcheck: - test: "/opt/dominant/bin/dominant ping" - interval: 10s - timeout: 5s - retries: 10 + volumes: + - ./test/dmt/sys.config:/opt/dmt/releases/0.1/sys.config machinegun: image: ghcr.io/valitydev/machinegun:sha-5c0db56 @@ -55,25 +57,19 @@ services: - -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.metrics.export.statsd.enabled=false depends_on: - - shumway-db + db: + condition: service_healthy healthcheck: test: "curl http://localhost:8022/actuator/health" interval: 5s timeout: 1s retries: 20 - shumway-db: - image: docker.io/library/postgres:14.3 - environment: - - POSTGRES_DB=shumway - - POSTGRES_USER=postgres - - POSTGRES_PASSWORD=postgres - liminator: image: ghcr.io/valitydev/liminator:sha-fc6546f restart: unless-stopped @@ -82,24 +78,31 @@ services: - -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" interval: 5s timeout: 1s retries: 20 - liminator-db: - image: docker.io/library/postgres:14.3 + db: + image: postgres:15-bookworm + command: -c 'max_connections=1000' environment: - - POSTGRES_DB=liminator - - POSTGRES_USER=vality - - POSTGRES_PASSWORD=postgres + POSTGRES_MULTIPLE_DATABASES: "dmt,shumway,liminator" + POSTGRES_PASSWORD: "postgres" + volumes: + - ./test/postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d + healthcheck: + test: ["CMD-SHELL", "pg_isready -U hellgate"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 10s + restart: unless-stopped diff --git a/rebar.config b/rebar.config index 780fc4d..42acf99 100644 --- a/rebar.config +++ b/rebar.config @@ -26,21 +26,21 @@ %% Common project dependencies. {deps, [ - {prometheus, "4.8.1"}, - {prometheus_cowboy, "0.1.8"}, - {damsel, {git, "https://github.com/valitydev/damsel.git", {branch, "master"}}}, + {prometheus, "4.11.0"}, + {prometheus_cowboy, "0.1.9"}, + {damsel, {git, "https://github.com/valitydev/damsel.git", {tag, "v2.0.0"}}}, {limiter_proto, {git, "https://github.com/valitydev/limiter-proto.git", {branch, "master"}}}, {liminator_proto, {git, "https://github.com/valitydev/liminator-proto.git", {branch, "master"}}}, {xrates_proto, {git, "https://github.com/valitydev/xrates-proto.git", {branch, "master"}}}, - {machinery, {git, "https://github.com/valitydev/machinery-erlang.git", {tag, "v1.1.0"}}}, + {machinery, {git, "https://github.com/valitydev/machinery-erlang.git", {tag, "v1.1.6"}}}, {erl_health, {git, "https://github.com/valitydev/erlang-health.git", {branch, "master"}}}, {genlib, {git, "https://github.com/valitydev/genlib.git", {tag, "v1.1.0"}}}, {scoper, {git, "https://github.com/valitydev/scoper.git", {tag, "v1.1.0"}}}, {woody, {git, "https://github.com/valitydev/woody_erlang.git", {tag, "v1.1.0"}}}, - {dmt_client, {git, "https://github.com/valitydev/dmt_client.git", {branch, "master"}}}, - {opentelemetry_api, "1.2.1"}, - {opentelemetry, "1.3.0"}, - {opentelemetry_exporter, "1.3.0"} + {dmt_client, {git, "https://github.com/valitydev/dmt_client.git", {branch, "v2"}}}, + {opentelemetry_api, "1.4.0"}, + {opentelemetry, "1.5.0"}, + {opentelemetry_exporter, "1.8.0"} ]}. %% XRef checks @@ -69,12 +69,10 @@ % for introspection on production {recon, "2.5.2"}, {logger_logstash_formatter, - {git, "https://github.com/valitydev/logger_logstash_formatter.git", {ref, "08a66a6"}}}, - {iosetopts, {git, "https://github.com/valitydev/iosetopts.git", {ref, "edb445c"}}} + {git, "https://github.com/valitydev/logger_logstash_formatter.git", {ref, "08a66a6"}}} ]}, {relx, [ {release, {limiter, "1.0.0"}, [ - iosetopts, {recon, load}, {runtime_tools, load}, {tools, load}, @@ -120,11 +118,3 @@ "ct.coverdata" ]} ]}. - -%% 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"}]}]} -]}. diff --git a/rebar.lock b/rebar.lock index b1520e5..8eeebbe 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,5 +1,5 @@ {"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}, {<<"brod">>,{pkg,<<"brod">>,<<"4.3.2">>},2}, {<<"cache">>,{pkg,<<"cache">>,<<"2.3.3">>},1}, @@ -19,11 +19,11 @@ {<<"ctx">>,{pkg,<<"ctx">>,<<"0.6.0">>},2}, {<<"damsel">>, {git,"https://github.com/valitydev/damsel.git", - {ref,"81d1edce2043500e4581867da3f5f4c31e682f44"}}, + {ref,"35a8abf6c006d744617d770aef5948a0322f2bd5"}}, 0}, {<<"dmt_client">>, {git,"https://github.com/valitydev/dmt_client.git", - {ref,"d8a4f490d49c038d96f1cbc2a279164c6f4039f9"}}, + {ref,"b85e6a4904610314160783cfe9bcc5c0d8fa82fc"}}, 0}, {<<"dmt_core">>, {git,"https://github.com/valitydev/dmt-core.git", @@ -31,7 +31,7 @@ 1}, {<<"epg_connector">>, {git,"https://github.com/valitydev/epg_connector.git", - {ref,"35a7480b298ac4318352a03824ce06619b75f9da"}}, + {ref,"dd93e27c00d492169e8a7bfc38976b911c6e7d05"}}, 2}, {<<"epgsql">>, {git,"https://github.com/epgsql/epgsql.git", @@ -55,40 +55,38 @@ {<<"kafka_protocol">>,{pkg,<<"kafka_protocol">>,<<"4.1.10">>},3}, {<<"liminator_proto">>, {git,"https://github.com/valitydev/liminator-proto.git", - {ref,"3870a390b3dd658e2c889b8e9590714e9bc8a0c9"}}, + {ref,"d63ded1d138416e4278d7fbe57d7359c9113f7ea"}}, 0}, {<<"limiter_proto">>, {git,"https://github.com/valitydev/limiter-proto.git", - {ref,"efeb7d4a05bd13c95fada18514509b34b107fcb9"}}, + {ref,"d4cdf0f6328125996ee705c3da87461f99dde7f4"}}, 0}, {<<"machinery">>, {git,"https://github.com/valitydev/machinery-erlang.git", - {ref,"0ca82988ec310aceab7686c078c2a20fa6209cde"}}, + {ref,"df43e429cd10e8f5afb57d09f1b8ac54eb868a44"}}, 0}, {<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2}, {<<"mg_proto">>, {git,"https://github.com/valitydev/machinegun-proto", {ref,"3decc8f8b13c9cd1701deab47781aacddd7dbc92"}}, 1}, - {<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.3.0">>},2}, - {<<"opentelemetry">>,{pkg,<<"opentelemetry">>,<<"1.3.0">>},0}, - {<<"opentelemetry_api">>,{pkg,<<"opentelemetry_api">>,<<"1.2.1">>},0}, + {<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.4.0">>},2}, + {<<"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}, {<<"progressor">>, {git,"https://github.com/valitydev/progressor.git", - {ref,"a67d4ddbcc3ddc3471e903d6d7291ca8e194906c"}}, + {ref,"6df2e447a867434ad45bfc3540c4681e10105e02"}}, 1}, - {<<"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.6">>},2}, {<<"scoper">>, {git,"https://github.com/valitydev/scoper.git", {ref,"0e7aa01e9632daa39727edd62d4656ee715b4569"}}, @@ -103,9 +101,9 @@ {ref,"3a60e5dc5bbd709495024f26e100b041c3547fd9"}}, 1}, {<<"tls_certificate_check">>, - {pkg,<<"tls_certificate_check">>,<<"1.25.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"}}, @@ -116,7 +114,7 @@ 0}]}. [ {pkg_hash,[ - {<<"accept">>, <<"B33B127ABCA7CC948BBE6CAA4C263369ABF1347CFA9D8E699C6D214660F10CD1">>}, + {<<"accept">>, <<"CD6E34A2D7E28CA38B2D3CB233734CA0C221EFBC1F171F91FEC5F162CC2D18DA">>}, {<<"acceptor_pool">>, <<"43C20D2ACAE35F0C2BCD64F9D2BDE267E459F0F3FD23DAB26485BF518C281B21">>}, {<<"brod">>, <<"51F4DFF17ED43A806558EBD62CC88E7B35AED336D1BA1F3DE2D010F463D49736">>}, {<<"cache">>, <<"B23A5FE7095445A88412A6E614C933377E0137B44FFED77C9B3FEF1A731A20B2">>}, @@ -135,22 +133,22 @@ {<<"jsx">>, <<"D12516BAA0BB23A59BB35DCCAF02A1BD08243FCBB9EFE24F2D9D056CCFF71268">>}, {<<"kafka_protocol">>, <<"F917B6C90C8DF0DE2B40A87D6B9AE1CFCE7788E91A65818E90E40CF76111097A">>}, {<<"metrics">>, <<"25F094DEA2CDA98213CECC3AEFF09E940299D950904393B2A29D191C346A8486">>}, - {<<"mimerl">>, <<"D0CD9FC04B9061F82490F6581E0128379830E78535E017F7780F37FEA7545726">>}, - {<<"opentelemetry">>, <<"988AC3C26ACAC9720A1D4FB8D9DC52E95B45ECFEC2D5B5583276A09E8936BC5E">>}, - {<<"opentelemetry_api">>, <<"7B69ED4F40025C005DE0B74FCE8C0549625D59CB4DF12D15C32FE6DC5076FF42">>}, - {<<"opentelemetry_exporter">>, <<"1D8809C0D4F4ACF986405F7700ED11992BCBDB6A4915DD11921E80777FFA7167">>}, - {<<"opentelemetry_semantic_conventions">>, <<"B67FE459C2938FCAB341CB0951C44860C62347C005ACE1B50F8402576F241435">>}, + {<<"mimerl">>, <<"3882A5CA67FBBE7117BA8947F27643557ADEC38FA2307490C4C4207624CB213B">>}, + {<<"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">>, <<"9052588E83BFEDFD9B72E1034532AEE2A5369D9D9343B61AEB7FBCE761010741">>}, {<<"ssl_verify_fun">>, <<"354C321CF377240C7B8716899E182CE4890C5938111A1296ADD3EC74CF1715DF">>}, - {<<"tls_certificate_check">>, <<"702B1835FE718A52310509537392ABD067DBE941EBC05FE72409D2B2F8061651">>}, - {<<"unicode_util_compat">>, <<"BC84380C9AB48177092F43AC89E4DFA2C6D62B40B8BD132B1059ECC7232F9A78">>}]}, + {<<"tls_certificate_check">>, <<"C39BF21F67C2D124AE905454FAD00F27E625917E8AB1009146E916E1DF6AB275">>}, + {<<"unicode_util_compat">>, <<"A48703A25C170EEDADCA83B11E88985AF08D35F37C6F664D6DCFB106A97782FC">>}]}, {pkg_hash_ext,[ - {<<"accept">>, <<"11B18C220BCC2EAB63B5470C038EF10EB6783BCB1FCDB11AA4137DEFA5AC1BB8">>}, + {<<"accept">>, <<"CA69388943F5DAD2E7232A5478F16086E3C872F48E32B88B378E1885A59F5649">>}, {<<"acceptor_pool">>, <<"0CBCD83FDC8B9AD2EEE2067EF8B91A14858A5883CB7CD800E6FCD5803E158788">>}, {<<"brod">>, <<"88584FDEBA746AA6729E2A1826416C10899954F68AF93659B3C2F38A2DCAA27C">>}, {<<"cache">>, <<"44516CE6FA03594D3A2AF025DD3A87BFE711000EB730219E1DDEFC816E0AA2F4">>}, @@ -169,18 +167,18 @@ {<<"jsx">>, <<"0C5CC8FDC11B53CC25CF65AC6705AD39E54ECC56D1C22E4ADB8F5A53FB9427F3">>}, {<<"kafka_protocol">>, <<"DF680A3706EAD8695F8B306897C0A33E8063C690DA9308DB87B462CFD7029D04">>}, {<<"metrics">>, <<"69B09ADDDC4F74A40716AE54D140F93BEB0FB8978D8636EADED0C31B6F099F16">>}, - {<<"mimerl">>, <<"A1E15A50D1887217DE95F0B9B0793E32853F7C258A5CD227650889B38839FE9D">>}, - {<<"opentelemetry">>, <<"8E09EDC26AAD11161509D7ECAD854A3285D88580F93B63B0B1CF0BAC332BFCC0">>}, - {<<"opentelemetry_api">>, <<"6D7A27B7CAD2AD69A09CABF6670514CAFCEC717C8441BEB5C96322BAC3D05350">>}, - {<<"opentelemetry_exporter">>, <<"2B40007F509D38361744882FD060A8841AF772AB83BB542AA5350908B303AD65">>}, - {<<"opentelemetry_semantic_conventions">>, <<"D61FA1F5639EE8668D74B527E6806E0503EFC55A42DB7B5F39939D84C07D6895">>}, + {<<"mimerl">>, <<"13AF15F9F68C65884ECCA3A3891D50A7B57D82152792F3E19D88650AA126B144">>}, + {<<"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">>, <<"96C6799792D735CC0F0FD0F86267E9D351E63339CBE03DF9D162010CEFC26BB0">>}, {<<"ssl_verify_fun">>, <<"FE4C190E8F37401D30167C8C405EDA19469F34577987C76DDE613E838BBC67F8">>}, - {<<"tls_certificate_check">>, <<"167343CCF50538CF2FAF61A3F1460E749B3EDF2ECEF55516AF2B5834362ABCB1">>}, - {<<"unicode_util_compat">>, <<"25EEE6D67DF61960CF6A794239566599B09E17E668D3700247BC498638152521">>}]} + {<<"tls_certificate_check">>, <<"3AB058C3F9457FFFCA916729587415F0DDC822048A0E5B5E2694918556D92DF1">>}, + {<<"unicode_util_compat">>, <<"B3A917854CE3AE233619744AD1E0102E05673136776FB2FA76234F3E03B23642">>}]} ]. diff --git a/test/dmt/sys.config b/test/dmt/sys.config new file mode 100644 index 0000000..f1c50ed --- /dev/null +++ b/test/dmt/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 => "db", + port => 5432, + username => "dmt", + 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/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 0000000..83e34fd --- /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 d80fbeb40a2a45d0c78370f114461c26dfab2cf6 Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Wed, 28 May 2025 11:15:16 +0300 Subject: [PATCH 2/5] Removes commit test with idenity scope --- apps/limiter/test/lim_turnover_SUITE.erl | 9 --------- 1 file changed, 9 deletions(-) diff --git a/apps/limiter/test/lim_turnover_SUITE.erl b/apps/limiter/test/lim_turnover_SUITE.erl index a57f6db..cc2df5a 100644 --- a/apps/limiter/test/lim_turnover_SUITE.erl +++ b/apps/limiter/test/lim_turnover_SUITE.erl @@ -55,7 +55,6 @@ -export([commit_with_terminal_scope_ok/1]). -export([commit_with_email_scope_ok/1]). --export([commit_with_identity_scope_ok/1]). -export([commit_with_wallet_scope_ok/1]). -export([commit_with_multi_scope_ok/1]). -export([hold_with_sender_notfound/1]). @@ -157,7 +156,6 @@ groups() -> commit_with_party_scope_ok, commit_with_provider_scope_ok, commit_with_terminal_scope_ok, - commit_with_identity_scope_ok, commit_with_wallet_scope_ok, commit_with_sender_scope_ok, commit_with_receiver_scope_ok, @@ -716,13 +714,6 @@ commit_with_email_scope_ok(C) -> {ok, {vector, _}} = hold_and_commit(?LIMIT_CHANGE(ID, ?CHANGE_ID, Version), Context, ?config(client, C)), {ok, #limiter_Limit{}} = lim_client:get(ID, Version, Context, ?config(client, C)). --spec commit_with_identity_scope_ok(config()) -> _. -commit_with_identity_scope_ok(C) -> - {ID, Version} = configure_limit(?time_range_month(), ?scope([?scope_identity()]), C), - Context = ?wthdproc_ctx_withdrawal(?cash(10, <<"RUB">>)), - {ok, {vector, _}} = hold_and_commit(?LIMIT_CHANGE(ID, ?CHANGE_ID, Version), Context, ?config(client, C)), - {ok, #limiter_Limit{}} = lim_client:get(ID, Version, Context, ?config(client, C)). - -spec commit_with_wallet_scope_ok(config()) -> _. commit_with_wallet_scope_ok(C) -> {ID, Version} = configure_limit(?time_range_month(), ?scope([?scope_wallet()]), C), From 2150901cbadec48ffd2d2b8325087d9bf7a30eee Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Wed, 28 May 2025 11:18:29 +0300 Subject: [PATCH 3/5] Updates dmt hostname --- config/sys.config | 5 +++-- test/machinegun/config.yaml | 10 ---------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/config/sys.config b/config/sys.config index 6ba6a00..30bf1c0 100644 --- a/config/sys.config +++ b/config/sys.config @@ -91,8 +91,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">> }} ]}, diff --git a/test/machinegun/config.yaml b/test/machinegun/config.yaml index 3b93a48..aa4ee45 100644 --- a/test/machinegun/config.yaml +++ b/test/machinegun/config.yaml @@ -12,10 +12,6 @@ namespaces: processor: url: http://limiter:8022/v1/stateproc/lim/range_v1 pool_size: 500 - domain-config: - processor: - url: http://dominant:8022/v1/stateproc - pool_size: 300 storage: type: memory @@ -23,9 +19,3 @@ storage: logging: out_type: stdout level: info - -opentelemetry: - service_name: machinegun - exporter: - protocol: http/protobuf - endpoint: http://jaeger:4318 From 5460b1e24443d7dc8c24613946f98626de01f41e Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Tue, 3 Jun 2025 14:16:31 +0300 Subject: [PATCH 4/5] Bumps damsel & dmt-v2 --- compose.yaml | 2 +- rebar.config | 4 ++-- rebar.lock | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/compose.yaml b/compose.yaml index 27da1a2..1e02729 100644 --- a/compose.yaml +++ b/compose.yaml @@ -24,7 +24,7 @@ services: condition: service_healthy 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" diff --git a/rebar.config b/rebar.config index 42acf99..ecf4e7b 100644 --- a/rebar.config +++ b/rebar.config @@ -28,11 +28,11 @@ {deps, [ {prometheus, "4.11.0"}, {prometheus_cowboy, "0.1.9"}, - {damsel, {git, "https://github.com/valitydev/damsel.git", {tag, "v2.0.0"}}}, + {damsel, {git, "https://github.com/valitydev/damsel.git", {tag, "v2.2.0"}}}, {limiter_proto, {git, "https://github.com/valitydev/limiter-proto.git", {branch, "master"}}}, {liminator_proto, {git, "https://github.com/valitydev/liminator-proto.git", {branch, "master"}}}, {xrates_proto, {git, "https://github.com/valitydev/xrates-proto.git", {branch, "master"}}}, - {machinery, {git, "https://github.com/valitydev/machinery-erlang.git", {tag, "v1.1.6"}}}, + {machinery, {git, "https://github.com/valitydev/machinery-erlang.git", {tag, "v1.1.7"}}}, {erl_health, {git, "https://github.com/valitydev/erlang-health.git", {branch, "master"}}}, {genlib, {git, "https://github.com/valitydev/genlib.git", {tag, "v1.1.0"}}}, {scoper, {git, "https://github.com/valitydev/scoper.git", {tag, "v1.1.0"}}}, diff --git a/rebar.lock b/rebar.lock index 8eeebbe..91a395d 100644 --- a/rebar.lock +++ b/rebar.lock @@ -19,11 +19,11 @@ {<<"ctx">>,{pkg,<<"ctx">>,<<"0.6.0">>},2}, {<<"damsel">>, {git,"https://github.com/valitydev/damsel.git", - {ref,"35a8abf6c006d744617d770aef5948a0322f2bd5"}}, + {ref,"ba7414811590859d058817b8f22d2e9c22f627f8"}}, 0}, {<<"dmt_client">>, {git,"https://github.com/valitydev/dmt_client.git", - {ref,"b85e6a4904610314160783cfe9bcc5c0d8fa82fc"}}, + {ref,"ec1f8c8dcf1e7a9ef39328a91da3949bd89770cf"}}, 0}, {<<"dmt_core">>, {git,"https://github.com/valitydev/dmt-core.git", @@ -63,7 +63,7 @@ 0}, {<<"machinery">>, {git,"https://github.com/valitydev/machinery-erlang.git", - {ref,"df43e429cd10e8f5afb57d09f1b8ac54eb868a44"}}, + {ref,"74f49ff6c2a161ecad426e1bd0dcef6f508babab"}}, 0}, {<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2}, {<<"mg_proto">>, @@ -79,7 +79,7 @@ {<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.1">>},2}, {<<"progressor">>, {git,"https://github.com/valitydev/progressor.git", - {ref,"6df2e447a867434ad45bfc3540c4681e10105e02"}}, + {ref,"4c44615f712ae8992ff1a654f227def9f44c8aa7"}}, 1}, {<<"prometheus">>,{pkg,<<"prometheus">>,<<"4.11.0">>},0}, {<<"prometheus_cowboy">>,{pkg,<<"prometheus_cowboy">>,<<"0.1.9">>},0}, From 08b06a224217b65c755b41ef0bad82da8a360413 Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Thu, 5 Jun 2025 14:41:39 +0300 Subject: [PATCH 5/5] Bumps dmt v2 --- .github/workflows/tag-action.yml | 18 ++++++++++++++++++ compose.yaml | 2 +- rebar.config | 2 +- rebar.lock | 2 +- 4 files changed, 21 insertions(+), 3 deletions(-) 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 0000000..ec3faf4 --- /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 diff --git a/compose.yaml b/compose.yaml index 1e02729..c6ef112 100644 --- a/compose.yaml +++ b/compose.yaml @@ -24,7 +24,7 @@ services: condition: service_healthy 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" diff --git a/rebar.config b/rebar.config index ecf4e7b..01afc2f 100644 --- a/rebar.config +++ b/rebar.config @@ -37,7 +37,7 @@ {genlib, {git, "https://github.com/valitydev/genlib.git", {tag, "v1.1.0"}}}, {scoper, {git, "https://github.com/valitydev/scoper.git", {tag, "v1.1.0"}}}, {woody, {git, "https://github.com/valitydev/woody_erlang.git", {tag, "v1.1.0"}}}, - {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"}}}, {opentelemetry_api, "1.4.0"}, {opentelemetry, "1.5.0"}, {opentelemetry_exporter, "1.8.0"} diff --git a/rebar.lock b/rebar.lock index 91a395d..87977e6 100644 --- a/rebar.lock +++ b/rebar.lock @@ -23,7 +23,7 @@ 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",