feat(elixir): add docker deployment

This commit is contained in:
Schuwi
2025-09-14 21:01:04 +02:00
parent 02521f9c6d
commit 280caad641
6 changed files with 335 additions and 3 deletions

View File

@@ -0,0 +1,30 @@
defmodule ComponentsElixir.Release do
@moduledoc """
Used for executing DB release tasks when run in production without Mix
installed.
"""
@app :components_elixir
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
# Many platforms require SSL when connecting to the database
Application.ensure_all_started(:ssl)
Application.ensure_loaded(@app)
end
end