diff --git a/config/prod.exs b/config/prod.exs index 1fe2d9e..9610f3e 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -1,7 +1,6 @@ import Config -# Do not print debug messages in production -config :logger, level: :info +config :logger, level: :debug # Runtime production configuration, including reading # of environment variables, is done on config/runtime.exs. diff --git a/config/runtime.exs b/config/runtime.exs index 97f8eb7..fda5783 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -7,6 +7,20 @@ import Config # any compile-time configuration in here, as it won't be applied. # The block below contains prod specific runtime configuration. +logger_level = + case System.get_env("LOG_LEVEL", "info") do + "debug" -> :debug + "info" -> :info + "warn" -> :warning + "error" -> :error + val when val in ["warning", "error"] -> :error + _ -> :info + end + +config :logger, level: logger_level + +config :logger, :console, format: {Logger.Formatter, :format} + # ## Using releases # # If you use `mix release`, you need to explicitly enable the server @@ -39,13 +53,13 @@ if config_env() == :prod do config :policy_service, PolicyService.Repo, url: database_url, - pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"), + pool_size: 1, socket_options: maybe_ipv6 config :policy_service, PolicyService.EventStore, serializer: Commanded.Serialization.JsonSerializer, url: database_url, - pool_size: 5 + pool_size: 1 secret_key_base = System.get_env("SECRET_KEY_BASE") || diff --git a/flake.nix b/flake.nix index ea26888..7c3802c 100644 --- a/flake.nix +++ b/flake.nix @@ -29,13 +29,13 @@ meta = { mainProgram = "policy_service"; }; + removeCookie = false; }; dockerImage = pkgs.dockerTools.buildLayeredImage { name = "policy_service"; - contents = [ package pkgs.busybox pkgs.shadow ]; + contents = [ package pkgs.bashInteractive pkgs.busybox pkgs.shadow ]; config = { Cmd = [ "${package}/bin/policy_service" "start" ]; - Entrypoint = [ "/bin/sh" ]; }; }; in diff --git a/ops/chart/values.yaml b/ops/chart/values.yaml index 9555166..06bfa31 100644 --- a/ops/chart/values.yaml +++ b/ops/chart/values.yaml @@ -25,6 +25,7 @@ controllers: repository: gitea.corredorconect.com/software-engineering/policy-service tag: '{{ $.Chart.AppVersion }}' env: + LOG_LEVEL: debug MIX_ENV: prod PORT: "8080" PHX_HOST: "0.0.0.0" @@ -65,10 +66,10 @@ controllers: resources: requests: cpu: 100m - memory: 512Mi + memory: 256Mi limits: cpu: 500m - memory: 1Gi + memory: 512Mi service: main: