TD-158: Add new ci (#6)

This commit is contained in:
Alexey S 2022-02-09 18:21:50 +03:00 committed by GitHub
parent 7ac5596cfa
commit 79e3d8108c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 394 additions and 167 deletions

View File

@ -1,4 +1,7 @@
_build/ /_build/
.git/ /.git/
.github/ /.github/
.vscode/ /.vscode/
/.idea/
erl_crash.dump
rebar3.crashdump

8
.editorconfig Normal file
View File

@ -0,0 +1,8 @@
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_size = 4
indent_style = space
trim_trailing_whitespace = true
max_line_length = 120

7
.env Normal file
View File

@ -0,0 +1,7 @@
# NOTE
# You SHOULD specify point releases here so that build time and run time Erlang/OTPs
# are the same. See: https://github.com/erlware/relx/pull/902
SERVICE_NAME=hellgate
OTP_VERSION=24.2.0
REBAR_VERSION=3.18
THRIFT_VERSION=0.14.2.2

11
.github/codecov.yml vendored Normal file
View File

@ -0,0 +1,11 @@
coverage:
status:
project:
default:
# Don't allow total coverage to drop
target: auto
threshold: 0%
patch:
default:
# Force new code to be at least 80% covered
target: 80%

View File

@ -1,9 +1,12 @@
name: Build Docker image name: Build Docker image
on: on:
push: push:
branches: [master] branches:
- 'master'
- 'epic/**'
pull_request: pull_request:
branches: ["*"] branches: [ '**' ]
env: env:
REGISTRY: ghcr.io REGISTRY: ghcr.io
@ -15,10 +18,17 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup Buildx
uses: docker/setup-buildx-action@v1
# https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions#setting-an-environment-variable
- name: Update environment variables
run: grep -v '^#' .env >> $GITHUB_ENV
- name: Log in to the Container registry - name: Log in to the Container registry
uses: docker/login-action@v1.12.0 uses: docker/login-action@v1.12.0
with: with:
registry: ghcr.io registry: ${{ env.REGISTRY }}
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
@ -32,8 +42,12 @@ jobs:
type=sha type=sha
- name: Build and push Docker image - name: Build and push Docker image
uses: docker/build-push-action@v2.8.0 uses: docker/build-push-action@v2.9.0
with: with:
push: ${{ github.event_name == 'push' }} push: ${{ github.event_name == 'push' }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
build-args: |
SERVICE_NAME=${{ env.SERVICE_NAME }}
OTP_VERSION=${{ env.OTP_VERSION }}
THRIFT_VERSION=${{ env.THRIFT_VERSION }}

39
.github/workflows/erlang-checks.yaml vendored Normal file
View File

@ -0,0 +1,39 @@
name: Erlang CI Checks
on:
push:
branches:
- 'master'
- 'epic/**'
pull_request:
branches: [ '**' ]
jobs:
setup:
name: Load .env
runs-on: ubuntu-latest
outputs:
otp-version: ${{ steps.otp-version.outputs.version }}
rebar-version: ${{ steps.rebar-version.outputs.version }}
thrift-version: ${{ steps.thrift-version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- run: grep -v '^#' .env >> $GITHUB_ENV
- id: otp-version
run: echo "::set-output name=version::$OTP_VERSION"
- id: rebar-version
run: echo "::set-output name=version::$REBAR_VERSION"
- id: thrift-version
run: echo "::set-output name=version::$THRIFT_VERSION"
run:
name: Run checks
needs: setup
uses: valitydev/erlang-workflows/.github/workflows/erlang-parallel-build.yml@v1.0.1
with:
otp-version: ${{ needs.setup.outputs.otp-version }}
rebar-version: ${{ needs.setup.outputs.rebar-version }}
use-thrift: true
thrift-version: ${{ needs.setup.outputs.thrift-version }}
run-ct-with-compose: true

3
.gitignore vendored
View File

@ -10,3 +10,6 @@ erl_crash.dump
/.idea/ /.idea/
*.beam *.beam
tags tags
# make stuff
/.image.*
Makefile.env

4
.gitmodules vendored
View File

@ -1,4 +0,0 @@
[submodule "build_utils"]
path = build_utils
url = https://github.com/rbkmoney/build_utils.git
branch = master

View File

@ -1,21 +1,41 @@
FROM docker.io/library/erlang:24.1.7.0 AS builder ARG OTP_VERSION
# Build the release
FROM docker.io/library/erlang:${OTP_VERSION} AS builder
ARG BUILDARCH ARG BUILDARCH
ARG THRIFT_VERSION=0.14.2.2
# Install thrift compiler
ARG THRIFT_VERSION
RUN wget -q -O- "https://github.com/valitydev/thrift/releases/download/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}-linux-${BUILDARCH}.tar.gz" \ RUN wget -q -O- "https://github.com/valitydev/thrift/releases/download/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}-linux-${BUILDARCH}.tar.gz" \
| tar -xvz -C /usr/local/bin/ | tar -xvz -C /usr/local/bin/
# Copy sources
RUN mkdir /build RUN mkdir /build
COPY . /build/ COPY . /build/
# Build the release
WORKDIR /build WORKDIR /build
RUN rebar3 compile RUN rebar3 compile
RUN rebar3 as prod release RUN rebar3 as prod release
# Keep in sync with Erlang/OTP version in build image # Make a runner image
FROM docker.io/library/erlang:24.1.7.0-slim FROM docker.io/library/erlang:${OTP_VERSION}-slim
ENV SERVICE=hellgate
ARG SERVICE_NAME
# Set env
ENV CHARSET=UTF-8 ENV CHARSET=UTF-8
ENV LANG=C.UTF-8 ENV LANG=C.UTF-8
COPY --from=builder /build/_build/prod/rel/${SERVICE} /opt/${SERVICE} ENV SERVICE_NAME=${SERVICE_NAME}
WORKDIR /opt/${SERVICE}
# Set runtime
WORKDIR /opt/${SERVICE_NAME}
COPY --from=builder /build/_build/prod/rel/${SERVICE_NAME} /opt/${SERVICE_NAME}
ENTRYPOINT [] ENTRYPOINT []
CMD /opt/${SERVICE}/bin/${SERVICE} foreground CMD /opt/${SERVICE_NAME}/bin/${SERVICE_NAME} foreground
EXPOSE 8022 EXPOSE 8022

18
Dockerfile.dev Normal file
View File

@ -0,0 +1,18 @@
ARG OTP_VERSION
FROM docker.io/library/erlang:${OTP_VERSION}
ARG BUILDARCH
# Install thrift compiler
ARG THRIFT_VERSION
RUN wget -q -O- "https://github.com/valitydev/thrift/releases/download/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}-linux-${BUILDARCH}.tar.gz" \
| tar -xvz -C /usr/local/bin/
# Set env
ENV CHARSET=UTF-8
ENV LANG=C.UTF-8
# Set runtime
CMD /bin/bash

22
Jenkinsfile vendored
View File

@ -1,22 +0,0 @@
#!groovy
// -*- mode: groovy -*-
def finalHook = {
runStage('store CT logs') {
archive '_build/test/logs/'
}
}
build('hellgate', 'docker-host', finalHook) {
checkoutRepo()
loadBuildUtils()
def pipeErlangService
runStage('load pipeline') {
env.JENKINS_LIB = "build_utils/jenkins_lib"
env.SH_TOOLS = "build_utils/sh"
pipeErlangService = load("${env.JENKINS_LIB}/pipeErlangService.groovy")
}
pipeErlangService.runPipe(true, false, 'test')
}

108
Makefile Normal file
View File

@ -0,0 +1,108 @@
# HINT
# Use this file to override variables here.
# For example, to run with podman put `DOCKER=podman` there.
-include Makefile.env
# NOTE
# Variables specified in `.env` file are used to pick and setup specific
# component versions, both when building a development image and when running
# CI workflows on GH Actions. This ensures that tasks run with `wc-` prefix
# (like `wc-dialyze`) are reproducible between local machine and CI runners.
DOTENV := $(shell grep -v '^\#' .env)
# Development images
DEV_IMAGE_TAG = $(TEST_CONTAINER_NAME)-dev
DEV_IMAGE_ID = $(file < .image.dev)
DOCKER ?= docker
DOCKERCOMPOSE ?= docker-compose
DOCKERCOMPOSE_W_ENV = DEV_IMAGE_TAG=$(DEV_IMAGE_TAG) $(DOCKERCOMPOSE)
REBAR ?= rebar3
TEST_CONTAINER_NAME ?= testrunner
all: compile
.PHONY: dev-image clean-dev-image wc-shell test
dev-image: .image.dev
.image.dev: Dockerfile.dev .env
env $(DOTENV) $(DOCKERCOMPOSE_W_ENV) build $(TEST_CONTAINER_NAME)
$(DOCKER) image ls -q -f "reference=$(DEV_IMAGE_ID)" | head -n1 > $@
clean-dev-image:
ifneq ($(DEV_IMAGE_ID),)
$(DOCKER) image rm -f $(DEV_IMAGE_TAG)
rm .image.dev
endif
DOCKER_WC_OPTIONS := -v $(PWD):$(PWD) --workdir $(PWD)
DOCKER_WC_EXTRA_OPTIONS ?= --rm
DOCKER_RUN = $(DOCKER) run -t $(DOCKER_WC_OPTIONS) $(DOCKER_WC_EXTRA_OPTIONS)
DOCKERCOMPOSE_RUN = $(DOCKERCOMPOSE_W_ENV) run --rm $(DOCKER_WC_OPTIONS)
# Utility tasks
wc-shell: dev-image
$(DOCKER_RUN) --interactive --tty $(DEV_IMAGE_TAG)
wc-%: dev-image
$(DOCKER_RUN) $(DEV_IMAGE_TAG) make $*
# TODO docker compose down doesn't work yet
wdeps-shell: dev-image
$(DOCKERCOMPOSE_RUN) $(TEST_CONTAINER_NAME) su; \
$(DOCKERCOMPOSE_W_ENV) down
wdeps-%: dev-image
$(DOCKERCOMPOSE_RUN) -T $(TEST_CONTAINER_NAME) make $*; \
res=$$?; \
$(DOCKERCOMPOSE_W_ENV) down; \
exit $$res
# Rebar tasks
rebar-shell:
$(REBAR) shell
compile:
$(REBAR) compile
xref:
$(REBAR) xref
lint:
$(REBAR) lint
check-format:
$(REBAR) fmt -c
dialyze:
$(REBAR) as test dialyzer
release:
$(REBAR) as prod release
eunit:
$(REBAR) eunit --cover
common-test:
$(REBAR) ct --cover
cover:
$(REBAR) covertool generate
format:
$(REBAR) fmt -w
clean:
$(REBAR) clean
distclean: clean-build-image
rm -rf _build
test: eunit common-test
cover-report:
$(REBAR) cover

View File

@ -4,29 +4,46 @@ Core logic service for payment states processing.
## Building ## Building
We widelly use Thrift to define RPC protocols. To build the project, run the following command:
So it needs to have [our Thrift compiler](https://github.com/rbkmoney/thrift) in PATH to build this service.
The recommended way to achieve this is by using our [build image](https://github.com/rbkmoney/image-build-erlang).
We are still experimenting on opening our build infrastructure so that you can use the explicit public registry setting for now. ```bash
You can adjust this parameter by exporting the environment variable `REGISTRY`. $ make compile
### Сheatsheet
To build the service image without access to the internal RBK.money registry:
```shell
make submodules && REGISTRY=ghcr.io make wc_release build_image
``` ```
To compile: ## Running
```shell To enter the [Erlang shell][1] with the project running, run the following command:
make submodules && REGISTRY=ghcr.io make wc_compile
```bash
$ make rebar-shell
``` ```
To run the service tests (you need either to have access to the internal RBK.money registry or to modify `docker-compose.sh`): ## Development environment
```shell ### Run in a docker container
make wdeps_test
You can run any of the tasks defined in the Makefile from inside of a docker container (defined in `Dockerfile.dev`) by prefixing the task name with `wc-`. To successfully build the dev container you need `Docker BuildKit` enabled. This can be accomplished by either installing [docker-buildx](https://docs.docker.com/buildx/working-with-buildx/) locally, or exporting the `DOCKER_BUILDKIT=1` environment variable.
#### Example
* This command will run the `compile` task in a docker container:
```bash
$ make wc-compile
``` ```
### Run in a docker-compose environment
Similarly, you can run any of the tasks defined in the Makefile from inside of a docker-compose environment (defined in `docker-compose.yaml`) by prefixing the task name with `wdeps-`. To successfully build the dev container you need `Docker BuildKit` enabled (see `Run in a docker container` section). It *may* also be necessary to export a `COMPOSE_DOCKER_CLI_BUILD=1` environment variable for `docker-compose` container builds to work properly.
#### Example
* This command will run the `test` task in a docker-compose environment:
```bash
$ make wdeps-test
```
## Documentation
@TODO Please write a couple of words about what your project does and how it does it.
[1]: http://erlang.org/doc/man/shell.html

View File

@ -21,8 +21,6 @@
woody_user_identity, woody_user_identity,
payproc_errors, payproc_errors,
erl_health, erl_health,
prometheus,
prometheus_cowboy,
limiter_proto limiter_proto
]}, ]},
{env, []}, {env, []},
@ -31,5 +29,5 @@
"Andrey Mayorov <a.mayorov@rbkmoney.com>" "Andrey Mayorov <a.mayorov@rbkmoney.com>"
]}, ]},
{licenses, []}, {licenses, []},
{links, ["https://github.com/rbkmoney/hellgate"]} {links, ["https://github.com/valitydev/hellgate"]}
]}. ]}.

