From ae3d9f53f4234cd9bc2c7a1ab7380d7f38036a2e Mon Sep 17 00:00:00 2001 From: Jeroen Date: Fri, 18 Aug 2023 13:42:39 +0200 Subject: [PATCH] Start app in migration to avoid SSL errors --- core/lib/core/release.ex | 8 ++++++++ core/mix.exs | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/lib/core/release.ex b/core/lib/core/release.ex index 5e3521fe0..8feb9c2f0 100644 --- a/core/lib/core/release.ex +++ b/core/lib/core/release.ex @@ -2,16 +2,24 @@ defmodule Core.Release do @app :core def migrate do + load_app() + for repo <- repos() do {:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :up, all: true)) end end def rollback(repo, version) do + load_app() {:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :down, to: version)) end defp repos do Application.fetch_env!(@app, :ecto_repos) end + + defp load_app do + :ssl.start() + Application.load(@app) + end end diff --git a/core/mix.exs b/core/mix.exs index 92c1daa94..1c7c1f193 100644 --- a/core/mix.exs +++ b/core/mix.exs @@ -44,7 +44,7 @@ defmodule Core.MixProject do def application do [ mod: {Core.Application, []}, - extra_applications: [:logger, :runtime_tools, :csv] + extra_applications: [:logger, :runtime_tools, :csv, :ssl] ] end