Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/tag-action.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions apps/limiter/src/lim_config_machine.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -371,11 +371,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.

Expand Down
5 changes: 3 additions & 2 deletions apps/limiter/test/lim_configurator_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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, [
Expand Down
21 changes: 18 additions & 3 deletions apps/limiter/test/lim_turnover_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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]).
Expand Down Expand Up @@ -201,8 +202,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, [
Expand Down Expand Up @@ -1117,7 +1119,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) ->
Expand Down Expand Up @@ -1190,3 +1192,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.
15 changes: 15 additions & 0 deletions compose.tracing.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
65 changes: 34 additions & 31 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
working_dir: $PWD
command: /sbin/init
depends_on:
dominant:
dmt:
condition: service_healthy
machinegun:
condition: service_healthy
Expand All @@ -23,17 +23,19 @@ services:
liminator:
condition: service_healthy

dominant:
image: ghcr.io/valitydev/dominant:sha-ef03371-epic-party_here
command: /opt/dominant/bin/dominant foreground
dmt:
image: ghcr.io/valitydev/dominant-v2:sha-109d2ea
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
Expand All @@ -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
Expand All @@ -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
5 changes: 3 additions & 2 deletions config/sys.config
Original file line number Diff line number Diff line change
Expand Up @@ -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">>
}}
]},

Expand Down
24 changes: 8 additions & 16 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -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.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.0"}}},
{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"}}},
{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", {tag, "v2.0.0"}}},
{opentelemetry_api, "1.4.0"},
{opentelemetry, "1.5.0"},
{opentelemetry_exporter, "1.8.0"}
]}.

%% XRef checks
Expand Down Expand Up @@ -118,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"}]}]}
]}.
Loading
Loading