Add Dockerfile-based Dokku deployment for monorepo layout
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.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
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
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
cd -P -- "$(dirname -- "$0")"/..
|
||||
|
||||
exec ./bin/firehose eval Firehose.Release.migrate
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
cd -P -- "$(dirname -- "$0")"/..
|
||||
|
||||
PHX_SERVER=true exec ./bin/firehose start
|
||||
Reference in New Issue
Block a user