72
docker-compose.sh → compose.yaml Executable file → Normal file
View File

@ -1,31 +1,44 @@
#!/bin/bash
cat <<EOF
version: '2.1'
services: services:
testrunner:
${SERVICE_NAME}: image: $DEV_IMAGE_TAG
image: ${BUILD_IMAGE} build:
dockerfile: Dockerfile.dev
context: .
args:
OTP_VERSION: $OTP_VERSION
THRIFT_VERSION: $THRIFT_VERSION
volumes: volumes:
- .:$PWD - .:$PWD
- $HOME/.cache:/home/$UNAME/.cache hostname: hellgate
working_dir: $PWD
command: /sbin/init
depends_on: depends_on:
# FIXME: Switch all service_started to service_healthy when its possible to debug its problems
machinegun: machinegun:
condition: service_healthy condition: service_healthy
shumway: dominant:
condition: service_started
party-management:
condition: service_started
limiter:
condition: service_healthy condition: service_healthy
mem_limit: 512M shumway:
condition: service_started
working_dir: $PWD
command: /sbin/init
dominant: dominant:
image: dr2.rbkmoney.com/rbkmoney/dominant:ea1a6680e3a68db92b485102e5c1c9525c9d874f image: ghcr.io/valitydev/dominant:sha-8bd7828
command: /opt/dominant/bin/dominant foreground command: /opt/dominant/bin/dominant foreground
depends_on: depends_on:
machinegun: machinegun:
condition: service_healthy condition: service_healthy
healthcheck:
test: "curl http://localhost:8022/"
interval: 5s
timeout: 1s
retries: 20
machinegun: machinegun:
image: dr2.rbkmoney.com/rbkmoney/machinegun:9c3248a68fe530d23a8266057a40a1a339a161b8 image: docker.io/rbkmoney/machinegun:c05a8c18cd4f7966d70b6ad84cac9429cdfe37ae
command: /opt/machinegun/bin/machinegun foreground command: /opt/machinegun/bin/machinegun foreground
volumes: volumes:
- ./test/machinegun/config.yaml:/opt/machinegun/etc/config.yaml - ./test/machinegun/config.yaml:/opt/machinegun/etc/config.yaml
@ -37,16 +50,21 @@ services:
retries: 20 retries: 20
limiter: limiter:
image: dr2.rbkmoney.com/rbkmoney/limiter:c7e96068a56da444e78cc7739a902da8e268dc63 image: docker.io/rbkmoney/limiter:c7e96068a56da444e78cc7739a902da8e268dc63
command: /opt/limiter/bin/limiter foreground command: /opt/limiter/bin/limiter foreground
depends_on: depends_on:
machinegun: machinegun:
condition: service_healthy condition: service_healthy
shumway: shumway:
condition: service_healthy condition: service_started
healthcheck:
test: "curl http://localhost:8022/"
interval: 5s
timeout: 1s
retries: 20
shumway: shumway:
image: dr2.rbkmoney.com/rbkmoney/shumway:658c9aec229b5a70d745a49cb938bb1a132b5ca2 image: docker.io/rbkmoney/shumway:44eb989065b27be619acd16b12ebdb2288b46c36
restart: unless-stopped restart: unless-stopped
entrypoint: entrypoint:
- java - java
@ -58,7 +76,8 @@ services:
- --spring.datasource.password=postgres - --spring.datasource.password=postgres
- --management.metrics.export.statsd.enabled=false - --management.metrics.export.statsd.enabled=false
depends_on: depends_on:
- shumway-db shumway-db:
condition: service_healthy
healthcheck: healthcheck:
test: "curl http://localhost:8022/" test: "curl http://localhost:8022/"
interval: 5s interval: 5s
@ -66,12 +85,15 @@ services:
retries: 20 retries: 20
party-management: party-management:
image: dr2.rbkmoney.com/rbkmoney/party-management:ac0feed5de13797941c3a576c04b0a5b7302c549 image: ghcr.io/valitydev/party-management:sha-a405fce
command: /opt/party-management/bin/party-management foreground command: /opt/party-management/bin/party-management foreground
depends_on: depends_on:
- machinegun machinegun:
- dominant condition: service_healthy
- shumway dominant:
condition: service_started
shumway:
condition: service_started
healthcheck: healthcheck:
test: "curl http://localhost:8022/" test: "curl http://localhost:8022/"
interval: 5s interval: 5s
@ -79,10 +101,14 @@ services:
retries: 20 retries: 20
shumway-db: shumway-db:
image: dr2.rbkmoney.com/rbkmoney/postgres:9.6 image: docker.io/library/postgres:9.6
environment: environment:
- POSTGRES_DB=shumway - POSTGRES_DB=shumway
- POSTGRES_USER=postgres - POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres - POSTGRES_PASSWORD=postgres
- SERVICE_NAME=shumway-db - SERVICE_NAME=shumway-db
EOF healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5

