Skip to content

Commit

Permalink
Merge branch 'master' into ayrat555/update-specs
Browse files Browse the repository at this point in the history
  • Loading branch information
ayrat555 authored Nov 20, 2020
2 parents 6efa21b + 8acfb91 commit a2c1ffa
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 96 deletions.
25 changes: 5 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -638,25 +638,6 @@ jobs:
echo $(circleci tests split ./tags.txt)
circleci tests split ./tags.txt > /tmp/tests-to-run
mix test --exclude test $(cat /tmp/tests-to-run)
- run:
name: (Cabbage) Format generated code and check for warnings
command: |
cd priv/cabbage
# run format ONLY on formatted code so that it cleans up quoted atoms because
# we cannot exclude folders to --warnings-as-errors
mix format apps/child_chain_api/lib/child_chain_api/model/*.ex
mix format apps/watcher_info_api/lib/watcher_info_api/model/*.ex
mix format apps/watcher_security_critical_api/lib/watcher_security_critical_api/model/*.ex
MIX_ENV=test mix do compile --warnings-as-errors --ignore-module-conflict --force, test --exclude test
- save_cache:
key: v2-mix-specs-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
paths:
- "priv/cabbage/deps"
- run:
name: (Cabbage) Credo and formatting
command: |
cd priv/cabbage
mix do credo, format --check-formatted --dry-run
test_docker_compose_performance:
description: "These are not actually performance tests, we're checking if the scripts work"
Expand Down Expand Up @@ -1072,7 +1053,11 @@ workflows:
- test_docker_compose_performance:
filters: *all_branches_and_tags
- test_docker_compose_reorg:
filters: *all_branches_and_tags
filters:
branches:
only:
- master
- master-v2
- audit_deps:
requires: [build]
filters: *all_branches_and_tags
Expand Down
78 changes: 9 additions & 69 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ help:
@echo " - \`make docker-remote-watcher_info\`: remote console (IEx-style) into the \c"
@echo "watcher_info application."
@echo ""
@echo " - \`make docker-remote-childchain\`: remote console (IEx-style) into the childchain application."
@echo ""
@echo "BARE METAL DEVELOPMENT"
@echo "----------------------"
@echo
Expand All @@ -55,9 +53,6 @@ help:
@echo "1. In the first one, start geth, postgres:"
@echo " make start-services"
@echo ""
@echo "2. In the second terminal window, run:"
@echo " make start-child_chain"
@echo ""
@echo "3. In the third terminal window, run:"
@echo " make start-watcher"
@echo ""
Expand All @@ -67,9 +62,6 @@ help:
@echo "5. Wait until they all boot. And run in the fifth terminal window:"
@echo " make get-alarms"
@echo ""
@echo "If you want to attach yourself to running services, use:"
@echo " make remote-child_chain"
@echo "or"
@echo " make remote-watcher"
@echo ""
@echo "or"
Expand All @@ -85,11 +77,10 @@ help:
list:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'

all: clean build-child_chain-prod build-watcher-prod build-watcher_info-prod
all: clean build-watcher-prod build-watcher_info-prod

WATCHER_IMAGE_NAME ?= "omisego/watcher:latest"
WATCHER_INFO_IMAGE_NAME ?= "omisego/watcher_info:latest"
CHILD_CHAIN_IMAGE_NAME ?= "omisego/child_chain:latest"

IMAGE_BUILDER ?= "omisegoimages/elixir-omg-builder:stable-20200410"
IMAGE_BUILD_DIR ?= $(PWD)
Expand Down Expand Up @@ -166,13 +157,6 @@ check-dialyzer:
# Building
#


build-child_chain-prod: deps-elixir-omg
$(ENV_PROD) mix do compile, release child_chain --overwrite

build-child_chain-dev: deps-elixir-omg
$(ENV_DEV) mix do compile, release child_chain --overwrite

build-watcher-prod: deps-elixir-omg
$(ENV_PROD) mix do compile, release watcher --overwrite

Expand Down Expand Up @@ -261,19 +245,16 @@ init_test: init-contracts
init_test_reorg: init-contracts-reorg

test:
mix test --include test --exclude common --exclude watcher --exclude watcher_info --exclude child_chain
mix test --include test --exclude common --exclude watcher --exclude watcher_info

test-watcher:
mix test --include watcher --exclude watcher_info --exclude child_chain --exclude common --exclude test
mix test --include watcher --exclude watcher_info --exclude common --exclude test

test-watcher_info:
mix test --include watcher_info --exclude watcher --exclude child_chain --exclude common --exclude test
mix test --include watcher_info --exclude watcher --exclude common --exclude test

test-common:
mix test --include common --exclude child_chain --exclude watcher --exclude watcher_info --exclude test

test-child_chain:
mix test --include child_chain --exclude common --exclude watcher --exclude watcher_info --exclude test
mix test --include common --exclude watcher --exclude watcher_info --exclude test

#
# Documentation
Expand All @@ -291,13 +272,6 @@ start-integration-watcher:
#
# Docker
#
docker-child_chain-prod:
docker run --rm -it \
-v $(PWD):/app \
-u root \
--entrypoint /bin/sh \
$(IMAGE_BUILDER) \
-c "cd /app && make build-child_chain-prod"

docker-watcher-prod:
docker run --rm -it \
Expand All @@ -315,13 +289,6 @@ docker-watcher_info-prod:
$(IMAGE_BUILDER) \
-c "cd /app && make build-watcher_info-prod"

docker-child_chain-build:
docker build -f Dockerfile.child_chain \
--build-arg release_version=$$(cat $(PWD)/VERSION)+$$(git rev-parse --short=7 HEAD) \
--cache-from $(CHILD_CHAIN_IMAGE_NAME) \
-t $(CHILD_CHAIN_IMAGE_NAME) \
.

docker-watcher-build:
docker build -f Dockerfile.watcher \
--build-arg release_version=$$(cat $(PWD)/VERSION)+$$(git rev-parse --short=7 HEAD) \
Expand All @@ -338,15 +305,13 @@ docker-watcher_info-build:

docker-watcher: docker-watcher-prod docker-watcher-build
docker-watcher_info: docker-watcher_info-prod docker-watcher_info-build
docker-child_chain: docker-child_chain-prod docker-child_chain-build

docker-perf:
docker build -f ./priv/perf/Dockerfile -t $(IMAGE_NAME) .

docker-build: docker-watcher docker-watcher_info docker-child_chain
docker-build: docker-watcher docker-watcher_info

docker-push: docker
docker push $(CHILD_CHAIN_IMAGE_NAME)
docker push $(WATCHER_IMAGE_NAME)
docker push $(WATCHER_INFO_IMAGE_NAME)

Expand Down Expand Up @@ -399,11 +364,6 @@ docker-update-watcher_info: localchain_contract_addresses.env
$(MAKE) docker-watcher_info
docker-compose up watcher_info

docker-update-child_chain: localchain_contract_addresses.env
docker stop elixir-omg_childchain_1
$(MAKE) docker-child_chain
docker-compose up childchain

docker-start-cluster-with-infura: localchain_contract_addresses.env
if [ -f ./docker-compose.override.yml ]; then \
docker-compose -f docker-compose.yml -f docker-compose-infura.yml -f docker-compose.override.yml up; \
Expand All @@ -424,15 +384,12 @@ docker-nuke: localchain_contract_addresses.env
$(MAKE) init-contracts

docker-remote-watcher:
docker exec -it watcher /app/bin/child_chain remote
docker exec -it watcher /app/bin/watcher remote

docker-remote-watcher_info:
docker exec -ti watcher_info /app/bin/watcher_info remote

docker-remote-childchain:
docker exec -ti childchain /app/bin/child_chain remote

.PHONY: docker-nuke docker-remote-watcher docker-remote-watcher_info docker-remote-childchain
.PHONY: docker-nuke docker-remote-watcher docker-remote-watcher_info

###
### barebone stuff
Expand Down Expand Up @@ -469,12 +426,6 @@ start-watcher_info:
. ${OVERRIDING_VARIABLES} && \
PORT=${WATCHER_INFO_PORT} _build/${BAREBUILD_ENV}/rel/watcher_info/bin/watcher_info $(OVERRIDING_START)

update-child_chain:
_build/dev/rel/child_chain/bin/child_chain stop ; \
$(ENV_DEV) mix do compile, release child_chain --overwrite && \
. ${OVERRIDING_VARIABLES} && \
exec _build/dev/rel/child_chain/bin/child_chain $(OVERRIDING_START) &

update-watcher:
_build/dev/rel/watcher/bin/watcher stop ; \
$(ENV_DEV) mix do compile, release watcher --overwrite && \
Expand All @@ -487,10 +438,6 @@ update-watcher_info:
. ${OVERRIDING_VARIABLES} && \
exec PORT=${WATCHER_INFO_PORT} _build/dev/rel/watcher_info/bin/watcher_info $(OVERRIDING_START) &

stop-child_chain:
. ${OVERRIDING_VARIABLES} && \
_build/dev/rel/child_chain/bin/child_chain stop

stop-watcher:
. ${OVERRIDING_VARIABLES} && \
_build/dev/rel/watcher/bin/watcher stop
Expand All @@ -499,10 +446,6 @@ stop-watcher_info:
. ${OVERRIDING_VARIABLES} && \
_build/dev/rel/watcher_info/bin/watcher_info stop

remote-child_chain:
. ${OVERRIDING_VARIABLES} && \
_build/dev/rel/child_chain/bin/child_chain remote

remote-watcher:
. ${OVERRIDING_VARIABLES} && \
_build/dev/rel/watcher/bin/watcher remote
Expand All @@ -520,7 +463,7 @@ get-alarms:
curl -s -X GET http://localhost:${WATCHER_INFO_PORT}/alarm.get

cluster-stop: localchain_contract_addresses.env
${MAKE} stop-watcher ; ${MAKE} stop-watcher_info ; ${MAKE} stop-child_chain ; docker-compose down
${MAKE} stop-watcher ; ${MAKE} stop-watcher_info ; docker-compose down

### git setup
init:
Expand All @@ -540,9 +483,6 @@ security_critical_api_specs:
info_api_specs:
swagger-cli bundle -r -t yaml -o apps/omg_watcher_rpc/priv/swagger/info_api_specs.yaml apps/omg_watcher_rpc/priv/swagger/info_api_specs/swagger.yaml

operator_api_specs:
swagger-cli bundle -r -t yaml -o apps/omg_child_chain_rpc/priv/swagger/operator_api_specs.yaml apps/omg_child_chain_rpc/priv/swagger/operator_api_specs/swagger.yaml

api_specs: security_critical_api_specs info_api_specs operator_api_specs

###
Expand Down
30 changes: 30 additions & 0 deletions apps/omg_status/lib/omg_status/sentry_filter.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2019-2020 OmiseGO Pte Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

defmodule OMG.Status.SentryFilter do
@moduledoc """
Sentry callback for filtering events.
"""
@behaviour Sentry.EventFilter

# when the development environment restarts it lacks network access
# something to do with Cloud DNS
def exclude_exception?(%MatchError{term: {:error, :nxdomain}}, _) do
true
end

def exclude_exception?(_, _) do
false
end
end
2 changes: 1 addition & 1 deletion apps/omg_status/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ defmodule OMG.Status.Mixfile do
{:telemetry, "~> 0.4.1"},
{:telemetry_metrics, "~> 0.4"},
{:telemetry_metrics_statsd, "~> 0.3.0"},
{:sentry, "~> 7.0"},
{:sentry, "~> 8.0"},
{:statix, git: "https://github.com/omisego/statix.git", branch: "otp-21.3.8.4-support-global-tag-patch"},
{:spandex_datadog, "~> 1.0"},
{:decorator, "~> 1.2"},
Expand Down
3 changes: 2 additions & 1 deletion apps/omg_watcher_rpc/lib/web/endpoint.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# limitations under the License.

defmodule OMG.WatcherRPC.Web.Endpoint do
use Sentry.PlugCapture
use Phoenix.Endpoint, otp_app: :omg_watcher_rpc
use Sentry.Phoenix.Endpoint

plug(Plug.RequestId)
plug(Plug.Logger, log: :debug)
Expand All @@ -31,6 +31,7 @@ defmodule OMG.WatcherRPC.Web.Endpoint do
json_decoder: Jason
)

plug(Sentry.PlugContext)
plug(Plug.MethodOverride)
plug(Plug.Head)

Expand Down
Loading

0 comments on commit a2c1ffa

Please sign in to comment.