mirror of
https://github.com/valitydev/url-shortener.git
synced 2024-11-06 01:55:19 +00:00
TD-173: Add CI/CD (#1)
* TD-173: Add CI/CD * Fix release name * Get rid off old CI remains * Review fix
This commit is contained in:
parent
22511f863c
commit
7e978870c6
7
.dockerignore
Normal file
7
.dockerignore
Normal file
@ -0,0 +1,7 @@
|
||||
/_build/
|
||||
/.git/
|
||||
/.github/
|
||||
/.vscode/
|
||||
/.idea/
|
||||
erl_crash.dump
|
||||
rebar3.crashdump
|
7
.env
Normal file
7
.env
Normal 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=url-shortener
|
||||
OTP_VERSION=24.2.0
|
||||
REBAR_VERSION=3.18
|
||||
THRIFT_VERSION=0.14.2.2
|
54
.github/workflows/build-and-push-image.yaml
vendored
Normal file
54
.github/workflows/build-and-push-image.yaml
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
name: Build and push Docker image
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Construct tags / labels for an image
|
||||
id: meta
|
||||
uses: docker/metadata-action@v3
|
||||
with:
|
||||
images: |
|
||||
${{ env.REGISTRY }}/${{ github.repository }}
|
||||
tags: |
|
||||
type=sha
|
||||
|
||||
# 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: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
||||
- name: Setup Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
build-args: |
|
||||
OTP_VERSION=${{ env.OTP_VERSION }}
|
||||
THRIFT_VERSION=${{ env.THRIFT_VERSION }}
|
||||
SERVICE_NAME=${{ env.SERVICE_NAME }}
|
43
.github/workflows/build-image.yaml
vendored
Normal file
43
.github/workflows/build-image.yaml
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
name: Build Docker image
|
||||
on:
|
||||
pull_request:
|
||||
branches: ["*"]
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Construct tags / labels for an image
|
||||
id: meta
|
||||
uses: docker/metadata-action@v3
|
||||
with:
|
||||
images: |
|
||||
${{ env.REGISTRY }}/${{ github.repository }}
|
||||
tags: |
|
||||
type=sha
|
||||
|
||||
# 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: Setup Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Build Docker image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: false
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
build-args: |
|
||||
OTP_VERSION=${{ env.OTP_VERSION }}
|
||||
THRIFT_VERSION=${{ env.THRIFT_VERSION }}
|
||||
SERVICE_NAME=${{ env.SERVICE_NAME }}
|
39
.github/workflows/erlang-checks.yaml
vendored
Normal file
39
.github/workflows/erlang-checks.yaml
vendored
Normal 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
|
10
.gitignore
vendored
10
.gitignore
vendored
@ -12,15 +12,13 @@ rel/example_project
|
||||
|
||||
.DS_Store
|
||||
|
||||
# generated
|
||||
apps/swag_server
|
||||
apps/swag_client
|
||||
|
||||
# rebar
|
||||
/_checkouts/
|
||||
|
||||
# containerization
|
||||
\#*
|
||||
.\#*
|
||||
Dockerfile
|
||||
docker-compose.yml
|
||||
|
||||
# make stuff
|
||||
/.image.*
|
||||
Makefile.env
|
||||
|
8
.gitmodules
vendored
8
.gitmodules
vendored
@ -1,8 +0,0 @@
|
||||
[submodule "build_utils"]
|
||||
path = build_utils
|
||||
url = git@github.com:rbkmoney/build_utils.git
|
||||
branch = master
|
||||
[submodule "schemes/swag-url-shortener"]
|
||||
path = schemes/swag-url-shortener
|
||||
url = git@github.com:rbkmoney/swag-url-shortener.git
|
||||
branch = release/master
|
42
Dockerfile
Normal file
42
Dockerfile
Normal file
@ -0,0 +1,42 @@
|
||||
ARG OTP_VERSION
|
||||
|
||||
# Build the release
|
||||
FROM docker.io/library/erlang:${OTP_VERSION} AS builder
|
||||
|
||||
# Install thrift compiler
|
||||
ARG THRIFT_VERSION
|
||||
|
||||
ARG TARGETARCH
|
||||
RUN wget -q -O- "https://github.com/valitydev/thrift/releases/download/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}-linux-${TARGETARCH}.tar.gz" \
|
||||
| tar -xvz -C /usr/local/bin/
|
||||
|
||||
# Copy sources
|
||||
RUN mkdir /build
|
||||
COPY . /build/
|
||||
|
||||
# Build the release
|
||||
WORKDIR /build
|
||||
RUN rebar3 compile
|
||||
RUN rebar3 as prod release
|
||||
|
||||
# Make a runner image
|
||||
FROM docker.io/library/erlang:${OTP_VERSION}-slim
|
||||
|
||||
ARG SERVICE_NAME
|
||||
|
||||
# Set env
|
||||
ENV CHARSET=UTF-8
|
||||
ENV LANG=C.UTF-8
|
||||
|
||||
# Expose SERVICE_NAME as env so CMD expands properly on start
|
||||
ENV SERVICE_NAME=${SERVICE_NAME}
|
||||
|
||||
# Set runtime
|
||||
WORKDIR /opt/${SERVICE_NAME}
|
||||
|
||||
COPY --from=builder /build/_build/prod/rel/${SERVICE_NAME} /opt/${SERVICE_NAME}
|
||||
|
||||
ENTRYPOINT []
|
||||
CMD /opt/${SERVICE_NAME}/bin/${SERVICE_NAME} foreground
|
||||
|
||||
EXPOSE 8022
|
13
Dockerfile.dev
Normal file
13
Dockerfile.dev
Normal file
@ -0,0 +1,13 @@
|
||||
ARG OTP_VERSION
|
||||
|
||||
FROM docker.io/library/erlang:${OTP_VERSION}
|
||||
|
||||
ARG THRIFT_VERSION
|
||||
ARG BUILDARCH
|
||||
|
||||
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/
|
||||
|
||||
ENV CHARSET=UTF-8
|
||||
ENV LANG=C.UTF-8
|
||||
CMD /bin/bash
|
@ -1,26 +0,0 @@
|
||||
#!/bin/bash
|
||||
cat <<EOF
|
||||
FROM $BASE_IMAGE
|
||||
MAINTAINER Dmitry Manik <d.manik@rbkmoney.com>
|
||||
COPY ./_build/prod/rel/shortener /opt/shortener
|
||||
WORKDIR /opt/shortener
|
||||
CMD /opt/shortener/bin/shortener foreground
|
||||
EXPOSE 8022
|
||||
# A bit of magic below to get a proper branch name
|
||||
# even when the HEAD is detached (Hey Jenkins!
|
||||
# BRANCH_NAME is available in Jenkins env).
|
||||
LABEL com.rbkmoney.$SERVICE_NAME.parent=$BASE_IMAGE_NAME \
|
||||
com.rbkmoney.$SERVICE_NAME.parent_tag=$BASE_IMAGE_TAG \
|
||||
com.rbkmoney.$SERVICE_NAME.build_img=build \
|
||||
com.rbkmoney.$SERVICE_NAME.build_img_tag=$BUILD_IMAGE_TAG \
|
||||
com.rbkmoney.$SERVICE_NAME.commit_id=$(git rev-parse HEAD) \
|
||||
com.rbkmoney.$SERVICE_NAME.commit_number=$(git rev-list --count HEAD) \
|
||||
com.rbkmoney.$SERVICE_NAME.branch=$( \
|
||||
if [ "HEAD" != $(git rev-parse --abbrev-ref HEAD) ]; then \
|
||||
echo $(git rev-parse --abbrev-ref HEAD); \
|
||||
elif [ -n "$BRANCH_NAME" ]; then \
|
||||
echo $BRANCH_NAME; \
|
||||
else \
|
||||
echo $(git name-rev --name-only HEAD); \
|
||||
fi)
|
||||
EOF
|
22
Jenkinsfile
vendored
22
Jenkinsfile
vendored
@ -1,22 +0,0 @@
|
||||
#!groovy
|
||||
// -*- mode: groovy -*-
|
||||
|
||||
def finalHook = {
|
||||
runStage('store CT logs') {
|
||||
archive '_build/test/logs/'
|
||||
}
|
||||
}
|
||||
|
||||
build('url-shortener', '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)
|
||||
}
|
156
Makefile
156
Makefile
@ -1,103 +1,109 @@
|
||||
REBAR := $(shell which rebar3 2>/dev/null || which ./rebar3)
|
||||
SUBMODULES = schemes/swag-url-shortener build_utils
|
||||
SUBTARGETS = $(patsubst %,%/.git,$(SUBMODULES))
|
||||
# HINT
|
||||
# Use this file to override variables here.
|
||||
# For example, to run with podman put `DOCKER=podman` there.
|
||||
-include Makefile.env
|
||||
|
||||
UTILS_PATH := build_utils
|
||||
TEMPLATES_PATH := .
|
||||
-include .env
|
||||
|
||||
# Name of the service
|
||||
SERVICE_NAME := url-shortener
|
||||
# Service image default tag
|
||||
SERVICE_IMAGE_TAG ?= $(shell git rev-parse HEAD)
|
||||
# The tag for service image to be pushed with
|
||||
SERVICE_IMAGE_PUSH_TAG ?= $(SERVICE_IMAGE_TAG)
|
||||
# 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)
|
||||
|
||||
# Base image for the service
|
||||
BASE_IMAGE_NAME := service-erlang
|
||||
BASE_IMAGE_TAG := ef20e2ec1cb1528e9214bdeb862b15478950d5cd
|
||||
# Development images
|
||||
DEV_IMAGE_TAG = $(TEST_CONTAINER_NAME)-dev
|
||||
DEV_IMAGE_ID = $(file < .image.dev)
|
||||
|
||||
# Build image tag to be used
|
||||
BUILD_IMAGE_NAME := build-erlang
|
||||
BUILD_IMAGE_TAG := aaa79c2d6b597f93f5f8b724eecfc31ec2e2a23b
|
||||
|
||||
CALL_ANYWHERE := all submodules rebar-update compile xref lint dialyze \
|
||||
release clean distclean check_format format
|
||||
|
||||
CALL_W_CONTAINER := $(CALL_ANYWHERE) test
|
||||
DOCKER ?= docker
|
||||
DOCKERCOMPOSE ?= docker-compose
|
||||
DOCKERCOMPOSE_W_ENV = DEV_IMAGE_TAG=$(DEV_IMAGE_TAG) $(DOCKERCOMPOSE)
|
||||
REBAR ?= rebar3
|
||||
TEST_CONTAINER_NAME ?= testrunner
|
||||
|
||||
all: compile
|
||||
|
||||
-include $(UTILS_PATH)/make_lib/utils_container.mk
|
||||
-include $(UTILS_PATH)/make_lib/utils_image.mk
|
||||
.PHONY: dev-image clean-dev-image wc-shell test
|
||||
|
||||
.PHONY: $(CALL_W_CONTAINER)
|
||||
dev-image: .image.dev
|
||||
|
||||
# CALL_ANYWHERE
|
||||
$(SUBTARGETS): %/.git: %
|
||||
git submodule update --init $<
|
||||
touch $@
|
||||
.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 > $@
|
||||
|
||||
submodules: $(SUBTARGETS)
|
||||
clean-dev-image:
|
||||
ifneq ($(DEV_IMAGE_ID),)
|
||||
$(DOCKER) image rm -f $(DEV_IMAGE_TAG)
|
||||
rm .image.dev
|
||||
endif
|
||||
|
||||
rebar-update:
|
||||
$(REBAR) update
|
||||
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)
|
||||
|
||||
compile: submodules rebar-update generate
|
||||
DOCKERCOMPOSE_RUN = $(DOCKERCOMPOSE_W_ENV) run --rm $(DOCKER_WC_OPTIONS) $(TEST_CONTAINER_NAME)
|
||||
|
||||
# Utility tasks
|
||||
|
||||
wc-shell: dev-image
|
||||
$(DOCKER_RUN) --interactive --tty $(DEV_IMAGE_TAG)
|
||||
|
||||
wc-%: dev-image
|
||||
$(DOCKER_RUN) $(DEV_IMAGE_TAG) make $*
|
||||
|
||||
wdeps-shell: dev-image
|
||||
$(DOCKERCOMPOSE_RUN) su; \
|
||||
$(DOCKERCOMPOSE_W_ENV) down
|
||||
|
||||
wdeps-%: dev-image
|
||||
$(DOCKERCOMPOSE_RUN) make $*; \
|
||||
res=$$?; \
|
||||
$(DOCKERCOMPOSE_W_ENV) down; \
|
||||
exit $$res
|
||||
|
||||
# Rebar tasks
|
||||
|
||||
rebar-shell:
|
||||
$(REBAR) shell
|
||||
|
||||
compile:
|
||||
$(REBAR) compile
|
||||
|
||||
xref: submodules
|
||||
xref:
|
||||
$(REBAR) xref
|
||||
|
||||
lint:
|
||||
elvis rock -V
|
||||
$(REBAR) lint
|
||||
|
||||
check_format:
|
||||
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
|
||||
|
||||
dialyze:
|
||||
$(REBAR) dialyzer
|
||||
|
||||
release: submodules generate
|
||||
$(REBAR) as prod release
|
||||
|
||||
clean::
|
||||
clean:
|
||||
$(REBAR) clean
|
||||
|
||||
distclean::
|
||||
distclean: clean-build-image
|
||||
rm -rf _build
|
||||
|
||||
# CALL_W_CONTAINER
|
||||
test: submodules generate
|
||||
$(REBAR) ct
|
||||
test: eunit common-test
|
||||
|
||||
# Swagger stuff
|
||||
SWAGGER_CODEGEN = $(call which, swagger-codegen)
|
||||
SWAGGER_SCHEME_PATH = schemes/swag-url-shortener
|
||||
SWAGGER_SCHEME = $(SWAGGER_SCHEME_PATH)/swagger.yaml
|
||||
|
||||
$(SWAGGER_SCHEME): $(SWAGGER_SCHEME_PATH)/.git
|
||||
|
||||
SWAGGER_SERVER_PATH = apps/swag_server
|
||||
SWAGGER_CLIENT_PATH = apps/swag_client
|
||||
|
||||
generate:: swag.server.generate swag.client.generate
|
||||
|
||||
swag.server.generate: $(SWAGGER_SERVER_PATH)
|
||||
swag.client.generate: $(SWAGGER_CLIENT_PATH)
|
||||
|
||||
distclean:: swag.server.distclean swag.client.distclean
|
||||
|
||||
swag.server.distclean:
|
||||
rm -rf $(SWAGGER_SERVER_PATH)
|
||||
swag.client.distclean:
|
||||
rm -rf $(SWAGGER_CLIENT_PATH)
|
||||
|
||||
$(SWAGGER_SERVER_PATH) $(SWAGGER_CLIENT_PATH): $(SWAGGER_SCHEME)
|
||||
$(SWAGGER_CODEGEN) generate \
|
||||
-i $^ \
|
||||
-l $(if $(findstring server,$@),erlang-server,erlang-client) \
|
||||
-o $@ \
|
||||
--additional-properties packageName=$(notdir $(basename $@))
|
||||
cover-report:
|
||||
$(REBAR) cover
|
||||
|
@ -12,15 +12,13 @@
|
||||
cowboy,
|
||||
cowboy_cors,
|
||||
cowboy_access_log,
|
||||
swag_server,
|
||||
swag_server_ushort,
|
||||
mg_proto,
|
||||
bouncer_proto,
|
||||
bouncer_client,
|
||||
woody,
|
||||
woody_user_identity,
|
||||
erl_health,
|
||||
prometheus,
|
||||
prometheus_cowboy
|
||||
erl_health
|
||||
]},
|
||||
{env, []},
|
||||
{modules, []},
|
||||
|
@ -9,7 +9,8 @@
|
||||
-export_type([context/0]).
|
||||
-export_type([claims/0]).
|
||||
|
||||
-spec authorize_api_key(swag_server:operation_id(), swag_server:api_key()) -> {true, Context :: context()} | false.
|
||||
-spec authorize_api_key(swag_server_ushort:operation_id(), swag_server_ushort:api_key()) ->
|
||||
{true, Context :: context()} | false.
|
||||
authorize_api_key(OperationID, ApiKey) ->
|
||||
case parse_api_key(ApiKey) of
|
||||
{ok, {Type, Credentials}} ->
|
||||
@ -28,7 +29,8 @@ authorize_api_key(OperationID, ApiKey) ->
|
||||
log_auth_error(OperationID, Error) ->
|
||||
logger:info("API Key authorization failed for ~p due to ~p", [OperationID, Error]).
|
||||
|
||||
-spec parse_api_key(swag_server:api_key()) -> {ok, {bearer, Credentials :: binary()}} | {error, Reason :: atom()}.
|
||||
-spec parse_api_key(swag_server_ushort:api_key()) ->
|
||||
{ok, {bearer, Credentials :: binary()}} | {error, Reason :: atom()}.
|
||||
parse_api_key(ApiKey) ->
|
||||
case ApiKey of
|
||||
<<"Bearer ", Credentials/binary>> ->
|
||||
@ -37,15 +39,15 @@ parse_api_key(ApiKey) ->
|
||||
{error, unsupported_auth_scheme}
|
||||
end.
|
||||
|
||||
-spec authorize_api_key(swag_server:operation_id(), Type :: atom(), Credentials :: binary()) ->
|
||||
-spec authorize_api_key(swag_server_ushort:operation_id(), Type :: atom(), Credentials :: binary()) ->
|
||||
{ok, context()} | {error, Reason :: atom()}.
|
||||
authorize_api_key(_OperationID, bearer, Token) ->
|
||||
shortener_authorizer_jwt:verify(Token).
|
||||
|
||||
-spec authorize_operation(OperationID, Slug, ReqContext, WoodyCtx) -> ok | {error, forbidden} when
|
||||
OperationID :: swag_server:operation_id(),
|
||||
OperationID :: swag_server_ushort:operation_id(),
|
||||
Slug :: shortener_slug:slug() | no_slug,
|
||||
ReqContext :: swag_server:request_context(),
|
||||
ReqContext :: swag_server_ushort:request_context(),
|
||||
WoodyCtx :: woody_context:ctx().
|
||||
authorize_operation(OperationID, Slug, ReqContext, WoodyCtx) ->
|
||||
{{SubjectID, _ACL, ExpiresAt}, Claims} = get_auth_context(ReqContext),
|
||||
|
@ -31,7 +31,9 @@
|
||||
-type token() :: binary().
|
||||
-type claims() :: #{binary() => term()}.
|
||||
%% Added expiration to subject tuple as part of token service claims
|
||||
-type subject() :: {subject_id(), shortener_acl:t(), pos_integer() | undefined}.
|
||||
%% NOTE
|
||||
%% Hacky way to pass dialyzer. As it is a depricated auth method, I don't care
|
||||
-type subject() :: {subject_id(), shortener_acl:t(), pos_integer() | undefined} | {subject_id(), shortener_acl:t()}.
|
||||
-type subject_id() :: binary().
|
||||
-type t() :: {subject(), claims()}.
|
||||
-type expiration() ::
|
||||
|
@ -15,7 +15,7 @@ policy_init(Req) ->
|
||||
allowed_origins(_, State) ->
|
||||
{'*', State}.
|
||||
|
||||
-spec allowed_headers(cowboy_req:req(), any()) -> {[binary()], any()}.
|
||||
-spec allowed_headers(cowboy_req:req() | undefined, any()) -> {[binary()], any()}.
|
||||
allowed_headers(_, State) ->
|
||||
{
|
||||
[
|
||||
@ -29,6 +29,6 @@ allowed_headers(_, State) ->
|
||||
State
|
||||
}.
|
||||
|
||||
-spec allowed_methods(cowboy_req:req(), any()) -> {[binary()], any()}.
|
||||
-spec allowed_methods(cowboy_req:req() | undefined, any()) -> {[binary()], any()}.
|
||||
allowed_methods(_, State) ->
|
||||
{[<<"GET">>, <<"POST">>, <<"PUT">>, <<"DELETE">>, <<"OPTIONS">>], State}.
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
%% Swagger handler
|
||||
|
||||
-behaviour(swag_server_logic_handler).
|
||||
-behaviour(swag_server_ushort_logic_handler).
|
||||
|
||||
-export([authorize_api_key/4]).
|
||||
-export([handle_request/4]).
|
||||
@ -20,23 +20,27 @@
|
||||
%% TODO refactor in case of different classes of users using this API
|
||||
-define(REALM, <<"external">>).
|
||||
|
||||
-type operation_id() :: swag_server:operation_id().
|
||||
-type request_ctx() :: swag_server:request_context().
|
||||
-type operation_id() :: swag_server_ushort:operation_id().
|
||||
-type request_ctx() :: swag_server_ushort:request_context().
|
||||
-type request_data() :: #{atom() | binary() => term()}.
|
||||
-type subject_id() :: woody_user_identity:id().
|
||||
-type validation_error() :: swag_server_validation:error().
|
||||
-type validation_error() :: swag_server_ushort_validation:error().
|
||||
-type error_type() :: validation_error.
|
||||
-type error_message() :: swag_server:error_reason().
|
||||
-type error_message() :: swag_server_ushort:error_reason().
|
||||
|
||||
-spec authorize_api_key(
|
||||
operation_id(), swag_server:api_key(), swag_server:request_context(), swag_server:handler_opts(_)
|
||||
operation_id(),
|
||||
swag_server_ushort:api_key(),
|
||||
swag_server_ushort:request_context(),
|
||||
swag_server_ushort:handler_opts(_)
|
||||
) ->
|
||||
Result :: false | {true, shortener_auth:context()}.
|
||||
authorize_api_key(OperationID, ApiKey, _Context, _HandlerOpts) ->
|
||||
ok = scoper:add_scope('swag.server', #{operation => OperationID}),
|
||||
shortener_auth:authorize_api_key(OperationID, ApiKey).
|
||||
|
||||
-spec handle_request(operation_id(), request_data(), request_ctx(), any()) -> {ok | error, swag_server:response()}.
|
||||
-spec handle_request(operation_id(), request_data(), request_ctx(), any()) ->
|
||||
{ok | error, swag_server_ushort:response()}.
|
||||
handle_request(OperationID, Req, Context, _Opts) ->
|
||||
try
|
||||
AuthContext = get_auth_context(Context),
|
||||
@ -117,7 +121,7 @@ handle_woody_error(_Source, result_unknown, _Details) ->
|
||||
%%
|
||||
|
||||
-spec process_request(operation_id(), request_data(), shortener_slug:slug(), subject_id(), woody_context:ctx()) ->
|
||||
{ok | error, swag_server:response()}.
|
||||
{ok | error, swag_server_ushort:response()}.
|
||||
process_request(
|
||||
'ShortenUrl',
|
||||
#{
|
||||
|
@ -30,7 +30,7 @@ get_cowboy_config(LogicHandler, AdditionalRoutes, Opts) ->
|
||||
ShortUrlPath = maps:get(path, ShortUrlTemplate),
|
||||
Routes = squash_routes(
|
||||
AdditionalRoutes ++
|
||||
swag_server_router:get_paths(LogicHandler) ++
|
||||
swag_server_ushort_router:get_paths(LogicHandler) ++
|
||||
[{'_', [{genlib:to_list(ShortUrlPath) ++ ":shortenedUrlID", shortener_handler, #{}}]}]
|
||||
),
|
||||
CowboyOps = #{
|
||||
@ -63,7 +63,7 @@ mk_operation_id_getter(#{env := Env}) ->
|
||||
fun(Req) ->
|
||||
case cowboy_router:execute(Req, Env) of
|
||||
{ok, _, #{handler_opts := {_Operations, _LogicHandler, _SwaggerHandlerOpts} = HandlerOpts}} ->
|
||||
case swag_server_utils:get_operation_id(Req, HandlerOpts) of
|
||||
case swag_server_ushort_utils:get_operation_id(Req, HandlerOpts) of
|
||||
undefined ->
|
||||
#{};
|
||||
OperationID ->
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
-define(config(Key, C), (element(2, lists:keyfind(Key, 1, C)))).
|
||||
|
||||
-spec all() -> [test_case_name()].
|
||||
-spec all() -> [{atom(), test_case_name()} | test_case_name()].
|
||||
all() ->
|
||||
[
|
||||
{group, general}
|
||||
@ -95,7 +95,7 @@ end_per_suite(C) ->
|
||||
init_per_testcase(_Name, C) ->
|
||||
shortener_ct_helper:with_test_sup(C).
|
||||
|
||||
-spec end_per_testcase(test_case_name(), config()) -> config().
|
||||
-spec end_per_testcase(test_case_name(), config()) -> ok.
|
||||
end_per_testcase(_Name, C) ->
|
||||
shortener_ct_helper:stop_test_sup(C),
|
||||
ok.
|
||||
@ -116,7 +116,7 @@ failed_authorization(C) ->
|
||||
{ok, 401, _, _} = get_shortened_url(<<"42">>, C1).
|
||||
|
||||
insufficient_permissions(C) ->
|
||||
shortener_ct_helper:mock_services(
|
||||
_ = shortener_ct_helper:mock_services(
|
||||
[
|
||||
{bouncer, fun('Judge', _) ->
|
||||
{ok, #bdcs_Judgement{
|
||||
@ -133,7 +133,7 @@ insufficient_permissions(C) ->
|
||||
{ok, 403, _, _} = get_shortened_url(<<"42">>, C1).
|
||||
|
||||
readonly_permissions(C) ->
|
||||
shortener_ct_helper:mock_services(
|
||||
_ = shortener_ct_helper:mock_services(
|
||||
[
|
||||
{bouncer, fun('Judge', {_RulesetID, Fragments}) ->
|
||||
DecodedFragment = decode_shortener(Fragments),
|
||||
@ -162,7 +162,7 @@ readonly_permissions(C) ->
|
||||
{ok, 403, _, _} = delete_shortened_url(ID, C1).
|
||||
|
||||
other_subject_delete(C) ->
|
||||
shortener_ct_helper:mock_services(
|
||||
_ = shortener_ct_helper:mock_services(
|
||||
[
|
||||
{bouncer, fun('Judge', {_RulesetID, Fragments}) ->
|
||||
DecodedFragment = decode_shortener(Fragments),
|
||||
@ -208,7 +208,7 @@ other_subject_delete(C) ->
|
||||
{<<"location">>, SourceUrl} = lists:keyfind(<<"location">>, 1, Headers).
|
||||
|
||||
other_subject_read(C) ->
|
||||
shortener_ct_helper:mock_services(
|
||||
_ = shortener_ct_helper:mock_services(
|
||||
[
|
||||
{bouncer, fun('Judge', {_RulesetID, Fragments}) ->
|
||||
DecodedFragment = decode_shortener(Fragments),
|
||||
@ -276,19 +276,19 @@ construct_shortener_acl(Permissions) ->
|
||||
%%
|
||||
|
||||
shorten_url(ShortenedUrlParams, C) ->
|
||||
swag_client_shortener_api:shorten_url(
|
||||
swag_client_ushort_shortener_api:shorten_url(
|
||||
?config(api_endpoint, C),
|
||||
append_common_params(#{body => ShortenedUrlParams}, C)
|
||||
).
|
||||
|
||||
delete_shortened_url(ID, C) ->
|
||||
swag_client_shortener_api:delete_shortened_url(
|
||||
swag_client_ushort_shortener_api:delete_shortened_url(
|
||||
?config(api_endpoint, C),
|
||||
append_common_params(#{binding => #{<<"shortenedUrlID">> => ID}}, C)
|
||||
).
|
||||
|
||||
get_shortened_url(ID, C) ->
|
||||
swag_client_shortener_api:get_shortened_url(
|
||||
swag_client_ushort_shortener_api:get_shortened_url(
|
||||
?config(api_endpoint, C),
|
||||
append_common_params(#{binding => #{<<"shortenedUrlID">> => ID}}, C)
|
||||
).
|
||||
|
@ -112,7 +112,7 @@ end_per_suite(C) ->
|
||||
init_per_testcase(_Name, C) ->
|
||||
shortener_ct_helper:with_test_sup(C).
|
||||
|
||||
-spec end_per_testcase(test_case_name(), config()) -> config().
|
||||
-spec end_per_testcase(test_case_name(), config()) -> ok.
|
||||
end_per_testcase(_Name, C) ->
|
||||
shortener_ct_helper:stop_test_sup(C),
|
||||
ok.
|
||||
@ -126,7 +126,7 @@ end_per_testcase(_Name, C) ->
|
||||
-spec always_unique_url(config()) -> _.
|
||||
|
||||
successful_redirect(C) ->
|
||||
shortener_ct_helper:mock_services(
|
||||
_ = shortener_ct_helper:mock_services(
|
||||
[
|
||||
{bouncer, fun('Judge', _) ->
|
||||
{ok, #bdcs_Judgement{
|
||||
@ -145,7 +145,7 @@ successful_redirect(C) ->
|
||||
{<<"location">>, SourceUrl} = lists:keyfind(<<"location">>, 1, Headers).
|
||||
|
||||
successful_delete(C) ->
|
||||
shortener_ct_helper:mock_services(
|
||||
_ = shortener_ct_helper:mock_services(
|
||||
[
|
||||
{bouncer, fun('Judge', _) ->
|
||||
{ok, #bdcs_Judgement{
|
||||
@ -163,7 +163,7 @@ successful_delete(C) ->
|
||||
{ok, 404, _, _} = hackney:request(get, ShortUrl).
|
||||
|
||||
fordidden_source_url(C) ->
|
||||
shortener_ct_helper:mock_services(
|
||||
_ = shortener_ct_helper:mock_services(
|
||||
[
|
||||
{bouncer, fun('Judge', _) ->
|
||||
{ok, #bdcs_Judgement{
|
||||
@ -181,7 +181,7 @@ fordidden_source_url(C) ->
|
||||
{ok, 201, _, #{}} = shorten_url(construct_params(<<"ftp://ftp.hp.com/pub/hpcp/newsletter_july2003">>), C1).
|
||||
|
||||
url_expired(C) ->
|
||||
shortener_ct_helper:mock_services(
|
||||
_ = shortener_ct_helper:mock_services(
|
||||
[
|
||||
{bouncer, fun('Judge', _) ->
|
||||
{ok, #bdcs_Judgement{
|
||||
@ -200,7 +200,7 @@ url_expired(C) ->
|
||||
{ok, 404, _, _} = hackney:request(get, ShortUrl).
|
||||
|
||||
always_unique_url(C) ->
|
||||
shortener_ct_helper:mock_services(
|
||||
_ = shortener_ct_helper:mock_services(
|
||||
[
|
||||
{bouncer, fun('Judge', _) ->
|
||||
{ok, #bdcs_Judgement{
|
||||
@ -228,7 +228,7 @@ always_unique_url(C) ->
|
||||
-spec supported_cors_header(config()) -> _.
|
||||
|
||||
unsupported_cors_method(C) ->
|
||||
shortener_ct_helper:mock_services(
|
||||
_ = shortener_ct_helper:mock_services(
|
||||
[
|
||||
{bouncer, fun('Judge', _) ->
|
||||
{ok, #bdcs_Judgement{
|
||||
@ -247,7 +247,7 @@ unsupported_cors_method(C) ->
|
||||
false = lists:member(<<"access-control-allow-methods">>, Headers).
|
||||
|
||||
supported_cors_method(C) ->
|
||||
shortener_ct_helper:mock_services(
|
||||
_ = shortener_ct_helper:mock_services(
|
||||
[
|
||||
{bouncer, fun('Judge', _) ->
|
||||
{ok, #bdcs_Judgement{
|
||||
@ -268,7 +268,7 @@ supported_cors_method(C) ->
|
||||
Allowed = binary:split(Returned, <<",">>, [global]).
|
||||
|
||||
supported_cors_header(C) ->
|
||||
shortener_ct_helper:mock_services(
|
||||
_ = shortener_ct_helper:mock_services(
|
||||
[
|
||||
{bouncer, fun('Judge', _) ->
|
||||
{ok, #bdcs_Judgement{
|
||||
@ -294,7 +294,7 @@ supported_cors_header(C) ->
|
||||
[_ | Allowed] = binary:split(Returned, <<",">>, [global]).
|
||||
|
||||
unsupported_cors_header(C) ->
|
||||
shortener_ct_helper:mock_services(
|
||||
_ = shortener_ct_helper:mock_services(
|
||||
[
|
||||
{bouncer, fun('Judge', _) ->
|
||||
{ok, #bdcs_Judgement{
|
||||
@ -340,7 +340,7 @@ woody_timeout_test(C) ->
|
||||
<<"http://invalid_url:8022/v1/automaton">>
|
||||
)
|
||||
),
|
||||
shortener_ct_helper:mock_services(
|
||||
_ = shortener_ct_helper:mock_services(
|
||||
[
|
||||
{bouncer, fun('Judge', _) ->
|
||||
{ok, #bdcs_Judgement{
|
||||
@ -389,19 +389,19 @@ construct_shortener_acl(Permissions) ->
|
||||
%%
|
||||
|
||||
shorten_url(ShortenedUrlParams, C) ->
|
||||
swag_client_shortener_api:shorten_url(
|
||||
swag_client_ushort_shortener_api:shorten_url(
|
||||
?config(api_endpoint, C),
|
||||
append_common_params(#{body => ShortenedUrlParams}, C)
|
||||
).
|
||||
|
||||
delete_shortened_url(ID, C) ->
|
||||
swag_client_shortener_api:delete_shortened_url(
|
||||
swag_client_ushort_shortener_api:delete_shortened_url(
|
||||
?config(api_endpoint, C),
|
||||
append_common_params(#{binding => #{<<"shortenedUrlID">> => ID}}, C)
|
||||
).
|
||||
|
||||
get_shortened_url(ID, C) ->
|
||||
swag_client_shortener_api:get_shortened_url(
|
||||
swag_client_ushort_shortener_api:get_shortened_url(
|
||||
?config(api_endpoint, C),
|
||||
append_common_params(#{binding => #{<<"shortenedUrlID">> => ID}}, C)
|
||||
).
|
||||
|
@ -4,6 +4,6 @@
|
||||
|
||||
-export([handle_function/4]).
|
||||
|
||||
-spec handle_function(woody:func(), woody:args(), woody_context:ctx(), #{}) -> {ok, term()}.
|
||||
-spec handle_function(woody:func(), woody:args(), woody_context:ctx(), woody:options()) -> {ok, term()}.
|
||||
handle_function(FunName, Args, _, #{function := Fun}) ->
|
||||
Fun(FunName, Args).
|
||||
|
@ -1 +0,0 @@
|
||||
Subproject commit c12c9dd296912ec3c34ad443b448df98fef2556a
|
29
docker-compose.sh → docker-compose.yml
Executable file → Normal file
29
docker-compose.sh → docker-compose.yml
Executable file → Normal file
@ -1,29 +1,34 @@
|
||||
#!/bin/bash
|
||||
cat <<EOF
|
||||
version: '2.1'
|
||||
services:
|
||||
|
||||
${SERVICE_NAME}:
|
||||
image: ${BUILD_IMAGE}
|
||||
testrunner:
|
||||
image: $DEV_IMAGE_TAG
|
||||
build:
|
||||
dockerfile: Dockerfile.dev
|
||||
context: .
|
||||
args:
|
||||
OTP_VERSION: $OTP_VERSION
|
||||
THRIFT_VERSION: $THRIFT_VERSION
|
||||
volumes:
|
||||
- .:$PWD
|
||||
- $HOME/.cache:/home/$UNAME/.cache
|
||||
hostname: $SERVICE_NAME
|
||||
working_dir: $PWD
|
||||
command: /sbin/init
|
||||
depends_on:
|
||||
machinegun:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "8022:8022"
|
||||
command: /sbin/init
|
||||
|
||||
machinegun:
|
||||
image: dr2.rbkmoney.com/rbkmoney/machinegun:9c3248a68fe530d23a8266057a40a1a339a161b8
|
||||
image: docker.io/rbkmoney/machinegun:c05a8c18cd4f7966d70b6ad84cac9429cdfe37ae
|
||||
ports:
|
||||
- "8022"
|
||||
command: /opt/machinegun/bin/machinegun foreground
|
||||
volumes:
|
||||
- ./test/machinegun/config.yaml:/opt/machinegun/etc/config.yaml
|
||||
- ./test/machinegun/cookie:/opt/machinegun/etc/cookie
|
||||
healthcheck:
|
||||
test: "curl http://localhost:8022/"
|
||||
test: curl http://localhost:8022/health
|
||||
interval: 5s
|
||||
timeout: 1s
|
||||
retries: 12
|
||||
|
||||
EOF
|
||||
retries: 20
|
@ -1,5 +1,6 @@
|
||||
[
|
||||
{elvis, [
|
||||
{verbose, true},
|
||||
{config, [
|
||||
#{
|
||||
dirs => [
|
||||
@ -7,7 +8,7 @@
|
||||
"apps/*/test"
|
||||
],
|
||||
filter => "*.erl",
|
||||
ignore => ["_thrift.erl$", "swag/*", "_SUITE.erl$"],
|
||||
ignore => ["_thrift.erl$", "_SUITE.erl$"],
|
||||
rules => [
|
||||
{elvis_text_style, line_length, #{limit => 120, skip_comments => false}},
|
||||
{elvis_text_style, no_tabs},
|
||||
@ -50,7 +51,6 @@
|
||||
#{
|
||||
dirs => ["apps/*/src"],
|
||||
filter => "*.app.src",
|
||||
ignore => ["swag/*"],
|
||||
rules => [
|
||||
{elvis_text_style, line_length, #{limit => 120, skip_comments => false}},
|
||||
{elvis_text_style, no_tabs},
|
||||
|
65
rebar.config
65
rebar.config
@ -27,20 +27,31 @@
|
||||
% Common project dependencies.
|
||||
{deps, [
|
||||
{cowboy, "2.9.0"},
|
||||
{jose, "1.11.2"},
|
||||
{prometheus, "4.8.1"},
|
||||
{prometheus_cowboy, "0.1.8"},
|
||||
{genlib, {git, "https://github.com/rbkmoney/genlib.git", {branch, "master"}}},
|
||||
{cowboy_access_log, {git, "https://github.com/rbkmoney/cowboy_access_log.git", {branch, "master"}}},
|
||||
{logger_logstash_formatter, {git, "https://github.com/rbkmoney/logger_logstash_formatter.git", {branch, "master"}}},
|
||||
{woody, {git, "https://github.com/rbkmoney/woody_erlang.git", {branch, "master"}}},
|
||||
{woody_user_identity, {git, "https://github.com/rbkmoney/woody_erlang_user_identity.git", {branch, "master"}}},
|
||||
{scoper, {git, "https://github.com/rbkmoney/scoper.git", {branch, "master"}}},
|
||||
{mg_proto, {git, "https://github.com/rbkmoney/machinegun_proto.git", {branch, "master"}}},
|
||||
{bouncer_proto, {git, "https://github.com/rbkmoney/bouncer-proto.git", {branch, "master"}}},
|
||||
{bouncer_client, {git, "https://github.com/rbkmoney/bouncer_client_erlang.git", {branch, "master"}}},
|
||||
{erl_health, {git, "https://github.com/rbkmoney/erlang-health.git", {branch, "master"}}},
|
||||
{cowboy_cors, {git, "https://github.com/rbkmoney/cowboy_cors.git", {branch, "master"}}}
|
||||
{genlib, {git, "https://github.com/valitydev/genlib.git", {branch, "master"}}},
|
||||
{cowboy_access_log, {git, "https://github.com/valitydev/cowboy_access_log.git", {branch, "master"}}},
|
||||
{logger_logstash_formatter,
|
||||
{git, "https://github.com/valitydev/logger_logstash_formatter.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"}}},
|
||||
{scoper, {git, "https://github.com/valitydev/scoper.git", {branch, "master"}}},
|
||||
{mg_proto, {git, "https://github.com/valitydev/machinegun-proto.git", {branch, "master"}}},
|
||||
{bouncer_proto, {git, "https://github.com/valitydev/bouncer-proto.git", {branch, "master"}}},
|
||||
{bouncer_client, {git, "https://github.com/valitydev/bouncer_client_erlang.git", {branch, "master"}}},
|
||||
{erl_health, {git, "https://github.com/valitydev/erlang-health.git", {branch, "master"}}},
|
||||
{cowboy_cors, {git, "https://github.com/valitydev/cowboy_cors.git", {branch, "master"}}},
|
||||
|
||||
%% Libraries generated with swagger-codegen-erlang from valitydev/swag-url-shortener
|
||||
{swag_server_ushort,
|
||||
{git, "https://github.com/valitydev/swag-url-shortener", {branch, "release/erlang/ushort-server/master"}}},
|
||||
{swag_client_ushort,
|
||||
{git, "https://github.com/valitydev/swag-url-shortener", {branch, "release/erlang/ushort-client/master"}}},
|
||||
|
||||
%% NOTE
|
||||
%% Remove once bouncer client deps are updated
|
||||
{org_management_proto, {git, "https://github.com/valitydev/org-management-proto.git", {branch, master}}},
|
||||
%% NOTE
|
||||
%% Pinning to version "1.11.2" from hex here causes constant upgrading and recompilation of the entire project
|
||||
{jose, {git, "https://github.com/potatosalad/erlang-jose.git", {tag, "1.11.2"}}}
|
||||
]}.
|
||||
|
||||
{xref_checks, [
|
||||
@ -58,20 +69,25 @@
|
||||
race_conditions,
|
||||
unknown
|
||||
]},
|
||||
{plt_apps, all_deps},
|
||||
{plt_extra_apps, []}
|
||||
{plt_apps, all_deps}
|
||||
]}.
|
||||
|
||||
{profiles, [
|
||||
{prod, [
|
||||
{deps, [
|
||||
{how_are_you, {git, "https://github.com/rbkmoney/how_are_you.git", {ref, "2fd80134"}}},
|
||||
{woody_api_hay, {git, "https://github.com/rbkmoney/woody_api_hay.git", {ref, "4c39134cd"}}},
|
||||
%% 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"},
|
||||
{how_are_you, {git, "https://github.com/valitydev/how_are_you.git", {ref, "2fd80134"}}},
|
||||
{woody_api_hay, {git, "https://github.com/valitydev/woody_api_hay.git", {ref, "4c39134cd"}}},
|
||||
% for introspection on production
|
||||
{recon, "2.3.2"}
|
||||
]},
|
||||
{relx, [
|
||||
{release, {shortener, "0.1"}, [
|
||||
{release, {'url-shortener', "0.1"}, [
|
||||
% tools for introspection
|
||||
{recon, load},
|
||||
% debugger
|
||||
@ -81,6 +97,8 @@
|
||||
% log formatter
|
||||
woody_api_hay,
|
||||
how_are_you,
|
||||
prometheus,
|
||||
prometheus_cowboy,
|
||||
sasl,
|
||||
{logger_logstash_formatter, load},
|
||||
shortener
|
||||
@ -90,11 +108,16 @@
|
||||
{mode, minimal},
|
||||
{extended_start_script, true}
|
||||
]}
|
||||
]},
|
||||
{test, [
|
||||
{dialyzer, [{plt_extra_apps, [eunit, common_test, runtime_tools, swag_client_ushort]}]}
|
||||
]}
|
||||
]}.
|
||||
|
||||
{plugins, [
|
||||
{erlfmt, "1.0.0"}
|
||||
{project_plugins, [
|
||||
{covertool, "2.0.4"},
|
||||
{erlfmt, "1.0.0"},
|
||||
{rebar3_lint, "1.0.1"}
|
||||
]}.
|
||||
|
||||
{erlfmt, [
|
||||
|
93
rebar.lock
93
rebar.lock
@ -1,13 +1,11 @@
|
||||
{"1.2.0",
|
||||
[{<<"accept">>,{pkg,<<"accept">>,<<"0.3.5">>},2},
|
||||
{<<"bear">>,{pkg,<<"bear">>,<<"0.9.0">>},2},
|
||||
{<<"bouncer_client">>,
|
||||
{git,"https://github.com/rbkmoney/bouncer_client_erlang.git",
|
||||
[{<<"bouncer_client">>,
|
||||
{git,"https://github.com/valitydev/bouncer_client_erlang.git",
|
||||
{ref,"535449a459b70643836c440a863b42656f2a1409"}},
|
||||
0},
|
||||
{<<"bouncer_proto">>,
|
||||
{git,"https://github.com/rbkmoney/bouncer-proto.git",
|
||||
{ref,"19bd3d674fd4182927063e17e274559a08d422c5"}},
|
||||
{git,"https://github.com/valitydev/bouncer-proto.git",
|
||||
{ref,"96bd74dbf1db33ce1cbc6f6d3ce5a9b598ee29f5"}},
|
||||
0},
|
||||
{<<"cache">>,{pkg,<<"cache">>,<<"2.3.3">>},1},
|
||||
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.6.1">>},1},
|
||||
@ -17,26 +15,22 @@
|
||||
1},
|
||||
{<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.9.0">>},0},
|
||||
{<<"cowboy_access_log">>,
|
||||
{git,"https://github.com/rbkmoney/cowboy_access_log.git",
|
||||
{ref,"c058ad42cd11c6503feb398fb8587c2f72155a60"}},
|
||||
{git,"https://github.com/valitydev/cowboy_access_log.git",
|
||||
{ref,"04da359e022cf05c5c93812504d5791d6bc97453"}},
|
||||
0},
|
||||
{<<"cowboy_cors">>,
|
||||
{git,"https://github.com/rbkmoney/cowboy_cors.git",
|
||||
{git,"https://github.com/valitydev/cowboy_cors.git",
|
||||
{ref,"5a3b084fb8c5a4ff58e3c915a822d709d6023c3b"}},
|
||||
0},
|
||||
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.11.0">>},1},
|
||||
{<<"email_validator">>,{pkg,<<"email_validator">>,<<"1.1.0">>},0},
|
||||
{<<"erl_health">>,
|
||||
{git,"https://github.com/rbkmoney/erlang-health.git",
|
||||
{git,"https://github.com/valitydev/erlang-health.git",
|
||||
{ref,"5958e2f35cd4d09f40685762b82b82f89b4d9333"}},
|
||||
0},
|
||||
{<<"folsom">>,
|
||||
{git,"https://github.com/folsom-project/folsom.git",
|
||||
{ref,"62fd0714e6f0b4e7833880afe371a9c882ea0fc2"}},
|
||||
1},
|
||||
{<<"genlib">>,
|
||||
{git,"https://github.com/rbkmoney/genlib.git",
|
||||
{ref,"2bbc54d4abe0f779d57c8f5911dce64d295b1cd1"}},
|
||||
{git,"https://github.com/valitydev/genlib.git",
|
||||
{ref,"82c5ff3866e3019eb347c7f1d8f1f847bed28c10"}},
|
||||
0},
|
||||
{<<"gproc">>,{pkg,<<"gproc">>,<<"0.9.0">>},1},
|
||||
{<<"gun">>,
|
||||
@ -44,67 +38,64 @@
|
||||
{ref,"e7dd9f227e46979d8073e71c683395a809b78cb4"}},
|
||||
1},
|
||||
{<<"hackney">>,{pkg,<<"hackney">>,<<"1.17.4">>},0},
|
||||
{<<"how_are_you">>,
|
||||
{git,"https://github.com/rbkmoney/how_are_you.git",
|
||||
{ref,"2fd8013420328464c2c84302af2781b86577b39f"}},
|
||||
0},
|
||||
{<<"idna">>,{pkg,<<"idna">>,<<"6.1.1">>},1},
|
||||
{<<"jesse">>,
|
||||
{git,"https://github.com/rbkmoney/jesse.git",
|
||||
{git,"https://github.com/valitydev/jesse.git",
|
||||
{ref,"f4ff58e79ebe65650f9c445e730ad4c8d7f463a0"}},
|
||||
1},
|
||||
{<<"jose">>,
|
||||
{git,"https://github.com/potatosalad/erlang-jose.git",
|
||||
{ref,"991649695aaccd92c8effb1c1e88e6159fe8e9a6"}},
|
||||
0},
|
||||
{<<"jose">>,{pkg,<<"jose">>,<<"1.11.2">>},0},
|
||||
{<<"jsx">>,{pkg,<<"jsx">>,<<"3.1.0">>},0},
|
||||
{<<"logger_logstash_formatter">>,
|
||||
{git,"https://github.com/rbkmoney/logger_logstash_formatter.git",
|
||||
{git,"https://github.com/valitydev/logger_logstash_formatter.git",
|
||||
{ref,"2c7b71630527a932f2a1aef4edcec66863c1367a"}},
|
||||
0},
|
||||
{<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},1},
|
||||
{<<"mg_proto">>,
|
||||
{git,"https://github.com/rbkmoney/machinegun_proto.git",
|
||||
{ref,"f77367a05c89162bf1e6c3928d611343aba9717a"}},
|
||||
{git,"https://github.com/valitydev/machinegun-proto.git",
|
||||
{ref,"f533965771c168f3c6b61008958fb1366693476a"}},
|
||||
0},
|
||||
{<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.2.0">>},1},
|
||||
{<<"org_management_proto">>,
|
||||
{git,"git@github.com:rbkmoney/org-management-proto.git",
|
||||
{ref,"06c5c8430e445cb7874e54358e457cbb5697fc32"}},
|
||||
1},
|
||||
{git,"https://github.com/valitydev/org-management-proto.git",
|
||||
{ref,"abb4b4d9777ec65d4f9a1e5a8de81c7574d48422"}},
|
||||
0},
|
||||
{<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.4.1">>},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},
|
||||
{<<"quantile_estimator">>,{pkg,<<"quantile_estimator">>,<<"0.2.1">>},1},
|
||||
{<<"ranch">>,{pkg,<<"ranch">>,<<"1.8.0">>},1},
|
||||
{<<"scoper">>,
|
||||
{git,"https://github.com/rbkmoney/scoper.git",
|
||||
{git,"https://github.com/valitydev/scoper.git",
|
||||
{ref,"7f3183df279bc8181efe58dafd9cae164f495e6f"}},
|
||||
0},
|
||||
{<<"snowflake">>,
|
||||
{git,"https://github.com/rbkmoney/snowflake.git",
|
||||
{git,"https://github.com/valitydev/snowflake.git",
|
||||
{ref,"de159486ef40cec67074afe71882bdc7f7deab72"}},
|
||||
1},
|
||||
{<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.6">>},1},
|
||||
{<<"swag_client_ushort">>,
|
||||
{git,"https://github.com/valitydev/swag-url-shortener",
|
||||
{ref,"18d7995f26d71ab9bca61dc5869d91bfe906c2f6"}},
|
||||
0},
|
||||
{<<"swag_server_ushort">>,
|
||||
{git,"https://github.com/valitydev/swag-url-shortener",
|
||||
{ref,"2e7cb1542ae675ef06eca3aac7e3157e748155f7"}},
|
||||
0},
|
||||
{<<"thrift">>,
|
||||
{git,"https://github.com/rbkmoney/thrift_erlang.git",
|
||||
{ref,"846a0819d9b6d09d0c31f160e33a78dbad2067b4"}},
|
||||
{git,"https://github.com/valitydev/thrift_erlang.git",
|
||||
{ref,"c280ff266ae1c1906fb0dcee8320bb8d8a4a3c75"}},
|
||||
1},
|
||||
{<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.7.0">>},1},
|
||||
{<<"woody">>,
|
||||
{git,"https://github.com/rbkmoney/woody_erlang.git",
|
||||
{ref,"330bdcf71e99c2ea7aed424cd718939cb360ec1c"}},
|
||||
0},
|
||||
{<<"woody_api_hay">>,
|
||||
{git,"https://github.com/rbkmoney/woody_api_hay.git",
|
||||
{ref,"4c39134cddaa9bf6fb8db18e7030ae64f1efb3a9"}},
|
||||
{git,"https://github.com/valitydev/woody_erlang.git",
|
||||
{ref,"0c2e16dfc8a51f6f63fcd74df982178a9aeab322"}},
|
||||
0},
|
||||
{<<"woody_user_identity">>,
|
||||
{git,"https://github.com/rbkmoney/woody_erlang_user_identity.git",
|
||||
{git,"https://github.com/valitydev/woody_erlang_user_identity.git",
|
||||
{ref,"a480762fea8d7c08f105fb39ca809482b6cb042e"}},
|
||||
0}]}.
|
||||
[
|
||||
{pkg_hash,[
|
||||
{<<"accept">>, <<"B33B127ABCA7CC948BBE6CAA4C263369ABF1347CFA9D8E699C6D214660F10CD1">>},
|
||||
{<<"bear">>, <<"A31CCF5361791DD5E708F4789D67E2FEF496C4F05935FC59ADC11622F834D128">>},
|
||||
{<<"cache">>, <<"B23A5FE7095445A88412A6E614C933377E0137B44FFED77C9B3FEF1A731A20B2">>},
|
||||
{<<"certifi">>, <<"DBAB8E5E155A0763EEA978C913CA280A6B544BFA115633FA20249C3D396D9493">>},
|
||||
{<<"cowboy">>, <<"865DD8B6607E14CF03282E10E934023A1BD8BE6F6BACF921A7E2A96D800CD452">>},
|
||||
@ -113,21 +104,14 @@
|
||||
{<<"gproc">>, <<"853CCB7805E9ADA25D227A157BA966F7B34508F386A3E7E21992B1B484230699">>},
|
||||
{<<"hackney">>, <<"99DA4674592504D3FB0CFEF0DB84C3BA02B4508BAE2DFF8C0108BAA0D6E0977C">>},
|
||||
{<<"idna">>, <<"8A63070E9F7D0C62EB9D9FCB360A7DE382448200FBBD1B106CC96D3D8099DF8D">>},
|
||||
{<<"jose">>, <<"F4C018CCF4FDCE22C71E44D471F15F723CB3EFAB5D909AB2BA202B5BF35557B3">>},
|
||||
{<<"jsx">>, <<"D12516BAA0BB23A59BB35DCCAF02A1BD08243FCBB9EFE24F2D9D056CCFF71268">>},
|
||||
{<<"metrics">>, <<"25F094DEA2CDA98213CECC3AEFF09E940299D950904393B2A29D191C346A8486">>},
|
||||
{<<"mimerl">>, <<"67E2D3F571088D5CFD3E550C383094B47159F3EEE8FFA08E64106CDF5E981BE3">>},
|
||||
{<<"parse_trans">>, <<"6E6AA8167CB44CC8F39441D05193BE6E6F4E7C2946CB2759F015F8C56B76E5FF">>},
|
||||
{<<"prometheus">>, <<"FA76B152555273739C14B06F09F485CF6D5D301FE4E9D31B7FF803D26025D7A0">>},
|
||||
{<<"prometheus_cowboy">>, <<"CFCE0BC7B668C5096639084FCD873826E6220EA714BF60A716F5BD080EF2A99C">>},
|
||||
{<<"prometheus_httpd">>, <<"F616ED9B85B536B195D94104063025A91F904A4CFC20255363F49A197D96C896">>},
|
||||
{<<"quantile_estimator">>, <<"EF50A361F11B5F26B5F16D0696E46A9E4661756492C981F7B2229EF42FF1CD15">>},
|
||||
{<<"ranch">>, <<"8C7A100A139FD57F17327B6413E4167AC559FBC04CA7448E9BE9057311597A1D">>},
|
||||
{<<"ssl_verify_fun">>, <<"CF344F5692C82D2CD7554F5EC8FD961548D4FD09E7D22F5B62482E5AEAEBD4B0">>},
|
||||
{<<"unicode_util_compat">>, <<"BC84380C9AB48177092F43AC89E4DFA2C6D62B40B8BD132B1059ECC7232F9A78">>}]},
|
||||
{pkg_hash_ext,[
|
||||
{<<"accept">>, <<"11B18C220BCC2EAB63B5470C038EF10EB6783BCB1FCDB11AA4137DEFA5AC1BB8">>},
|
||||
{<<"bear">>, <<"47F71F098F2E3CD05E124A896C5EC2F155967A2B6FF6731E0D627312CCAB7E28">>},
|
||||
{<<"cache">>, <<"44516CE6FA03594D3A2AF025DD3A87BFE711000EB730219E1DDEFC816E0AA2F4">>},
|
||||
{<<"certifi">>, <<"524C97B4991B3849DD5C17A631223896272C6B0AF446778BA4675A1DFF53BB7E">>},
|
||||
{<<"cowboy">>, <<"2C729F934B4E1AA149AFF882F57C6372C15399A20D54F65C8D67BEF583021BDE">>},
|
||||
@ -136,15 +120,10 @@
|
||||
{<<"gproc">>, <<"587E8AF698CCD3504CF4BA8D90F893EDE2B0F58CABB8A916E2BF9321DE3CF10B">>},
|
||||
{<<"hackney">>, <<"DE16FF4996556C8548D512F4DBE22DD58A587BF3332E7FD362430A7EF3986B16">>},
|
||||
{<<"idna">>, <<"92376EB7894412ED19AC475E4A86F7B413C1B9FBB5BD16DCCD57934157944CEA">>},
|
||||
{<<"jose">>, <<"98143FBC48D55F3A18DABA82D34FE48959D44538E9697C08F34200FA5F0947D2">>},
|
||||
{<<"jsx">>, <<"0C5CC8FDC11B53CC25CF65AC6705AD39E54ECC56D1C22E4ADB8F5A53FB9427F3">>},
|
||||
{<<"metrics">>, <<"69B09ADDDC4F74A40716AE54D140F93BEB0FB8978D8636EADED0C31B6F099F16">>},
|
||||
{<<"mimerl">>, <<"F278585650AA581986264638EBF698F8BB19DF297F66AD91B18910DFC6E19323">>},
|
||||
{<<"parse_trans">>, <<"620A406CE75DADA827B82E453C19CF06776BE266F5A67CFF34E1EF2CBB60E49A">>},
|
||||
{<<"prometheus">>, <<"6EDFBE928D271C7F657A6F2C46258738086584BD6CAE4A000B8B9A6009BA23A5">>},
|
||||
{<<"prometheus_cowboy">>, <<"BA286BECA9302618418892D37BCD5DC669A6CC001F4EB6D6AF85FF81F3F4F34C">>},
|
||||
{<<"prometheus_httpd">>, <<"0BBE831452CFDF9588538EB2F570B26F30C348ADAE5E95A7D87F35A5910BCF92">>},
|
||||
{<<"quantile_estimator">>, <<"282A8A323CA2A845C9E6F787D166348F776C1D4A41EDE63046D72D422E3DA946">>},
|
||||
{<<"ranch">>, <<"49FBCFD3682FAB1F5D109351B61257676DA1A2FDBE295904176D5E521A2DDFE5">>},
|
||||
{<<"ssl_verify_fun">>, <<"BDB0D2471F453C88FF3908E7686F86F9BE327D065CC1EC16FA4540197EA04680">>},
|
||||
{<<"unicode_util_compat">>, <<"25EEE6D67DF61960CF6A794239566599B09E17E668D3700247BC498638152521">>}]}
|
||||
|
@ -1 +0,0 @@
|
||||
Subproject commit 9ebe453f77d7ffba9284d51669a60fb5d702d643
|
Loading…
Reference in New Issue
Block a user