slow query logging + release tweaks

This commit is contained in:
Mayel 2021-06-22 15:26:54 +02:00
parent 6416b55d9b
commit 85378bdbce
6 changed files with 23 additions and 17 deletions

View file

@ -39,7 +39,7 @@ jobs:
env:
FLAVOUR: coordination
FLAVOUR_PATH: flavours/coordination
DOCKER_REPO: bonfire-with-valueflows-api
DOCKER_REPO: bonfire
steps:
-
name: Checkout
@ -94,8 +94,8 @@ jobs:
platforms: linux/amd64 #,linux/arm64,linux/arm/v7
push: true
tags: |
bonfirenetworks/${{ env.DOCKER_REPO }}:latest
bonfirenetworks/${{ env.DOCKER_REPO }}:${{steps.version.outputs.current-version}}
bonfirenetworks/${{ env.DOCKER_REPO }}:latest-${{ env.FLAVOUR }}
bonfirenetworks/${{ env.DOCKER_REPO }}:${{steps.version.outputs.current-version}}-${{ env.FLAVOUR }}
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

View file

@ -18,15 +18,15 @@ WITH_DOCKER ?= total
FORKS_PATH ?= ./forks/
MIX_ENV ?= dev
ORG_NAME ?= bonfirenetworks
APP_NAME ?= bonfire-$(FLAVOUR)
APP_NAME ?= bonfire
UID := $(shell id -u)
GID := $(shell id -g)
APP_REL_CONTAINER="$(ORG_NAME)_$(APP_NAME)_release"
APP_REL_CONTAINER="$(APP_NAME)_release"
APP_REL_DOCKERFILE=Dockerfile.release
APP_REL_DOCKERCOMPOSE=docker-compose.release.yml
APP_VSN ?= `grep -m 1 'version:' mix.exs | cut -d '"' -f2`
APP_BUILD ?= `git rev-parse --short HEAD`
APP_DOCKER_REPO="$(ORG_NAME)/$(APP_NAME)"
APP_DOCKER_REPO="$(ORG_NAME)/$(APP_NAME)-$(FLAVOUR)"
#### GENERAL SETUP RELATED COMMANDS ####
@ -320,18 +320,17 @@ rel.down: rel.env rel.stop ## Stop the running release
rel.shell: rel.env init docker.stop.web ## Runs a the app container and opens a simple shell inside of the container, useful to explore the image
@docker-compose -p $(APP_REL_CONTAINER) -f $(APP_REL_DOCKERCOMPOSE) run --name bonfire_web --service-ports --rm web /bin/bash
rel.shell.bg: rel.env ## Runs a simple shell inside of the running app container, useful to explore the image
rel.shell.bg: rel.env init ## Runs a simple shell inside of the running app container, useful to explore the image
@docker-compose -p $(APP_REL_CONTAINER) -f $(APP_REL_DOCKERCOMPOSE) exec web /bin/bash
rel.db.shell.bg: rel.env ## Runs a simple shell inside of the DB container, useful to explore the image
rel.db.shell.bg: rel.env init ## Runs a simple shell inside of the DB container, useful to explore the image
@docker-compose -p $(APP_REL_CONTAINER) -f $(APP_REL_DOCKERCOMPOSE) exec db /bin/bash
rel.db.dump: rel.env
@docker-compose -p $(APP_REL_CONTAINER) -f $(APP_REL_DOCKERCOMPOSE) exec db /bin/bash -c "PGPASSWORD=$(POSTGRES_PASSWORD) pg_dump --username $(POSTGRES_USER) $(POSTGRES_DB)" > data/db_dump.sql
rel.db.restore: rel.env
@docker-compose -p $(APP_REL_CONTAINER) -f $(APP_REL_DOCKERCOMPOSE) exec db /bin/bash -c "PGPASSWORD=$(POSTGRES_PASSWORD) psql --username $(POSTGRES_USER) $(POSTGRES_DB)" < $(file)
rel.db.dump: rel.env init
docker-compose -p $(APP_REL_CONTAINER) -f $(APP_REL_DOCKERCOMPOSE) exec db /bin/bash -c "PGPASSWORD=$(POSTGRES_PASSWORD) pg_dump --username $(POSTGRES_USER) $(POSTGRES_DB)" > data/db_dump.sql
rel.db.restore: rel.env init
cat $(file) | docker exec -i bonfire_release_db_1 /bin/bash -c "PGPASSWORD=$(POSTGRES_PASSWORD) psql -U $(POSTGRES_USER) $(POSTGRES_DB)"
#### DOCKER-SPECIFIC COMMANDS ####

View file

@ -5,7 +5,7 @@ services:
# You can build your own image from the source running:
# $ make rel-build
# $ make rel-tag-latest
image: "bonfirenetworks/bonfire-main:latest"
image: "bonfirenetworks/bonfire:latest-${FLAVOUR}"
container_name: "bonfire_web"
restart: always
ports:

View file

@ -82,10 +82,15 @@ if config_env() == :prod do
end # prod only config
# transactional emails
# start prod and dev only config
if config_env() != :test do
config :bonfire, Bonfire.Repo,
slow_query_ms: String.to_integer(System.get_env("SLOW_QUERY_MS", "100"))
# transactional emails
mail_blackhole = fn var ->
IO.puts(
"WARNING: The environment variable #{var} was not set or was set incorrectly, mail will NOT be sent."

View file

@ -9,6 +9,8 @@ defmodule Bonfire.Application do
use Application
def start(_type, _args) do
Bonfire.Repo.LogSlow.setup()
applications() #|> IO.inspect
|> Supervisor.start_link(strategy: :one_for_one, name: @sup_name)
end

View file

@ -30,6 +30,7 @@ defmodule Bonfire.Web.Telemetry do
summary("phoenix.socket_connected.duration", unit: @millis),
summary("phoenix.channel_joined.duration", unit: @millis),
summary("phoenix.channel_joined.duration", unit: @millis),
# Phoenix LiveView
summary("phoenix.live_view.mount.stop.duration", unit: @millis),
summary("phoenix.live_view.mount.exception.duration", unit: @millis),
@ -37,7 +38,6 @@ defmodule Bonfire.Web.Telemetry do
summary("phoenix.live_view.handle_params.exception.duration", unit: @millis),
summary("phoenix.live_view.handle_event.stop.duration", unit: @millis),
summary("phoenix.live_view.handle_event.exception.duration", unit: @millis),
summary("phoenix.live_component.handle_event.stop.duration", unit: @millis),
summary("phoenix.live_component.handle_event.exception.duration", unit: @millis),