Hello,
The goal is to increase deployment process understanding and to run migrations prior to hot upgrade in Phoenix umbrella app deployed with distillery and edeliver.
After reading https://github.com/edeliver/edeliver/issues/102 and looking into the code my understanding is that there should be 2 modules to make it happen:
- overridden
MigrationModification
that will add second module to the relup file thus making “system” (edeliver?) to execute it during specific point at the upgrade process - module implementing
RunnableInstruction
behavior that will actually run the migrations
I assume that first module is needed during release assembly process and second should be compiled in the applications and accessible at runtime.
So I put them into apps/xxx_web/lib/relup
as upgrade_modification.ex
and run_migrations.ex
with exactly the sane content that bharendt provided in the comment https://github.com/edeliver/edeliver/issues/102#issuecomment-226312574 (it makes sense!) but nothing happend.
I also tried to add def usable?(_config), do: true
but that didn’t help as well.
Any suggestions?
UPDATE: I added a plugin AppName.Relup.UpgradeModification
directive to the distillery config as it pointed out in https://github.com/edeliver/edeliver/pull/248/files and now can see
==> Modifying relup file...
==> Using AppName.Relup.UpgradeModification module for relup modification.
during deployment but migrations are still pending.
Seems that modify_relup
is not called, since I can’t see neither info message nor a file being created
defmodule AppName.Relup.UpgradeModification do
use Edeliver.Relup.Modification
require Logger
def modify_relup(instructions, config) do
Logger.info "Running custom release modifications..."
File.touch("/tmp/upgrade-modifications")
instructions |> Edeliver.Relup.PhoenixModification.modify_relup(config)
|> AppName.Relup.Instructions.RunMigrations.modify_relup(config)
end
def priority, do: priority_user()
def usable?(_config), do: true
end
Also, module responsible for running migrations AppName.Relup.Instructions.RunMigrations
doesn’t show up in relup