Skip to content

Commit 5bc6f75

Browse files
authored
Merge pull request #95 from yknx4/chore/enable-sentry
chore: enable sentry
2 parents 59d0813 + f3ca590 commit 5bc6f75

File tree

5 files changed

+18
-3
lines changed

5 files changed

+18
-3
lines changed

Procfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web: mix phx.server
1+
web: mix.sentry_recompile && mix phx.server

config/prod.exs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,23 @@ config :librecov, :auth,
2727
password: System.get_env("LIBRECOV_PASSWORD"),
2828
realm: System.get_env("LIBRECOV_REALM") || "Protected LibreCov"
2929

30-
config :logger, level: :info
30+
config :logger, level: :info, backends: [:console, Sentry.LoggerBackend]
3131

3232
config Librecov.Plug.Github,
3333
secret: System.get_env("LIBRECOV_GITHUB_WEBOOK_SECRET") || "super-secret",
3434
path: "/api/v1/github_webhook",
3535
action: {Librecov.GithubService, :handle}
3636

37+
config :sentry,
38+
dsn: System.get_env("SENTRY_DSN"),
39+
environment_name: System.get_env("RELEASE_LEVEL") || "development",
40+
enable_source_code_context: true,
41+
root_source_code_path: File.cwd!(),
42+
tags: %{
43+
env: "production"
44+
},
45+
included_environments: [:production]
46+
3747
if File.exists?(Path.join(__DIR__, "prod.secret.exs")) do
3848
import_config "prod.secret.exs"
3949
end

lib/opencov/endpoint.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ defmodule Librecov.Endpoint do
3030
json_decoder: Jason
3131
)
3232

33+
plug(Sentry.PlugContext)
34+
3335
plug(Plug.MethodOverride)
3436
plug(Plug.Head)
3537

mix.exs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ defmodule Librecov.Mixfile do
3737

3838
defp deps do
3939
[
40+
{:sentry, "~> 8.0"},
4041
{:plug_cloudflare, ">= 1.2.0"},
4142
{:joken, "~> 2.0"},
4243
{:stream_gzip, "~> 0.4"},
@@ -79,7 +80,8 @@ defmodule Librecov.Mixfile do
7980
[
8081
"ecto.setup": ["ecto.create", "ecto.migrate", "seedex.seed"],
8182
"ecto.reset": ["ecto.drop", "ecto.setup"],
82-
"assets.compile": [&compile_assets/1, "phx.digest"]
83+
"assets.compile": [&compile_assets/1, "phx.digest"],
84+
sentry_recompile: ["compile", "deps.compile sentry --force"]
8385
]
8486
end
8587

mix.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"secure_password": {:hex, :secure_password, "0.6.0", "ee69bc305abb3e55f457d14a45e0ef71c8ddef1b29258c6d5a5ac172bc0258f7", [:mix], [{:comeonin, "~> 2.0", [hex: :comeonin, repo: "hexpm", optional: false]}, {:ecto, "~> 1.0 or ~> 2.0", [hex: :ecto, repo: "hexpm", optional: false]}], "hexpm", "5fbec6c6b714c494aedc8ca1a5d6f0db8fbd700859fc43191629d9d3ca2170b2"},
7070
"secure_random": {:hex, :secure_random, "0.5.1", "c5532b37c89d175c328f5196a0c2a5680b15ebce3e654da37129a9fe40ebf51b", [:mix], [], "hexpm", "1b9754f15e3940a143baafd19da12293f100044df69ea12db5d72878312ae6ab"},
7171
"seedex": {:hex, :seedex, "0.3.0", "486207bb909aa708a005cc1d67556295b44f2dc2704e1156f147a493ebeeb8ca", [:mix], [{:ecto, "~> 1.1 or ~> 2.1 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.0", [hex: :ecto_sql, repo: "hexpm", optional: false]}], "hexpm", "9dc4d2435ad55f320e7503c07115329dce944e29f6b43dd7e4689d3da95cd891"},
72+
"sentry": {:hex, :sentry, "8.0.5", "5ca922b9238a50c7258b52f47364b2d545beda5e436c7a43965b34577f1ef61f", [:mix], [{:hackney, "~> 1.8", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: true]}, {:plug, "~> 1.6", [hex: :plug, repo: "hexpm", optional: true]}, {:plug_cowboy, "~> 2.3", [hex: :plug_cowboy, repo: "hexpm", optional: true]}], "hexpm", "4972839fdbf52e886d7b3e694c8adf421f764f2fa79036b88fb4742049bd4b7c"},
7273
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"},
7374
"stream_gzip": {:hex, :stream_gzip, "0.4.1", "d5f611b3fa8f5c9d928db4c8446edb7e22bebdf38d9914b4017a6fff44887b26", [:mix], [], "hexpm", "343dee3cc30dc78562bb524e8ea802a13d6377fc6ef1c05ac4c9d9fb1f58044b"},
7475
"telemetry": {:hex, :telemetry, "0.4.3", "a06428a514bdbc63293cd9a6263aad00ddeb66f608163bdec7c8995784080818", [:rebar3], [], "hexpm", "eb72b8365ffda5bed68a620d1da88525e326cb82a75ee61354fc24b844768041"},

0 commit comments

Comments
 (0)