View File

@ -8,9 +8,10 @@
config => #{ config => #{
type => standard_error type => standard_error
}, },
formatter => {logger_formatter, #{ formatter =>
depth => 30 {logger_formatter, #{
}} depth => 30
}}
}}, }},
{handler, console_logger, logger_std_h, #{ {handler, console_logger, logger_std_h, #{
level => debug, level => debug,
@ -38,8 +39,7 @@
request_timeout => 6000, request_timeout => 6000,
% Should be greater than any other timeouts % Should be greater than any other timeouts
idle_timeout => infinity idle_timeout => infinity
} }},
},
{scoper_event_handler_options, #{ {scoper_event_handler_options, #{
event_handler_opts => #{ event_handler_opts => #{
formatter_opts => #{ formatter_opts => #{
@ -48,23 +48,22 @@
} }
}}, }},
{services, #{ {services, #{
automaton => "http://machinegun:8022/v1/automaton", automaton => "http://machinegun:8022/v1/automaton",
eventsink => "http://machinegun:8022/v1/event_sink", eventsink => "http://machinegun:8022/v1/event_sink",
accounter => "http://shumway:8022/shumpune", accounter => "http://shumway:8022/shumpune",
party_management => "http://party-management:8022/v1/processing/partymgmt", party_management => "http://party-management:8022/v1/processing/partymgmt",
customer_management => "http://hellgate:8022/v1/processing/customer_management", customer_management => "http://hellgate:8022/v1/processing/customer_management",
% TODO make more consistent % TODO make more consistent
recurrent_paytool => "http://hellgate:8022/v1/processing/recpaytool", recurrent_paytool => "http://hellgate:8022/v1/processing/recpaytool",
fault_detector => "http://fault-detector:8022/v1/fault-detector" fault_detector => "http://fault-detector:8022/v1/fault-detector"
}}, }},
{proxy_opts, #{ {proxy_opts, #{
transport_opts => #{ transport_opts => #{}
}
}}, }},
{health_check, #{ {health_check, #{
disk => {erl_health, disk , ["/", 99]}, disk => {erl_health, disk, ["/", 99]},
memory => {erl_health, cg_memory, [70]}, memory => {erl_health, cg_memory, [70]},
service => {erl_health, service , [<<"{{ service_name }}">>]}, service => {erl_health, service, [<<"{{ service_name }}">>]},
dmt_client => {dmt_client, health_check, [<<"hellgate">>]} dmt_client => {dmt_client, health_check, [<<"hellgate">>]}
}}, }},
{payment_retry_policy, #{ {payment_retry_policy, #{
@ -77,8 +76,8 @@
enabled => true, enabled => true,
timeout => 4000, timeout => 4000,
availability => #{ availability => #{
critical_fail_rate => 0.7, critical_fail_rate => 0.7,
sliding_window => 60000, sliding_window => 60000,
operation_time_limit => 10000, operation_time_limit => 10000,
pre_aggregation_size => 2 pre_aggregation_size => 2
}, },
@ -88,8 +87,8 @@
rejected_by_issuer, rejected_by_issuer,
processing_deadline_reached processing_deadline_reached
], ],
critical_fail_rate => 0.7, critical_fail_rate => 0.7,
sliding_window => 60000, sliding_window => 60000,
operation_time_limit => 1200000, operation_time_limit => 1200000,
pre_aggregation_size => 2 pre_aggregation_size => 2
} }
@ -110,21 +109,25 @@
} }
}}, }},
{services, #{ {services, #{
automaton => "http://machinegun:8022/v1/automaton", automaton => "http://machinegun:8022/v1/automaton",
accounter => "http://shumway:8022/shumpune" accounter => "http://shumway:8022/shumpune"
}}, }},
{cache_options, #{ %% see `pm_party_cache:cache_options/0` %% see `pm_party_cache:cache_options/0`
memory => 209715200, % 200Mb, cache memory quota in bytes {cache_options, #{
% 200Mb, cache memory quota in bytes
memory => 209715200,
ttl => 3600, ttl => 3600,
size => 3000 size => 3000
}} }}
]}, ]},
{dmt_client, [ {dmt_client, [
{cache_update_interval, 5000}, % milliseconds % milliseconds
{cache_update_interval, 5000},
{max_cache_size, #{ {max_cache_size, #{
elements => 20, elements => 20,
memory => 52428800 % 50Mb % 50Mb
memory => 52428800
}}, }},
{woody_event_handlers, [ {woody_event_handlers, [
{scoper_woody_event_handler, #{ {scoper_woody_event_handler, #{
@ -146,33 +149,26 @@
party_management => "http://party-management:8022/v1/processing/partymgmt" party_management => "http://party-management:8022/v1/processing/partymgmt"
}}, }},
{woody, #{ {woody, #{
cache_mode => safe, % disabled | safe | aggressive % disabled | safe | aggressive
cache_mode => safe,
options => #{ options => #{
woody_client => #{ woody_client => #{
event_handler => {scoper_woody_event_handler, #{ event_handler =>
event_handler_opts => #{ {scoper_woody_event_handler, #{
formatter_opts => #{ event_handler_opts => #{
max_length => 1000 formatter_opts => #{
max_length => 1000
}
} }
} }}
}}
} }
} }
}} }}
]}, ]},
{how_are_you, [
{metrics_publishers, [
% {hay_statsd_publisher, #{
% key_prefix => <<"hellgate.">>,
% host => "localhost",
% port => 8125
% }}
]}
]},
{snowflake, [ {snowflake, [
{max_backward_clock_moving, 1000}, % 1 second % 1 second
{max_backward_clock_moving, 1000},
{machine_id, hostname_hash} {machine_id, hostname_hash}
]}, ]},

