Uses a multi-stage Docker build that copies both app/ and blogex/, preserving the path dependency. Includes release scripts, migration module, and a sample Dokku setup script. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
32 lines
633 B
Elixir
32 lines
633 B
Elixir
defmodule Firehose.Release do
|
|
@moduledoc """
|
|
Tasks for production releases (e.g., database migrations).
|
|
|
|
Usage from Dokku:
|
|
dokku run APP_NAME /app/bin/migrate
|
|
"""
|
|
|
|
@app :firehose
|
|
|
|
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
|
|
Application.load(@app)
|
|
end
|
|
end
|