View File

@ -1,5 +1,6 @@
[ [
{elvis, [ {elvis, [
{verbose, true},
{config, [ {config, [
#{ #{
dirs => ["apps/*/**"], dirs => ["apps/*/**"],

View File

@ -27,13 +27,10 @@
% Common project dependencies. % Common project dependencies.
{deps, [ {deps, [
{cache, "2.3.3"}, {cache, "2.3.3"},
{prometheus, "4.6.0"},
{prometheus_cowboy, "0.1.8"},
{gproc, "0.9.0"}, {gproc, "0.9.0"},
{genlib, {git, "https://github.com/valitydev/genlib.git", {branch, "master"}}}, {genlib, {git, "https://github.com/valitydev/genlib.git", {branch, "master"}}},
{woody, {git, "https://github.com/valitydev/woody_erlang.git", {branch, "master"}}}, {woody, {git, "https://github.com/valitydev/woody_erlang.git", {branch, "master"}}},
{woody_user_identity, {git, "https://github.com/valitydev/woody_erlang_user_identity.git", {branch, "master"}}}, {woody_user_identity, {git, "https://github.com/valitydev/woody_erlang_user_identity.git", {branch, "master"}}},
{woody_api_hay, {git, "https://github.com/valitydev/woody_api_hay.git", {branch, "master"}}},
{damsel, {git, "https://github.com/valitydev/damsel.git", {branch, "master"}}}, {damsel, {git, "https://github.com/valitydev/damsel.git", {branch, "master"}}},
{payproc_errors, {git, "https://github.com/valitydev/payproc-errors-erlang.git", {branch, "master"}}}, {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"}}}, {mg_proto, {git, "https://github.com/valitydev/machinegun-proto.git", {branch, "master"}}},
@ -42,7 +39,6 @@
{dmt_client, {git, "https://github.com/valitydev/dmt_client.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"}}}, {scoper, {git, "https://github.com/valitydev/scoper.git", {branch, "master"}}},
{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, "master"}}},
{how_are_you, {git, "https://github.com/valitydev/how_are_you.git", {branch, "master"}}},
{erl_health, {git, "https://github.com/valitydev/erlang-health.git", {branch, "master"}}}, {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"}}}, {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"}}} {limiter_proto, {git, "https://github.com/valitydev/limiter-proto.git", {branch, "master"}}}
@ -73,6 +69,12 @@
{profiles, [ {profiles, [
{prod, [ {prod, [
{deps, [ {deps, [
%% NOTE
%% Because of a dependency conflict, prometheus libs are only included in production build for now
%% https://github.com/project-fifo/rebar3_lint/issues/42
%% https://github.com/valitydev/hellgate/pull/2/commits/884724c1799703cee4d1033850fe32c17f986d9e
{prometheus, "4.8.1"},
{prometheus_cowboy, "0.1.8"},
% for introspection on production % for introspection on production
{recon, "2.5.2"}, {recon, "2.5.2"},
{logger_logstash_formatter, {logger_logstash_formatter,
@ -85,9 +87,9 @@
{recon, load}, {recon, load},
{runtime_tools, load}, {runtime_tools, load},
{tools, load}, {tools, load},
{logger_logstash_formatter, load}, logger_logstash_formatter,
woody_api_hay, prometheus,
how_are_you, prometheus_cowboy,
sasl, sasl,
hellgate hellgate
]}, ]},
@ -103,10 +105,19 @@
]}. ]}.
{plugins, [ {plugins, [
{erlfmt, "1.0.0"} {covertool, "2.0.4"},
{erlfmt, "1.0.0"},
{rebar3_lint, "1.0.1"}
]}. ]}.
{erlfmt, [ {erlfmt, [
{print_width, 120}, {print_width, 120},
{files, ["apps/*/{src,include,test}/*.{hrl,erl}", "rebar.config", "elvis.config"]} {files, ["apps/*/{src,include,test}/*.{hrl,erl}", "rebar.config", "elvis.config", "config/sys.config"]}
]}.
{covertool, [
{coverdata_files, [
"eunit.coverdata",
"ct.coverdata"
]}
]}. ]}.

View File

@ -1,7 +1,5 @@
{"1.2.0", {"1.2.0",
[{<<"accept">>,{pkg,<<"accept">>,<<"0.3.5">>},2}, [{<<"cache">>,{pkg,<<"cache">>,<<"2.3.3">>},0},
{<<"bear">>,{pkg,<<"bear">>,<<"0.9.0">>},2},
{<<"cache">>,{pkg,<<"cache">>,<<"2.3.3">>},0},
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.8.0">>},2}, {<<"certifi">>,{pkg,<<"certifi">>,<<"2.8.0">>},2},
{<<"cg_mon">>, {<<"cg_mon">>,
{git,"https://github.com/rbkmoney/cg_mon.git", {git,"https://github.com/rbkmoney/cg_mon.git",
@ -29,20 +27,12 @@
{git,"https://github.com/valitydev/fault-detector-proto.git", {git,"https://github.com/valitydev/fault-detector-proto.git",
{ref,"365aadcfefa7dbf75ee6613ed8c7a7fe377abbfc"}}, {ref,"365aadcfefa7dbf75ee6613ed8c7a7fe377abbfc"}},
0}, 0},
{<<"folsom">>,
{git,"https://github.com/folsom-project/folsom.git",
{ref,"62fd0714e6f0b4e7833880afe371a9c882ea0fc2"}},
1},
{<<"genlib">>, {<<"genlib">>,
{git,"https://github.com/valitydev/genlib.git", {git,"https://github.com/valitydev/genlib.git",
{ref,"82c5ff3866e3019eb347c7f1d8f1f847bed28c10"}}, {ref,"82c5ff3866e3019eb347c7f1d8f1f847bed28c10"}},
0}, 0},
{<<"gproc">>,{pkg,<<"gproc">>,<<"0.9.0">>},0}, {<<"gproc">>,{pkg,<<"gproc">>,<<"0.9.0">>},0},
{<<"hackney">>,{pkg,<<"hackney">>,<<"1.18.0">>},1}, {<<"hackney">>,{pkg,<<"hackney">>,<<"1.18.0">>},1},
{<<"how_are_you">>,
{git,"https://github.com/valitydev/how_are_you.git",
{ref,"2fd8013420328464c2c84302af2781b86577b39f"}},
0},
{<<"idna">>,{pkg,<<"idna">>,<<"6.1.1">>},2}, {<<"idna">>,{pkg,<<"idna">>,<<"6.1.1">>},2},
{<<"jsx">>,{pkg,<<"jsx">>,<<"3.1.0">>},1}, {<<"jsx">>,{pkg,<<"jsx">>,<<"3.1.0">>},1},
{<<"limiter_proto">>, {<<"limiter_proto">>,
@ -64,9 +54,6 @@
{git,"https://github.com/valitydev/payproc-errors-erlang.git", {git,"https://github.com/valitydev/payproc-errors-erlang.git",
{ref,"ebbfa3775c77d665f519d39ca9afa08c28d7733f"}}, {ref,"ebbfa3775c77d665f519d39ca9afa08c28d7733f"}},
0}, 0},
{<<"prometheus">>,{pkg,<<"prometheus">>,<<"4.6.0">>},0},
{<<"prometheus_cowboy">>,{pkg,<<"prometheus_cowboy">>,<<"0.1.8">>},0},
{<<"prometheus_httpd">>,{pkg,<<"prometheus_httpd">>,<<"2.1.11">>},1},
{<<"ranch">>,{pkg,<<"ranch">>,<<"1.8.0">>},2}, {<<"ranch">>,{pkg,<<"ranch">>,<<"1.8.0">>},2},
{<<"scoper">>, {<<"scoper">>,
{git,"https://github.com/valitydev/scoper.git", {git,"https://github.com/valitydev/scoper.git",
@ -90,18 +77,12 @@
{git,"https://github.com/valitydev/woody_erlang.git", {git,"https://github.com/valitydev/woody_erlang.git",
{ref,"6f818c57e3b19f96260b1f968115c9bc5bcad4d2"}}, {ref,"6f818c57e3b19f96260b1f968115c9bc5bcad4d2"}},
0}, 0},
{<<"woody_api_hay">>,
{git,"https://github.com/rbkmoney/woody_api_hay.git",
{ref,"4c39134cddaa9bf6fb8db18e7030ae64f1efb3a9"}},
0},
{<<"woody_user_identity">>, {<<"woody_user_identity">>,
{git,"https://github.com/valitydev/woody_erlang_user_identity.git", {git,"https://github.com/valitydev/woody_erlang_user_identity.git",
{ref,"a480762fea8d7c08f105fb39ca809482b6cb042e"}}, {ref,"a480762fea8d7c08f105fb39ca809482b6cb042e"}},
0}]}. 0}]}.
[ [
{pkg_hash,[ {pkg_hash,[
{<<"accept">>, <<"B33B127ABCA7CC948BBE6CAA4C263369ABF1347CFA9D8E699C6D214660F10CD1">>},
{<<"bear">>, <<"A31CCF5361791DD5E708F4789D67E2FEF496C4F05935FC59ADC11622F834D128">>},
{<<"cache">>, <<"B23A5FE7095445A88412A6E614C933377E0137B44FFED77C9B3FEF1A731A20B2">>}, {<<"cache">>, <<"B23A5FE7095445A88412A6E614C933377E0137B44FFED77C9B3FEF1A731A20B2">>},
{<<"certifi">>, <<"D4FB0A6BB20B7C9C3643E22507E42F356AC090A1DCEA9AB99E27E0376D695EBA">>}, {<<"certifi">>, <<"D4FB0A6BB20B7C9C3643E22507E42F356AC090A1DCEA9AB99E27E0376D695EBA">>},
{<<"cowboy">>, <<"865DD8B6607E14CF03282E10E934023A1BD8BE6F6BACF921A7E2A96D800CD452">>}, {<<"cowboy">>, <<"865DD8B6607E14CF03282E10E934023A1BD8BE6F6BACF921A7E2A96D800CD452">>},
@ -113,15 +94,10 @@
{<<"metrics">>, <<"25F094DEA2CDA98213CECC3AEFF09E940299D950904393B2A29D191C346A8486">>}, {<<"metrics">>, <<"25F094DEA2CDA98213CECC3AEFF09E940299D950904393B2A29D191C346A8486">>},
{<<"mimerl">>, <<"67E2D3F571088D5CFD3E550C383094B47159F3EEE8FFA08E64106CDF5E981BE3">>}, {<<"mimerl">>, <<"67E2D3F571088D5CFD3E550C383094B47159F3EEE8FFA08E64106CDF5E981BE3">>},
{<<"parse_trans">>, <<"16328AB840CC09919BD10DAB29E431DA3AF9E9E7E7E6F0089DD5A2D2820011D8">>}, {<<"parse_trans">>, <<"16328AB840CC09919BD10DAB29E431DA3AF9E9E7E7E6F0089DD5A2D2820011D8">>},
{<<"prometheus">>, <<"20510F381DB1CCAB818B4CF2FAC5FA6AB5CC91BC364A154399901C001465F46F">>},
{<<"prometheus_cowboy">>, <<"CFCE0BC7B668C5096639084FCD873826E6220EA714BF60A716F5BD080EF2A99C">>},
{<<"prometheus_httpd">>, <<"F616ED9B85B536B195D94104063025A91F904A4CFC20255363F49A197D96C896">>},
{<<"ranch">>, <<"8C7A100A139FD57F17327B6413E4167AC559FBC04CA7448E9BE9057311597A1D">>}, {<<"ranch">>, <<"8C7A100A139FD57F17327B6413E4167AC559FBC04CA7448E9BE9057311597A1D">>},
{<<"ssl_verify_fun">>, <<"CF344F5692C82D2CD7554F5EC8FD961548D4FD09E7D22F5B62482E5AEAEBD4B0">>}, {<<"ssl_verify_fun">>, <<"CF344F5692C82D2CD7554F5EC8FD961548D4FD09E7D22F5B62482E5AEAEBD4B0">>},
{<<"unicode_util_compat">>, <<"BC84380C9AB48177092F43AC89E4DFA2C6D62B40B8BD132B1059ECC7232F9A78">>}]}, {<<"unicode_util_compat">>, <<"BC84380C9AB48177092F43AC89E4DFA2C6D62B40B8BD132B1059ECC7232F9A78">>}]},
{pkg_hash_ext,[ {pkg_hash_ext,[
{<<"accept">>, <<"11B18C220BCC2EAB63B5470C038EF10EB6783BCB1FCDB11AA4137DEFA5AC1BB8">>},
{<<"bear">>, <<"47F71F098F2E3CD05E124A896C5EC2F155967A2B6FF6731E0D627312CCAB7E28">>},
{<<"cache">>, <<"44516CE6FA03594D3A2AF025DD3A87BFE711000EB730219E1DDEFC816E0AA2F4">>}, {<<"cache">>, <<"44516CE6FA03594D3A2AF025DD3A87BFE711000EB730219E1DDEFC816E0AA2F4">>},
{<<"certifi">>, <<"6AC7EFC1C6F8600B08D625292D4BBF584E14847CE1B6B5C44D983D273E1097EA">>}, {<<"certifi">>, <<"6AC7EFC1C6F8600B08D625292D4BBF584E14847CE1B6B5C44D983D273E1097EA">>},
{<<"cowboy">>, <<"2C729F934B4E1AA149AFF882F57C6372C15399A20D54F65C8D67BEF583021BDE">>}, {<<"cowboy">>, <<"2C729F934B4E1AA149AFF882F57C6372C15399A20D54F65C8D67BEF583021BDE">>},
@ -133,9 +109,6 @@
{<<"metrics">>, <<"69B09ADDDC4F74A40716AE54D140F93BEB0FB8978D8636EADED0C31B6F099F16">>}, {<<"metrics">>, <<"69B09ADDDC4F74A40716AE54D140F93BEB0FB8978D8636EADED0C31B6F099F16">>},
{<<"mimerl">>, <<"F278585650AA581986264638EBF698F8BB19DF297F66AD91B18910DFC6E19323">>}, {<<"mimerl">>, <<"F278585650AA581986264638EBF698F8BB19DF297F66AD91B18910DFC6E19323">>},
{<<"parse_trans">>, <<"07CD9577885F56362D414E8C4C4E6BDF10D43A8767ABB92D24CBE8B24C54888B">>}, {<<"parse_trans">>, <<"07CD9577885F56362D414E8C4C4E6BDF10D43A8767ABB92D24CBE8B24C54888B">>},
{<<"prometheus">>, <<"4905FD2992F8038ECCD7AA0CD22F40637ED618C0BED1F75C05AACEC15B7545DE">>},
{<<"prometheus_cowboy">>, <<"BA286BECA9302618418892D37BCD5DC669A6CC001F4EB6D6AF85FF81F3F4F34C">>},
{<<"prometheus_httpd">>, <<"0BBE831452CFDF9588538EB2F570B26F30C348ADAE5E95A7D87F35A5910BCF92">>},
{<<"ranch">>, <<"49FBCFD3682FAB1F5D109351B61257676DA1A2FDBE295904176D5E521A2DDFE5">>}, {<<"ranch">>, <<"49FBCFD3682FAB1F5D109351B61257676DA1A2FDBE295904176D5E521A2DDFE5">>},
{<<"ssl_verify_fun">>, <<"BDB0D2471F453C88FF3908E7686F86F9BE327D065CC1EC16FA4540197EA04680">>}, {<<"ssl_verify_fun">>, <<"BDB0D2471F453C88FF3908E7686F86F9BE327D065CC1EC16FA4540197EA04680">>},
{<<"unicode_util_compat">>, <<"25EEE6D67DF61960CF6A794239566599B09E17E668D3700247BC498638152521">>}]} {<<"unicode_util_compat">>, <<"25EEE6D67DF61960CF6A794239566599B09E17E668D3700247BC498638152521">>}]}